[M3devel] the SOLgnu alignment problem finally understood

Jay K jay.krell at cornell.edu
Tue Aug 4 00:29:48 CEST 2009


cm3cg's lack of support for -g or -gdwarf etc. shouldn't mean gcc/gas doesn't support -g.
Yes, -g is rare in the config files. This was perhaps an oversight.
This seems like a gcc or gas bug, but oh well.
My gcc is old 3.x.
Note that on some systems -gstabs isn't supported, like PA64_HPUX I think.
But using cm3cg -g tends to "internal compiler error" and such.
 A problem for the potential future, things are adequate for now.
 
 - Jay


----------------------------------------
> Date: Mon, 3 Aug 2009 13:26:28 +0200
> From: wagner at elegosoft.com
> To: jay.krell at cornell.edu
> CC: m3devel at elegosoft.com
> Subject: Re: the SOLgnu alignment problem finally understood
>
> We had similar problems before with -g. CM3 never supported dwarf
> debugging format, just stabs. I think we changed all -g occurences
> in the config files to -gstabs some years ago.
>
> It sounds like a small fix in the config files after all, correct?
> At least for this RC?
>
> Olaf
>
> Quoting Jay K :
>
>>
>> Here finally is a small example of the SOLgnu problem I've been
>> looking at it.
>>
>>
>> It is specific to using /usr/sfw/bin/gcc -g to asssemble.
>> No problem without -g, no problem with /usr/bin/cc, no problem with
>> whatever I built in /usr/local/bin/gcc, no problem if you assemble
>> with anything else and then link with /usr/sfw/bin/gcc -g.
>>
>>
>> -bash-3.00$ cat 4.c asm.s
>>
>> 4.c
>> void Asm(void);
>> #include
>>
>> int main()
>> {
>> Asm();
>> printf("\n");
>> return 0;
>> }
>>
>> asm.s
>>
>> .section ".text",#alloc,#execinstr
>> .align 4
>> .global Asm
>> .type Asm,#function
>> Asm:
>> retl
>> nop
>> .size Asm, (.-Asm)
>>
>>
>> Not all possibilities shown here:
>>
>>
>> -bash-3.00$ /usr/local/bin/gcc -g asm.s 4.c
>> ok
>>
>>
>> -bash-3.00$ /usr/sfw/bin/gcc -g asm.s 4.c
>> ld: fatal: relocation error: R_SPARC_32: file /var/tmp//ccICgvny.o:
>> symbol : offset 0xfeed139e is non-aligned
>> ld: fatal: relocation error: R_SPARC_32: file /var/tmp//ccICgvny.o:
>> symbol : offset 0xfeed14c2 is non-aligned
>> ld: fatal: relocation error: R_SPARC_32: file /var/tmp//ccICgvny.o:
>> symbol : offset 0xfeed15f6 is non-aligned
>> collect2: ld returned 1 exit status
>>
>>
>> -bash-3.00$ /usr/bin/cc -g asm.s 4.c
>> asm.s:
>> 4.c:
>> ok
>>
>> -bash-3.00$ /usr/bin/cc asm.s 4.c
>> asm.s:
>> 4.c:
>> ok
>>
>>
>> -bash-3.00$ /usr/sfw/bin/gcc asm.s 4.c
>> ok
>>
>>
>> -bash-3.00$ /usr/local/bin/gcc asm.s 4.c
>> ok
>>
>>
>> -bash-3.00$ /usr/sfw/bin/gcc -g -c asm.s
>> ok but haven't linked yet, input to later steps
>>
>>
>> -bash-3.00$ /usr/bin/cc asm.o 4.c
>> ld: fatal: relocation error: R_SPARC_32: file asm.o: symbol : offset 0x
>> ff10148e is non-aligned
>> ld: fatal: relocation error: R_SPARC_32: file asm.o: symbol : offset 0x
>> ff1014ca is non-aligned
>> ld: fatal: relocation error: R_SPARC_32: file asm.o: symbol : offset 0x
>> ff1015be is non-aligned
>>
>>
>> -bash-3.00$ /usr/local/bin/gcc asm.o 4.c
>> ld: fatal: relocation error: R_SPARC_32: file asm.o: symbol : offset 0x
>> feee1213 is non-aligned
>> ld: fatal: relocation error: R_SPARC_32: file asm.o: symbol : offset 0x
>> feee122a is non-aligned
>> ld: fatal: relocation error: R_SPARC_32: file asm.o: symbol : offset 0x
>> feee122e is non-aligned
>> ld: fatal: relocation error: R_SPARC_32: file asm.o: symbol : offset 0x
>> feee1232 is non-aligned
>> ld: fatal: relocation error: R_SPARC_32: file asm.o: symbol : offset 0x
>> feee126e is non-aligned
>> collect2: ld returned 1 exit status
>>
>>
>>
>> -bash-3.00$ /usr/local/bin/gcc -g -c asm.s
>> ok, try linking with others
>>
>>
>> -bash-3.00$ /usr/bin/cc asm.o 4.c
>> ok
>>
>>
>>
>> -bash-3.00$ /usr/sfw/bin/gcc asm.o 4.c
>> ok
>>
>>
>> Actually even -gstabs or -gstabs+ instead of -g make it work.
>> -g resolves to -gdwarf2.
>>
>>
>> - Jay
>
>
>
> --
> Olaf Wagner -- elego Software Solutions GmbH
> Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
> phone: +49 30 23 45 86 96 mobile: +49 177 2345 869 fax: +49 30 23 45 86 95
> http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
> Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194
>


More information about the M3devel mailing list