pic+64bit+sun assembler+unwind-tables => illegal cross section subtraction

Jay K jay.krell@cornell.edu
Mon May 10 07:42:00 GMT 2010


It might also be necessary to configure for i586-sun-solaris2.10 instead of i586-solaris2.10.
Something I read said you can use various shorter forms, and I like the idea for convenience and to avoid those "pc"s and "unknown"s,
but this seems to have bitten me a number of times, not just today.

Anyway, it is working for me, configure -without-gnu-as i586-sun-solaris2.10, having applied Rainer's change to a 4.3 tree.
 (Yes, I'd like to upgrade.)

It seems using GNU as might still be slightly preferred in order to move data (jump tables) out of .text and into read only data, like, you know, "the less that is executable, the more secure". Though for locality, .text might be better.

For now I'm erring toward using what is more often present in the same location.

I should have just waited till I tested with 4.5, that would have shut me up. :)

Thanks,
 - Jay

----------------------------------------
> From: jay.krell@cornell.edu
> To: pinskia@gmail.com
> CC: gcc@gcc.gnu.org
> Subject: RE: pic+64bit+sun assembler+unwind-tables => illegal cross section subtraction
> Date: Mon, 10 May 2010 03:17:40 +0000
>
>
> Fix in 4.4.0.
>
> I was getting:
>
> .LASFDE1:
> .long .LASFDE1-.Lframe1
> .long .LFB2-. <<<
> .long .LFE2-.LFB2
>
> 4.5.0 configured right:
>
> .LASFDE1:
> .long .LASFDE1-.Lframe1
> .long .LFB0@rel <<<
> .long .LFE0-.LFB0
>
> dw2_asm_output_encoded_addr_rtx =>
>
> #ifdef ASM_OUTPUT_DWARF_PCREL
> ASM_OUTPUT_DWARF_PCREL (asm_out_file, size, XSTR (addr, 0));
> #else
> dw2_assemble_integer (size, gen_rtx_MINUS (Pmode, addr, pc_rtx));
> #endif
>
> 
> C:\src\gcc-4.4.0\gcc\config\i386\sol2-10.h(45):#define ASM_OUTPUT_DWARF_PCREL(FILE, SIZE, LABEL) \
> C:\src\gcc-4.5.0\gcc\config\i386\sol2-10.h(46):#define ASM_OUTPUT_DWARF_PCREL(FILE, SIZE, LABEL) \
>
>
> #define ASM_OUTPUT_DWARF_PCREL(FILE, SIZE, LABEL) \
> do { \
> fputs (integer_asm_op (SIZE, FALSE), FILE); \
> assemble_name (FILE, LABEL); \
> fputs (SIZE == 8 ? "@rel64" : "@rel", FILE); \
> } while (0)
> #endif
>
> 2009-01-29 Rainer Orth 
> * config/i386/sol2-10.h [!HAVE_AS_IX86_DIFF_SECT_DELTA]
> (ASM_OUTPUT_DWARF_PCREL): Define.
>
> http://gcc.gnu.org/viewcvs?view=revision&revision=143758
>
>
> Thanks,
> - Jay
>
>
> ----------------------------------------
>> From: jay.krell@cornell.edu
>> To: pinskia@gmail.com
>> CC: gcc@gcc.gnu.org
>> Subject: RE: pic+64bit+sun assembler+unwind-tables => illegal cross section subtraction
>> Date: Mon, 10 May 2010 01:02:29 +0000
>>
>>
>> Ah, good point. I don't think my "real" scenario did that though.
>> I'll investigate more. Networking problems were?are hampering download 4.5.0 and
>> build and configure it.
>>
>> I did come up with Makefile:
>>
>> Assemble = $(shell if test -x /opt/csw/gnu/as ; then echo /opt/csw/gnu/as ; \
>> elif test -x /usr/sfw/bin/gas ; then echo /usr/sfw/bin/gas ; \
>> else echo "unable to find GNU assembler" ; fi )
>>
>> :) which addresses why I wasn't using GNU as.
>>
>> (Yes, I've heard of autoconf.)
>>
>> Thanks, later,
>> - Jay
>>
>>
>> ----------------------------------------
>>> From: pinskia@gmail.com
>>> To: jay.krell@cornell.edu
>>> Subject: Re: pic+64bit+sun assembler+unwind-tables => illegal cross section subtraction
>>> Date: Sun, 9 May 2010 17:48:04 -0700
>>> CC: gcc@gcc.gnu.org
>>>
>>>
>>>
>>> Sent from my iPhone
>>>
>>> On May 9, 2010, at 5:42 PM, Jay K wrote:
>>>
>>>>
>>>> I haven't tried 4.5.0 yet.
>>>>
>>>>
>>>> -bash-4.1$ /opt/csw/gcc4/bin/g++ -v
>>>> Using built-in specs.
>>>> Target: i386-pc-solaris2.10
>>>> Configured with: ../gcc-4.3.3/configure --prefix=/opt/csw/gcc4 --
>>>> exec-prefix=/op
>>>> t/csw/gcc4
>>>
>>>
>>>
>>>> --with-gnu-as
>>>
>>>
>>> You configured gcc to build with the gnu as but then run with it so
>>> what do you expect.
>>>
>>>
>>>> --with-as=/opt/csw/bin/gas --without-gnu-ld --with-ld=/
>>>> usr/ccs/bin/ld --enable-nls --with-included-gettext --with-libiconv-
>>>> prefix=/opt/
>>>> csw --with-x --with-mpfr=/opt/csw --with-gmp=/opt/csw --enable-java-
>>>> awt=xlib --e
>>>> nable-libada --enable-libssp --enable-objc-gc --enable-threads=posix
>>>> --enable-st
>>>> age1-languages=c --enable-languages=ada,c,c++,fortran,java,objc
>>>> Thread model: posix
>>>> gcc version 4.3.3 (GCC)
>>>>
>>>>
>>>> /opt/csw/gcc4/bin/g++ 1.cpp -fPIC -S -m64
>>>> "1.s", line 117 : Warning: Illegal subtraction - symbols from
>>>> different sections: ".LFB2", ".DOT-2"
>>>> "1.s", line 120 : Warning: Illegal subtraction - symbols from
>>>> different sections: ".LLSDA2", ".DOT-3"
>>>> void F1();
>>>> void F2()
>>>> {
>>>> try { F1(); } catch(...) {F2(); }
>>>> }
>>>>
>>>>
>>>> /usr/ccs/bin/as -xarch=amd64 1.s
>>>>
>>>>
>>>>
>>>> or similar:
>>>> -bash-4.1$ cat 2.c
>>>> void F1() { }
>>>>
>>>>
>>>> /opt/csw/gcc4/bin/gcc -fPIC -S -funwind-tables -m64 2.c
>>>> /usr/ccs/bin/as -xarch=amd64 2.s
>>>> Assembler: 2.c
>>>> "2.s", line 38 : Warning: Illegal subtraction - symbols from
>>>> different sections: ".LFB2", ".DOT-1"
>>>>
>>>>
>>>> I'm aware of this thread:
>>>> http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00908.html
>>>>
>>>>
>>>>
>>>> I think I'll switch to GNU as, or omit -funwind-tables for now.
>>>> Or see if 4.5.0 fixes it.
>>>> Sparc32, sparc64, x86 work.
>>>>
>>>>
>>>> -gstabs+ also generated .stabd that Sun assembler didn't like.
>>>> I switched to -gstabs.
>>>> Maybe I messed up something though, as it looks like gcc is aware
>>>> not to output .stabd to non-gas.
>>>> More reason to use GNU assembler, understood.
>>>>
>>>>
>>>> http://gcc.gnu.org/install/specific.html#ix86-x-solaris210
>>>> could be a bit more precise:
>>>>>> Recent versions of the Sun assembler in /usr/ccs/bin/as work
>>>>>> almost as well, though.
>>>>
>>>>
>>>> "almost as well"?
>>>> Maybe that should say more, like, use -g or -gstabs instead of -
>>>> gstabs+, don't use 64bit+pic+unwind-tables or 64bit+pic+exceptions
>>>>
>>>>
>>>> I switched to Sun assembler because I'm seeing GNU as installed in
>>>> different places on different machines.
>>>> Some people don't install /usr/sfw and the install elsewhere.
>>>>
>>>>
>>>> - Jay
 		 	   		  



More information about the Gcc mailing list