This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GOT Section Indexes


On Fri, Nov 08, 2002 at 12:21:42PM -0800, B Dorairaj wrote:
> The problem in my case is that I dont know the GOT
> symbol count before hand. So if I start from GOT index
> 0 to 1023 and if I encounter 1024,1025... GOT symbols,
> how can I go to the negative index?
> 
> Should I start first GOT entry from negative Index in
> that case?? In that case I need to rewrite the .got.
> 
> Am also wondering how about starting from -1024 itself
> and growing to 1023, there by avoiding this problem.
> 
> But the linkers and libraries guide says,
> 
>  "_GLOBAL_OFFSET_TABLE_ can reside in the middle of
> the .got section, allowing both negative and
> nonnegative subscripts"
> 
> Is there a feasible solution available for this
> problem.

See what bfd is doing.
If it needs to create GOT slot 1024, it will set a global variable
which was previously 0 to 1024. This global variable is then used
to
a) compute st_value of _GLOBAL_OFFSET_TABLE_ (which is .got address
   minus this variable)
b) compute R_SPARC_GOT* etc. relocations

See elf_hash_table (info)->hgot->root.u.def.value in elf32-sparc.c.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]