http://bugs.winehq.org/show_bug.cgi?id=28050
Summary: llvm-gcc-4.5 fails to compile loader/preloader.c with optimizations enabled Product: Wine Version: 1.3.26 Platform: x86 URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=63718 2 OS/Version: Linux Status: NEW Keywords: download, source Severity: blocker Priority: P2 Component: loader AssignedTo: wine-bugs@winehq.org ReportedBy: austinenglish@gmail.com
austin@debian:~/wine-git/loader$ make llvm-gcc -o wine-preloader -static -nostartfiles -nodefaultlibs -Wl,-Ttext=0x7c400000 preloader.o ../libs/port/libwine_port.a preloader.o: In function `set_process_name': /home/austin/wine-git/loader//preloader.c:455: undefined reference to `memset' preloader.o: In function `map_so_lib': /home/austin/wine-git/loader//preloader.c:455: undefined reference to `memset' collect2: ld returned 1 exit status make: *** [wine-preloader] Error 1
make -k lets it compile and wine runs. Alternatively, you can disable optimization in loader/Makefile, and it will compile.
I tried a simple patch: diff --git a/loader/preloader.c b/loader/preloader.c index a94c52c..2e55d2a 100644 --- a/loader/preloader.c +++ b/loader/preloader.c @@ -173,6 +173,9 @@ void *__stack_chk_guard = 0; void __stack_chk_fail_local(void) { return; } void __stack_chk_fail(void) { return; }
+/* for dragonegg */ +void *memset(void *s, int c, size_t n) { return s; } + #ifdef __i386__
/* data for setting up the glibc-style thread-local storage in %gs */
but then wine segfaults :/. Additionally, using a simple implementation: (from http://clc-wiki.net/wiki/C_standard_library:string.h:memset) void *memset(void *s, int c, size_t n) { unsigned char* p=s; while(n--) *p++ = (unsigned char)c; return s; }
fails in the same way.
This is the only failure with llvm-gcc-4.5 (aka dragonegg), after that, at least noteapd runs. Haven't checked what tests fail yet though :)..
http://bugs.winehq.org/show_bug.cgi?id=28050
Duncan Sands baldrick@free.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |baldrick@free.fr
--- Comment #1 from Duncan Sands baldrick@free.fr 2011-08-11 02:04:08 CDT --- This is probably due to LLVM synthesizing a call to memset. Normally this should be disabled by compiling with -fno-builtin, but unfortunately dragonegg does not currently respect this flag. I suggest you open a bug report against dragonegg asking for -fno-builtin to be respected.
http://bugs.winehq.org/show_bug.cgi?id=28050
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|loader |-unknown Severity|blocker |minor
--- Comment #2 from Dmitry Timoshkov dmitry@baikal.ru 2011-08-11 02:23:24 CDT --- Most likely not a Wine bug -> Invalid.
http://bugs.winehq.org/show_bug.cgi?id=28050
--- Comment #3 from Duncan Sands baldrick@free.fr 2011-08-11 08:26:59 CDT --- Well, loader/preloader.c isn't compiled with -fno-builtins (wine version 1.27). Thus it is OK for the compiler to synthesize a call to memset in it. So if wine requires that there be no such calls, then it is a wine bug that -fno-builtins was not used.
Of course, -fno-builtins won't help until dragonegg is fixed to pay attention to it.
http://bugs.winehq.org/show_bug.cgi?id=28050
--- Comment #4 from Austin English austinenglish@gmail.com 2011-10-18 14:27:36 CDT --- (In reply to comment #3)
Well, loader/preloader.c isn't compiled with -fno-builtins (wine version 1.27). Thus it is OK for the compiler to synthesize a call to memset in it. So if wine requires that there be no such calls, then it is a wine bug that -fno-builtins was not used.
Of course, -fno-builtins won't help until dragonegg is fixed to pay attention to it.
http://llvm.org/bugs/show_bug.cgi?id=11172 http://llvm.org/bugs/show_bug.cgi?id=11173
http://bugs.winehq.org/show_bug.cgi?id=28050
Jeff Cook jeff@deseret-tech.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeff@deseret-tech.com
--- Comment #5 from Jeff Cook jeff@deseret-tech.com 2013-05-03 21:00:25 CDT --- The memset issue described in the original post occurs when compiling on mainline gcc 4.8 with -03.
http://bugs.winehq.org/show_bug.cgi?id=28050
--- Comment #6 from Duncan Sands baldrick@free.fr 2013-05-04 02:22:32 CDT --- Has the wine build been fixed to compile loader/preloader.c with -fno-builtins ?
http://bugs.winehq.org/show_bug.cgi?id=28050
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |UPSTREAM
--- Comment #7 from Austin English austinenglish@gmail.com 2013-05-06 17:29:02 CDT --- (In reply to comment #6)
Has the wine build been fixed to compile loader/preloader.c with -fno-builtins ?
With dragonegg from svn, wine builds fine, but crashes on start: austin@aw25 ~/src/wine-dragonegg $ ./wine notepad err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x7bc71be8 err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x7bc71be8
That should be a separate bug, of course.
For reference, this was with gcc-4.6.3: gcc-4.6.3 -fplugin=/home/austin/src/dragonegg/dragonegg.so -m32 -c -I. -I. -I../include -I../include -D__WINESRC__ -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wwrite-strings -gdwarf-2 -gstrict-dwarf -fno-omit-frame-pointer -Wpointer-arith -Wlogical-op -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fno-builtin -o main.o main.c
http://bugs.winehq.org/show_bug.cgi?id=28050
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #8 from Austin English austinenglish@gmail.com 2013-05-06 17:29:13 CDT --- Fixed UPSTREAM.
https://bugs.winehq.org/show_bug.cgi?id=28050
Gabriel Ravier gabravier@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gabravier@gmail.com