[PATCH] D34689: [LLD][ELF] Pre-create ThunkSections at Target specific intervals

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 11 17:27:05 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/Relocations.h:165-166
   // passes
   std::map<std::vector<InputSection *> *, std::vector<ThunkSection *>>
       ThunkSections;
 };
----------------
peter.smith wrote:
> ruiu wrote:
> > This map is essentially a map from an `InputSectionDescription` to its thunks, right? Does it make more sense to add `std::vector<ThunkSection *>` to `InputSectionDescription`?
> The reasons I had to keep the mapping local were:
> - The mapping is only needed when generating Thunks and as most Targets don't need them I wanted to avoid modifying the shared data structures that are visible to the end of the link.
> - When there are multiple passes we need to remember not just the Thunks we've added but the ones that we have just added in the latest pass (See D34692) we would either need a map or to add yet another vector to InputSectionDescription.
> 
> I'm happy to change it if you'd prefer to store the fields in InputSectionDescription and remove the maps.
I think I prefer adding all these stuffs to InputSectionDescription because (1) InputSectionDescription should be the central place to describe an input section and (2) doing hash table lookups that often could be slow.


https://reviews.llvm.org/D34689





More information about the llvm-commits mailing list