_DYNAMIC and _GLOBAL_OFFSET_TABLE_

Ian Lance Taylor ian@airs.com
Thu Aug 28 04:07:00 GMT 2003


Alan Modra <amodra@bigpond.net.au> writes:

> Can anyone comment on the history of the following code in elf32-i386.c?
> 
>   /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
>   if (strcmp (h->root.root.string, "_DYNAMIC") == 0
>       || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
>     sym->st_shndx = SHN_ABS;

I sure with I still had access to the Cygnus repository.

I have a vague recollection that the Solaris linker marked these
symbols as absolute, so I did it in elf32-sparc.c, and copied the code
into elf32-i386.c.  I can't find the ChangeLog entry, unfortunately.

> It's particularly curious given that absolute symbols are relocated
> by current glibc ld.so.

That sounds wrong--it seems to me that an SHN_ABS symbol should always
the value in the symbol table.  I don't understand why ld.so would
change that.  It's easy to get a relocatable symbol, but how are you
supposed to get an absolute symbol?

Ian



More information about the Binutils mailing list