There are errors with expressions with @GOT suffix. They can be manifested in this example:
#include <stdio.h> __asm__ (".global number; number = 0x12345678"); extern void number; int main() { printf("%p\n", &number); return 0; } --- when this program is compiled with -fPIC, it crashes, without -fPIC it prints 12345678. Note that if you split program to two files, one containing __asm__ line and the other file containing the rest, compile with -fPIC and link files statically or dynamically, it succeeds and prints correct value --- 12345678. Static and dynamic linker can process this relocation fine, but that gas corrupts it if both definition and @GOT reference are in one file. The error is caused by bad processing of @GOT suffix: movl [EMAIL PROTECTED], %eax is assembled as movl $constant, %eax --- which is wrong. It should move offset in GOT, where pointer to constant is. movl [EMAIL PROTECTED], %eax will ignore the constant. Gas should at least write error messages and not generate incorrect code when encountering these constructs. With more work, some of these cases can be assembled correctly: movl [EMAIL PROTECTED], %eax is assembled correctly --- special symbol with name "L0\001" is created and GOT relocation against this symbol is generated. movl [EMAIL PROTECTED], %eax could do exactly the same trick, setting the symbol to constant. movl [EMAIL PROTECTED], %eax could be assembled corectly too by creating special symbol --- but I don't see any use for such construct. movl [EMAIL PROTECTED], %eax cannot be correctly assembled and error should be reported (current implementation just forgets the constant). -- Summary: Errors in @GOT Product: binutils Version: 2.17 Status: NEW Severity: normal Priority: P2 Component: gas AssignedTo: unassigned at sources dot redhat dot com ReportedBy: mikulas at artax dot karlin dot mff dot cuni dot cz CC: bug-binutils at gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://sourceware.org/bugzilla/show_bug.cgi?id=4079 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils