[PATCH] D50917: [LLD] [COFF] Support MinGW automatic dllimport of data
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 24 13:01:26 PDT 2018
mstorsjo added inline comments.
================
Comment at: COFF/Chunks.h:420
+class PseudoRelocChunk : public Chunk {
+public:
----------------
pcc wrote:
> Would it be simpler to have a single `PseudoRelocChunk` for all the pseudo-relocs instead of creating a separate one for each reloc?
I guess that could work just as well.
================
Comment at: COFF/Chunks.h:447
+
+ static RuntimePseudoReloc makeListHeader() {
+ return RuntimePseudoReloc(nullptr, nullptr, 0, 1);
----------------
pcc wrote:
> It looks like this function is not used.
Hmm, indeed, will remove.
================
Comment at: COFF/SymbolTable.cpp:208
+ // this Symbol.
+ Sym->replaceKeepingName(Imp, sizeof(DefinedImportData));
+ cast<DefinedImportData>(Sym)->IsRuntimePseudoReloc = true;
----------------
pcc wrote:
> It looks like the RVA of the IAT entry is stored in the pseudo-reloc. So does this need to be relocated to the IAT entry? Could you replace it with a `DefinedAbsolute` of value 0 for example?
Yes, this needs to be relocated to the IAT entry - `DefinedAbsolute` with a zero value won't work.
At runtime, the runtime pseudo reloc mechanism only adds the difference between IAT entry itself and IAT entry value to the relocation address; this makes it work the same both for absolute addresses and RIP relative addressing.
https://reviews.llvm.org/D50917
More information about the llvm-commits
mailing list