|<< Back to previous view|
[PCC-10] stabs on OS X i386 cause Bus error in ld Created: 03/Dec/08 Updated: 08/Dec/08
|Reporter:||Gregory McGarry||Assignee:||Gregory McGarry|
|Environment:||OS X 10.5 intel (gcc 4.0.1, ld ld64-77)|
Compiling a helloworld.c with -g to generate stabs causes Bus error in ld.
$ pcc -v -g hw.c
pcc 0.9.9 for i386-apple-darwin9.5.0, email@example.com Wed Dec 3 18:03:52 EST 2008
/usr/local/libexec/cpp -v -D__PCC__=0 -D__PCC_MINOR__=9 -D__PCC_MINORMINOR__=9 -D__Darwin__ -I/usr/local/include//pcc -D__i386__ -D__LITTLE_ENDIAN__ -S /usr/include/ -I /usr/local/lib/pcc/i386-apple-darwin9.5.0/0.9.9/include/ hw.c /tmp/ctm.NiBE3T
cpp: pcc 0.9.9 for i386-apple-darwin9.5.0, firstname.lastname@example.org Wed Dec 3 18:03:52 EST 2008
/usr/local/libexec/ccom -v -g -k /tmp/ctm.NiBE3T /tmp/ctm.oBk9wD
ccom: pcc 0.9.9 for i386-apple-darwin9.5.0, email@example.com Wed Dec 3 18:03:52 EST 2008
as -v -o hw.o /tmp/ctm.oBk9wD
Apple Computer, Inc. version cctools-667.3~21, GNU assembler version 1.38
ld -v -e start /usr/lib/crt1.o hw.o -L/usr/local/lib/pcc/i386-apple-darwin9.5.0/0.9.9/lib/ -lSystem -lpcc
Library search paths:
Framework search paths:
can't find atom for N_GSYM stabs __stdinp:G15=*1 in hw.o
can't find atom for N_GSYM stabs __stdoutp:G15 in hw.o
can't find atom for N_GSYM stabs __stderrp:G15 in hw.o
can't find atom for N_GSYM stabs sys_nerr:G1 in hw.o
can't find atom for N_GSYM stabs sys_errlist:G16=ar1;0;-10202;17=*2 in hw.o
This error is also visible when running ./configure in pcc with PCC=pcc. Many of the tests fail because configure uses -g to compile all the conftest.c programs.
I couldn't reproduce this problem on Ubuntu, so maybe it's another problem with GNU deviating from the stabs specification again.
|Comment by Gregory McGarry [ 04/Dec/08 11:23 PM ]|
The problem is caused by pcc not inserting "end of text segment" stab entries.
ld on OS X 10.5 seems to need them. At least the intel version does.
The following stab needs to be inserted at the end of the text segment:
Additionally, gcc has a nice feature of trapping signals from ld:
collect2: ld terminated with signal 10 [Bus error]
It would be nice to have this feature in pcc - it makes it easier to isolate problems quickly.
|Comment by Gregory McGarry [ 04/Dec/08 11:26 PM ]|
Problem found in the C front-end.
|Comment by Gregory McGarry [ 08/Dec/08 10:41 PM ]|