http://bugs.winehq.org/show_bug.cgi?id=18832
Summary: compiling with -fprofile-generate fails on sfnt2fnt due to hidden symbol Product: Wine Version: 1.1.23 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: tools AssignedTo: wine-bugs@winehq.org ReportedBy: scott@open-vote.org
I've been attempting to experiment with compiling Wine using profile guided optimization, however make fails in tools/sfnt2fnt due to a hidden symbol.
GCC version: 4.3 on Ubuntu 9.04
x86_64-linux-gnu-gcc -m32 -Wall -g -O2 -fprofile-generate -o sfnt2fnt sfnt2fnt.o -L../libs/wine -lwine ../libs/port/libwine_port.a -lfreetype -lz -Wl,--rpath,$ORIGIN/../libs/wine /usr/bin/ld: sfnt2fnt: hidden symbol `__gcov_merge_add' in /usr/lib/gcc/x86_64-linux-gnu/4.3.3/32/libgcov.a(_gcov_merge_add.o) is referenced by DSO /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: ld returned 1 exit status make[1]: *** [sfnt2fnt] Error 1 make[1]: Leaving directory `/home/scott/src/wine-1.1.23-profiled/tools' make: *** [tools] Error 2
If I try hacking the makefile to add the -fno-profile-generate flag after that one, I get this error:
x86_64-linux-gnu-gcc -m32 -Wall -g -O2 -fprofile-generate -fno-profile-generate -o sfnt2fnt sfnt2fnt.o -L../libs/wine -lwine ../libs/port/libwine_port.a -lfreetype -lz -Wl,--rpath,$ORIGIN/../libs/wine sfnt2fnt.o: In function `exit_on_signal': /home/scott/src/wine-1.1.23-profiled/tools/sfnt2fnt.c:167: undefined reference to `__gcov_indirect_call_profiler' sfnt2fnt.o: In function `cleanup': /home/scott/src/wine-1.1.23-profiled/tools/sfnt2fnt.c:162: undefined reference to `__gcov_indirect_call_profiler' sfnt2fnt.o: In function `main': /home/scott/src/wine-1.1.23-profiled/tools/sfnt2fnt.c:567: undefined reference to `__gcov_indirect_call_profiler' sfnt2fnt.o: In function `fill_fontinfo': /home/scott/src/wine-1.1.23-profiled/tools/sfnt2fnt.c:416: undefined reference to `__gcov_one_value_profiler' sfnt2fnt.o: In function `global constructors keyed to 65535_0_main': /home/scott/src/wine-1.1.23-profiled/tools/sfnt2fnt.c:793: undefined reference to `__gcov_init' sfnt2fnt.o:(.data+0x44): undefined reference to `__gcov_merge_add' sfnt2fnt.o:(.data+0x50): undefined reference to `__gcov_merge_single' ../libs/wine/libwine.so: undefined reference to `__gcov_pow2_profiler' ../libs/wine/libwine.so: undefined reference to `__gcov_interval_profiler' ../libs/wine/libwine.so: undefined reference to `__gcov_execv' collect2: ld returned 1 exit status make[1]: *** [sfnt2fnt] Error 1 make[1]: Leaving directory `/home/scott/src/wine-1.1.23-profiled/tools' make: *** [tools] Error 2
This is strange as compiling without -fprofile-generate works fine.
http://bugs.winehq.org/show_bug.cgi?id=18832
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source CC| |austinenglish@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=18832
--- Comment #1 from Scott Ritchie scott@open-vote.org 2009-06-07 19:07:07 --- Some google searching returns this mailing list thread for someone having a similar problem: http://gcc.gnu.org/ml/gcc/2005-05/msg00653.html
http://bugs.winehq.org/show_bug.cgi?id=18832
--- Comment #2 from Scott Ritchie scott@open-vote.org 2009-06-07 21:51:03 --- If I add -fprofile-generate to LDFLAGS (as well as CFLAGS) then the hidden symbol errors go away (a similar thing happens when I manually add -shared to the cflags of the makefiles for these parts).
The gcov errors remain, however. It also looks like Mozilla is having the same issue: https://bugzilla.mozilla.org/show_bug.cgi?id=418866
http://bugs.winehq.org/show_bug.cgi?id=18832
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|tools |-unknown
http://bugs.winehq.org/show_bug.cgi?id=18832
--- Comment #3 from Scott Ritchie scott@open-vote.org 2009-06-08 05:48:18 --- No -fno-profile-generate is needed for the (4 or 5) programs like sfnt2fnt if you build this way:
make distclean && CFLAGS="-Wall -g -O2 -fprofile-generate" LDFLAGS="-fprofile-generate -lgcov" ./configure --host=x86_64-linux-gnu --build=x86_64-linux-gnu && make
However this again leads to a gcov error, this time in libwinecrt0
make[2]: Entering directory `/home/scott/src/wine-1.1.23-oldprofiled/dlls/avifile.dll16' ../../tools/winegcc/winegcc -m32 -B../../tools/winebuild --sysroot=../.. -shared ./avifile.dll16.spec -Wb,--subsystem,win16,--main-module,avifil32.dll -o avifile.dll16.so -lavifil32 -lkernel32 ../../libs/port/libwine_port.a -fprofile-generate -lgcov ../../dlls/winecrt0/libwinecrt0.a(dll_entry.o): In function `__wine_spec_dll_entry': /home/scott/src/wine-1.1.23-oldprofiled/dlls/winecrt0/dll_entry.c:30: undefined reference to `__gcov_indirect_call_profiler'
I will note that some dlls seem to build and link fine.
http://bugs.winehq.org/show_bug.cgi?id=18832
--- Comment #4 from Scott Ritchie scott@open-vote.org 2009-06-08 18:39:46 --- Really, the bug is failure to link to gcov for some reason.
I've now tested with Ubuntu 9.10 (alpha) and gcc 4.4 and it hasn't changed.
http://bugs.winehq.org/show_bug.cgi?id=18832
--- Comment #5 from Scott Ritchie scott@open-vote.org 2009-06-08 20:46:16 --- If I profile selectively, I can get subsets of the Wine source to build with -fprofile-generate.
Here's an issue I found from googling for gcov symbol errors:
http://stackoverflow.com/questions/566472/where-is-the-gcov-symbols
--- I just spent an incredible amount of time debugging a very similar error. Here's what I learned:
* You have to pass -fprofile-arcs -ftest-coverage when compiling. * You have to pass -fprofile-arcs when linking. * You can still get weird linker errors when linking. They'll look like this: libname.a(objfile.o):(.ctors+0x0): undefined reference to `global constructors keyed to long_name_of_file_and_function'
This means that gconv's having problem with one of your compiler-generated constructors (in my case, a copy-constructor). Check the function mentioned in the error message, see what kinds of objects it copy-constructs, and see if any of those classes doesn't have a copy constructor. Add one, and the error will go away.
Edit: Whether or not you optimize can also affect this. Try turing on / switching off optimizations if you're having problems with it. ---
These are the same kinds of errors I'm getting (/home/scott/src/wine-1.1.23-profiled/dlls/winecrt0/dll_entry.c:30: undefined reference to `__gcov_indirect_call_profiler')
So perhaps the suggestion is relevant to winecrt0.
http://bugs.winehq.org/show_bug.cgi?id=18832
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #6 from Austin English austinenglish@gmail.com 2010-07-11 13:23:07 --- Works fine in 1.2-rc7.
http://bugs.winehq.org/show_bug.cgi?id=18832
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |
--- Comment #7 from Austin English austinenglish@gmail.com 2010-07-11 15:04:55 --- Actually, sorry, still there.
http://bugs.winehq.org/show_bug.cgi?id=18832
--- Comment #8 from butraxz@gmail.com 2013-06-30 09:04:38 CDT --- This ticket has not been updated for over 900 days.
Is this still an issue in wine version 1.6-rc4 or higher or is this to be closed as abandoned ?
http://bugs.winehq.org/show_bug.cgi?id=18832
--- Comment #9 from Austin English austinenglish@gmail.com 2013-07-01 00:55:46 CDT --- Using -fprofile-generate for CFLAGS/LDFLAGS works now for all of wine, except the loader, with gcc-4.7.2.
Scott, can you retry?
https://bugs.winehq.org/show_bug.cgi?id=18832
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |1b23130d746f86173a95d0882b5 | |728e664ea5986 Status|REOPENED |RESOLVED CC| |nerv@dawncrow.de Resolution|--- |FIXED
--- Comment #10 from André H. nerv@dawncrow.de --- (In reply to Austin English from comment #9)
Using -fprofile-generate for CFLAGS/LDFLAGS works now for all of wine, except the loader, with gcc-4.7.2.
Yes, i'd say this is totally fixed for a while now. see also wiki.winehq.org/CodeCoverage
https://bugs.winehq.org/show_bug.cgi?id=18832
--- Comment #11 from Austin English austinenglish@gmail.com --- (In reply to André H. from comment #10)
(In reply to Austin English from comment #9)
Using -fprofile-generate for CFLAGS/LDFLAGS works now for all of wine, except the loader, with gcc-4.7.2.
Yes, i'd say this is totally fixed for a while now. see also wiki.winehq.org/CodeCoverage
Still fails for me in loader/, I filed bug 37447 for that.
https://bugs.winehq.org/show_bug.cgi?id=18832
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #12 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.7.30.
https://bugs.winehq.org/show_bug.cgi?id=18832
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net Component|-unknown |tools