diff options
| author | Lang Hames <lhames@gmail.com> | 2021-08-27 07:52:40 +1000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2021-08-27 14:41:58 +1000 |
| commit | b749ef9e2241542c0b57f2fe77db200ef444df5c (patch) | |
| tree | d0737b4b0e00f7050f88d40224232d77ea497214 /llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp | |
| parent | 2e6a4fce356ac5ba2e88dac1b8ba6a1dfd033f0e (diff) | |
| download | llvm-b749ef9e2241542c0b57f2fe77db200ef444df5c.zip llvm-b749ef9e2241542c0b57f2fe77db200ef444df5c.tar.gz llvm-b749ef9e2241542c0b57f2fe77db200ef444df5c.tar.bz2 | |
[ORC][ORC-RT] Reapply "Introduce ELF/*nix Platform and runtime..." with fixes.
This reapplies e256445bfff, which was reverted in 45ac5f54418 due to bot errors
(e.g. https://lab.llvm.org/buildbot/#/builders/112/builds/8599). The issue that
caused the bot failure was fixed in 2e6a4fce356.
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp')
| -rw-r--r-- | llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp index fd26008..3c22c93 100644 --- a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp @@ -64,9 +64,9 @@ private: LGI.SymbolFlags[ES.intern(Sym->getName())] = Flags; } - if (G.getTargetTriple().isOSBinFormatMachO()) - if (hasMachOInitSection(G)) - LGI.InitSymbol = makeInitSymbol(ES, G); + if ((G.getTargetTriple().isOSBinFormatMachO() && hasMachOInitSection(G)) || + (G.getTargetTriple().isOSBinFormatELF() && hasELFInitSection(G))) + LGI.InitSymbol = makeInitSymbol(ES, G); return LGI; } @@ -82,6 +82,13 @@ private: return false; } + static bool hasELFInitSection(LinkGraph &G) { + for (auto &Sec : G.sections()) + if (Sec.getName() == ".init_array") + return true; + return false; + } + static SymbolStringPtr makeInitSymbol(ExecutionSession &ES, LinkGraph &G) { std::string InitSymString; raw_string_ostream(InitSymString) |
