GNOME Bugzilla – Bug 122952
Apple's gcc doesn't like the assembly code in gstatomic_impl.h and gstarch.h
Last modified: 2004-12-22 21:47:04 UTC
I'm getting errors related to the assembly code while trying to compile on Darwin. First off I get: cc -DHAVE_CONFIG_H -I. -I. -I.. -I/Users/garnome/garnome/include -I/Users/garnome/garnome/X11R6/include -no-cpp-precomp -I/Users/garnome/garnome/include -I/usr/X11R6/include -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/Users/garnome/garnome/include/libxml2 -pthreads -I/Users/garnome/garnome/include/glib-2.0 -I/Users/garnome/garnome/lib/glib-2.0/include -I.. -DGST_DISABLE_DEPRECATED -g -I../libs -I../include -DG_LOG_DOMAIN=g_log_domain_gstreamer -DGST_CACHE_DIR=\"/Users/garnome/garnome/var/cache/gstreamer-0.6\" -O2 -g -c gstatomic.c -Wp,-MD,.deps/libgstreamer_0.6_la-gstatomic.TPlo -fno-common -DPIC -o libgstreamer_0.6_la-gstatomic.lo cc: unrecognized option `-pthreads' /var/tmp//cctLjkSm.s:185:Parameter syntax error (parameter 3) /var/tmp//cctLjkSm.s:205:Parameter syntax error (parameter 3) /var/tmp//cctLjkSm.s:224:Parameter syntax error (parameter 3) make[5]: *** [libgstreamer_0.6_la-gstatomic.lo] Error 1 Just for kicks, I added -save-temps to the CFLAGS, and took a look at the .s that was created. It seems that Apple's gcc doesn't like the #blah comments in the assembly code (I know nothing about assembly, so this could be totally off base.) I created a patch removing those comments, and it compiled fine. Next error I get is: cc -DHAVE_CONFIG_H -I. -I. -I.. -I/Users/garnome/garnome/include -I/Users/garnome/garnome/X11R6/include -no-cpp-precomp -I/Users/garnome/garnome/include -I/usr/X11R6/include -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/Users/garnome/garnome/include/libxml2 -pthreads -I/Users/garnome/garnome/include/glib-2.0 -I/Users/garnome/garnome/lib/glib-2.0/include -I.. -DGST_DISABLE_DEPRECATED -g -I../libs -I../include -DG_LOG_DOMAIN=g_log_domain_gstreamer -DGST_CACHE_DIR=\"/Users/garnome/garnome/var/cache/gstreamer-0.6\" -O2 -g -c cothreads.c -Wp,-MD,.deps/libcothreads_la-cothreads.TPlo -fno-common -DPIC -o libcothreads_la-cothreads.lo cc: unrecognized option `-pthreads' /var/tmp//ccKDGD7C.s:2731:Parameter syntax error (parameter 1) /var/tmp//ccKDGD7C.s:2735:Parameter syntax error (parameter 1) /var/tmp//ccKDGD7C.s:2736:Parameter syntax error (parameter 2) make[5]: *** [libcothreads_la-cothreads.lo] Error 1 Looking in the save file, I see this: L167: .stabd 68,0,643 lwz r10,64(r1) lwz r9,28(r10) addi r0,r9,-16 stw r0,28(r10) stw r11,-16(r9) .stabd 68,0,644 lwz 1,28(r10) .stabd 68,0,646 addis r9,r31,ha16(L_cothread_stub$non_lazy_ptr-L9$pb) lwz r9,lo16(L_cothread_stub$non_lazy_ptr-L9$pb)(r9) mr 0,r9 mtlr 0 blrl .stabd 68,0,649 It looks like the lwz from gstarch.h (3rd one down) is not what is expected (but again, I don't know jack squat about assembly.) I can upload the entire cothreads.s (or anything else) if needed.
Created attachment 20190 [details] [review] patch
Please attach the entire .s file.
Patch applied to HEAD.
Created attachment 20191 [details] entire cothreads.s file
Created attachment 20196 [details] [review] patch for second problem
Created attachment 20198 [details] Still no dice, here is the cothreads.s
If it doesn't work with that patch applied, it's a gcc bug. I suggest you check against 3.2 or 3.3.
Patches applied to 0.6 branch and HEAD. I'm closing the bug because I think it's no longer a GStreamer bug. Please retest with gcc-3.2 or 3.3 and reopen if it is still a problem.
I just tried this with gcc-3.3, and it's still not working. It looks like cothreads.s has extra an extra % in it for the lines that were patched.
Grrr... I'm dumb. The second patch is wrong, but I didn't notice, since the code is not actually used on Linux/powerpc.
Created attachment 20202 [details] [review] new patch for gstarch.h
Created attachment 20203 [details] [review] configure.ac patch
And a patch to configure.ac to use -Wa,-mregnames if possible. This flag tells gas to use symbolic register names (r0, r1, etc.), similar to what other assemblers do. thomasvs: could you comment on this?
This seems to have done the trick. It compiles fine now, but I haven't been able to test it yet, since gst-plugins has some issues ;( It looks like there is some PPC assembly in /gst-libs/gst/resample/dtos.c also. Should I file a different bug against this? Also, it looks like Apple is using a heavily modified gas, and doesn't support -mregnames.
I doubt you're using gas, which is the problem. You probably have some derivative of the Metrowerks. I'll fix dtos.c sometime soon. We can use this bug.
Here's the as -v -V output: + /usr/libexec/gcc/darwin/ppc/as -v -V 'Apple Computer, Inc. version cctools-490.obj~3, GNU assembler version 1.38 yipes.
*** Bug 125387 has been marked as a duplicate of this bug. ***
the latest patch committed here breaks on gnu as. my patch should work for both linuxppc and darwinppc, maybe adding an explicit test against the correct def would be better.
Luca: no, your patch doesn't work. On Darwin, __GNUC is defined, since it's gcc. But the assembler requires r%d notation. The configure.ac patch above fixes everything -- it just didn't make it into 0.6.4 by mistake.
ops, sorry wrong assumption from me =/
*** Bug 127425 has been marked as a duplicate of this bug. ***
Is there some issue that I missed? I believe this bug can be closed. Please reopen if I'm wrong.