This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Further improved native as support on Solaris/x86
On Fri, Jul 21, 2006 at 05:27:29PM -0600, Roger Sayle wrote:
> .section .rodata
> .align 4
> .align 4
> .L8:
> .long .L3-.L8
> .long .L4-.L8
> .long .L5-.L8
> .long .L4-.L8
> .long .L6-.L8
> .long .L7-.L8
> .text
> .L4:
> movl $1, %eax
> ...
>
> Notice that the symbol .L8 is in the section .rodata, and the symbol
> .L4 (and all the others) are in the section .L4.
>
> The outcome is the Solaris assembler issues the fatal error:
>
> sunfire% as -xarch=generic64 switch.s
> Assembler: switch.c
> "switch.s", line 68 : Warning: Illegal subtraction - symbols from different sections: ".LFB2", ".DOT-1"
> "switch.s", line 20 : Illegal subtraction - symbols from different sections: ".L3", ".L8"
>
>
> As you point out above, this is the subtraction of two symbols in
> different sections, neither of with if "." or ".+CONST".
Yes, it is the third case, local label in the same fragment, that
gas handles just fine and Solaris as is clearly less capable of
dealing with it.
.section .rodata
.align 4
.L8:
.long .L3-.
.long (.L4+4)-.
.long (.L5+8)-.
.long (.L4+12)-.
.long (.L6+16)-.
.long (.L7+20)-.
would work with Solaris as, then we can certainly teach GCC to emit
it there that way, but GCC would need to know if . here means the start
or end of the .long.
Jakub