After fixing up the runtime pseudo relocation, the .refptr.<var> will be a plain pointer with the same value as the IAT entry itself. To save a little binary size and reduce the number of runtime pseudo relocations, redirect references to the IAT entry (via the __imp_<var> symbol) itself and discard the .refptr.<var> chunk (as long as the same section chunk doesn't contain anything else than the single pointer).
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lgtm
test/COFF/autoimport-refptr.s | ||
---|---|---|
35 ↗ | (On Diff #163169) | Hm, they really should put a colon after the address to make this easier to read. =/ |
COFF/Chunks.h | ||
---|---|---|
189 ↗ | (On Diff #163169) | Now Live member has both read and write accessors, so I'd make it a public member and remove this function and isLive. |
COFF/SymbolTable.cpp | ||
173 ↗ | (On Diff #163169) | This probably needs comment as I believe this is hard to understand for those who don't know what the intention of this code is. |
COFF/Chunks.h | ||
---|---|---|
189 ↗ | (On Diff #163169) | Ok - what about the markLive function, should I remove that one as well? Or do we want to keep it for the sake of the asserts? |
COFF/Chunks.h | ||
---|---|---|
189 ↗ | (On Diff #163169) | Looks like the only use of markLive is in MarkLive.cpp, and if you remove that function and inline it, it is obvious that you don't really need these asserts. So, yes, we should remove markLive function. |
Dropped the isLive() and discard() accessors and made Live public instead. Kept the markLive accessor since it has got useful asserts.
COFF/SymbolTable.cpp | ||
---|---|---|
173 ↗ | (On Diff #163169) | I added some kind of summary in a comment here. |
COFF/Chunks.h | ||
---|---|---|
189 ↗ | (On Diff #163169) | Sorry, I missed this comment, as it was added right before I updated the diff yesterday. Will remove that method as well, and commit this. |
COFF/SymbolTable.cpp | ||
---|---|---|
182 ↗ | (On Diff #163254) | I added another extra sanity check that the Refptr chunk only contains 1 relocation and that it points at this specific symbol that we're importing, before I committed this. |