After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 122952 - Apple's gcc doesn't like the assembly code in gstatomic_impl.h and gstarch.h
Apple's gcc doesn't like the assembly code in gstatomic_impl.h and gstarch.h
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: dont know
0.6.3
Other Mac OS
: Normal normal
: 0.6.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 125387 127425 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-09-22 17:24 UTC by Jerry Talkington
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.21 KB, patch)
2003-09-22 18:58 UTC, David Schleef
none Details | Review
entire cothreads.s file (77.76 KB, text/plain)
2003-09-22 19:29 UTC, Jerry Talkington
  Details
patch for second problem (738 bytes, patch)
2003-09-22 20:44 UTC, David Schleef
none Details | Review
Still no dice, here is the cothreads.s (77.75 KB, text/plain)
2003-09-22 21:08 UTC, Jerry Talkington
  Details
new patch for gstarch.h (906 bytes, patch)
2003-09-23 00:13 UTC, David Schleef
none Details | Review
configure.ac patch (847 bytes, patch)
2003-09-23 00:57 UTC, David Schleef
none Details | Review

Description Jerry Talkington 2003-09-22 17:24:36 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.
Comment 1 David Schleef 2003-09-22 18:58:57 UTC
Created attachment 20190 [details] [review]
patch
Comment 2 David Schleef 2003-09-22 19:07:17 UTC
Please attach the entire .s file.
Comment 3 David Schleef 2003-09-22 19:16:03 UTC
Patch applied to HEAD.
Comment 4 Jerry Talkington 2003-09-22 19:29:46 UTC
Created attachment 20191 [details]
entire cothreads.s file
Comment 5 David Schleef 2003-09-22 20:44:40 UTC
Created attachment 20196 [details] [review]
patch for second problem
Comment 6 Jerry Talkington 2003-09-22 21:08:28 UTC
Created attachment 20198 [details]
Still no dice, here is the cothreads.s
Comment 7 David Schleef 2003-09-22 21:31:14 UTC
If it doesn't work with that patch applied, it's a gcc bug.  I suggest
you check against 3.2 or 3.3.
Comment 8 David Schleef 2003-09-22 21:49:56 UTC
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.
Comment 9 Jerry Talkington 2003-09-22 22:21:07 UTC
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.
Comment 10 David Schleef 2003-09-22 23:57:24 UTC
Grrr... I'm dumb.  The second patch is wrong, but I didn't notice,
since the code is not actually used on Linux/powerpc.
Comment 11 David Schleef 2003-09-23 00:13:56 UTC
Created attachment 20202 [details] [review]
new patch for gstarch.h
Comment 12 David Schleef 2003-09-23 00:57:10 UTC
Created attachment 20203 [details] [review]
configure.ac patch
Comment 13 David Schleef 2003-09-23 00:59:27 UTC
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?
Comment 14 Jerry Talkington 2003-09-23 05:38:46 UTC
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.
Comment 15 David Schleef 2003-09-23 16:10:14 UTC
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.
Comment 16 Jerry Talkington 2003-09-23 16:21:08 UTC
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.
Comment 17 David Schleef 2003-10-24 17:16:53 UTC
*** Bug 125387 has been marked as a duplicate of this bug. ***
Comment 18 Luca Barbato 2003-10-25 01:25:30 UTC
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.
Comment 19 David Schleef 2003-10-26 01:07:17 UTC
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.
Comment 20 Luca Barbato 2003-11-08 02:40:39 UTC
ops, sorry
wrong assumption from me =/
Comment 21 David Schleef 2003-11-19 21:33:08 UTC
*** Bug 127425 has been marked as a duplicate of this bug. ***
Comment 22 David Schleef 2004-03-06 03:30:32 UTC
Is there some issue that I missed?  I believe this bug can be closed.
 Please reopen if I'm wrong.