[PATCH] D34692: [LLD][ELF] Add support for multiple passes to createThunks()

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 11 07:28:39 PDT 2017


peter.smith added a comment.

> Using a std::vector<T> * as a key seems a bit odd to me. IIUC, this vector is a member of InputSection, so we can attach a vector of ThunkSections to InputSections, no?

I've had a think about this a bit more. I think that there is an alternative way to represent ThunkSections and NewThunkSections:

- Store a vector of std::pair<ThunkSection*, uint32_t> where the second member of the pair is the Pass that the ThunkSection was added in.
- When the first Thunk is added to a ThunkSection for the first time we record the Pass.
- When merging Thunks into InputSectionDescription for Pass P we extract the Thunks with size > 0 that were created on Pass P and merge them in.

This would require quite a bit of changes to the existing code, for example we'd need to iterate through InputSectionDescriptions and not std::vector<InputSection *> in both createThunks() and mergeThunks(). I'm going to have a go at implementing it but will post as a separate review.


https://reviews.llvm.org/D34692





More information about the llvm-commits mailing list