linux-gcc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Q: -fpic and $_GLOBAL_OFFSET_TABLE_
@ 2003-07-16 14:30 Oleg Nesterov
  0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2003-07-16 14:30 UTC (permalink / raw)
  To: linux-gcc

Hello.

I thought, that &GOT == $_GLOBAL_OFFSET_TABLE_ + .

$ cat test.c

void test(void)
{
	asm volatile (
		"addl $_GLOBAL_OFFSET_TABLE_, %eax\n"
		"addl $_GLOBAL_OFFSET_TABLE_, %ecx\n"
	);
}

$ cc -c -fpic -fomit-frame-pointer test.c && ld -shared -o test.so test.o && objdump -d test.so

test.so:     file format elf32-i386

Disassembly of section .text:

0000018c <test>:
 18c:	05 0d 10 00 00       	addl   $0x100d,%eax	==> &GOT = 0x18c + 0x100d = 0x1199
 191:	81 c1 07 10 00 00    	addl   $0x1007,%ecx	==> &GOT = 0x191 + 0x1007 = 0x1198
 197:	c3                   	ret    

How can it be?

Oleg.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-16 14:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-16 14:30 Q: -fpic and $_GLOBAL_OFFSET_TABLE_ Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).