[PATCH] Linking of shared libraries for MIPS little-endian 32-bit target
simon at atanasyan.com
Mon Nov 25 05:10:46 PST 2013
Comment at: lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h:39
@@ +38,3 @@
+ MipsGOT _got;
Michael Spencer wrote:
> Shankar Kalpathi Easwaran wrote:
> > Simon Atanasyan wrote:
> > > Simon Atanasyan wrote:
> > > > Michael Spencer wrote:
> > > > > This isn't a great place for this as it preserves atom pointers from a specific pass, which are not guaranteed to be stable. It seems that it's only used for the local and global offsets of the got. I think a better option here would be to calculate the offsets in the layout by iterating over the final .got MergedSection.
> > > > OK. I will fix that.
> > > It looks like my answer "I will fix that" was too optimistic.
> > >
> > > I need to know a GOT content to perform the following actions:
> > > - Emit `DT_MIPS_LOCAL_GOTNO` (depends on number of local GOT entries) and `DT_MIPS_GOTSYM` (depends on number of global GOT entries) dynamic table tags.
> > > - Sort dynamic symbol table's atoms which have corresponding entries in the global part of GOT. The dynamic symbol entries should go at the same order as their GOT complements.
> > > - Initialize GOT entries related to the `R_MIPS_GOT16` relocation. These GOT entries should be initialized by values calculated during the `R_MIPS_GOT16` relocation processing. This action is not implemented in this patch.
> > >
> > > Unfortunately I cannot figure out how to complete all these actions by iterating over the final .got MergedSection. Could you please provide more hints?
> > You could override createSection/createDynamicTable in the TargetLayout/TargetHandler respecitively. With this the Mips Target is in complete control of how the section gets written. Will this work ?
> You should sort the GOT atoms after they are all created in a pass. Then iterate over them in the writer to get the counts.
> Then use a custom dynamic symbol table section impl that sorts the same way.
For dynamic symbol table sorting I need to get a GOT entry position for the given symbol. What is the best way to maintain a mapping between GOT atom and corresponding symbol? Is it OK to add a reference to the symbol for pointing to the GOT atom?
More information about the llvm-commits