[llvm-branch-commits] [clang] release/18.x: Reland "[clang-repl] Keep the first llvm::Module empty to avoid invalid memory access. (#89031)" (PR #90544)
https://github.com/lhames approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/90544 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 45ad6fa - [JITLink] Use edge kind names for fixups in EHFrameEdgeFixer.
Author: Lang Hames Date: 2021-01-24T15:38:04+11:00 New Revision: 45ad6fac6ad0dea2a1f7a1c6b65b64d230757667 URL: https://github.com/llvm/llvm-project/commit/45ad6fac6ad0dea2a1f7a1c6b65b64d230757667 DIFF: https://github.com/llvm/llvm-project/commit/45ad6fac6ad0dea2a1f7a1c6b65b64d230757667.diff LOG: [JITLink] Use edge kind names for fixups in EHFrameEdgeFixer. Previously FDE field names were used, but the fixup kind used for a field can vary based on the pointer encoding. This change will improve readability / maintainability when EH-frame support is added to JITLink/ELF. Added: Modified: llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp index 7a89476687d2..8b730bc23ce0 100644 --- a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp @@ -119,10 +119,9 @@ Error EHFrameSplitter::processBlock(LinkGraph &G, Block &B, } EHFrameEdgeFixer::EHFrameEdgeFixer(StringRef EHFrameSectionName, - Edge::Kind FDEToCIE, Edge::Kind FDEToPCBegin, - Edge::Kind FDEToLSDA) -: EHFrameSectionName(EHFrameSectionName), FDEToCIE(FDEToCIE), - FDEToPCBegin(FDEToPCBegin), FDEToLSDA(FDEToLSDA) {} + Edge::Kind Delta64, Edge::Kind NegDelta32) +: EHFrameSectionName(EHFrameSectionName), Delta64(Delta64), + NegDelta32(NegDelta32) {} Error EHFrameEdgeFixer::operator()(LinkGraph &G) { auto *EHFrame = G.findSectionByName(EHFrameSectionName); @@ -419,7 +418,7 @@ Error EHFrameEdgeFixer::processFDE(ParseContext &PC, Block &B, else return CIEInfoOrErr.takeError(); assert(CIEInfo->CIESymbol && "CIEInfo has no CIE symbol set"); - B.addEdge(FDEToCIE, RecordOffset + CIEDeltaFieldOffset, + B.addEdge(NegDelta32, RecordOffset + CIEDeltaFieldOffset, *CIEInfo->CIESymbol, 0); } else { LLVM_DEBUG({ @@ -459,8 +458,7 @@ Error EHFrameEdgeFixer::processFDE(ParseContext &PC, Block &B, auto PCBeginSym = getOrCreateSymbol(PC, PCBegin); if (!PCBeginSym) return PCBeginSym.takeError(); - B.addEdge(FDEToPCBegin, RecordOffset + PCBeginFieldOffset, *PCBeginSym, -0); + B.addEdge(Delta64, RecordOffset + PCBeginFieldOffset, *PCBeginSym, 0); PCBeginBlock = &PCBeginSym->getBlock(); } else { auto &EI = PCEdgeItr->second; @@ -521,7 +519,7 @@ Error EHFrameEdgeFixer::processFDE(ParseContext &PC, Block &B, << formatv("{0:x16}", RecordAddress + LSDAFieldOffset) << " to LSDA at " << formatv("{0:x16}", LSDA) << "\n"; }); - B.addEdge(FDEToLSDA, RecordOffset + LSDAFieldOffset, *LSDASym, 0); + B.addEdge(Delta64, RecordOffset + LSDAFieldOffset, *LSDASym, 0); } else { LLVM_DEBUG({ auto &EI = LSDAEdgeItr->second; diff --git a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h index a8cd32c664dc..83f27a285998 100644 --- a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h +++ b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h @@ -40,8 +40,8 @@ class EHFrameSplitter { /// edges. class EHFrameEdgeFixer { public: - EHFrameEdgeFixer(StringRef EHFrameSectionName, Edge::Kind FDEToCIE, - Edge::Kind FDEToPCBegin, Edge::Kind FDEToLSDA); + EHFrameEdgeFixer(StringRef EHFrameSectionName, Edge::Kind Delta64, + Edge::Kind NegDelta32); Error operator()(LinkGraph &G); private: @@ -101,9 +101,8 @@ class EHFrameEdgeFixer { Expected getOrCreateSymbol(ParseContext &PC, JITTargetAddress Addr); StringRef EHFrameSectionName; - Edge::Kind FDEToCIE; - Edge::Kind FDEToPCBegin; - Edge::Kind FDEToLSDA; + Edge::Kind Delta64; + Edge::Kind NegDelta32; }; } // end namespace jitlink diff --git a/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp index e32bf847014b..24559cc7e772 100644 --- a/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp @@ -670,7 +670,7 @@ void link_MachO_x86_64(std::unique_ptr G, // Add eh-frame passses. Config.PrePrunePasses.push_back(EHFrameSplitter("__eh_frame")); Config.PrePrunePasses.push_back( -EHFrameEdgeFixer("__eh_frame", NegDelta32, Delta64, Delta64)); +EHFrameEdgeFixer("__eh_frame", Delta64, NegDelta32)); // Add a mark-live pass. if (auto MarkLive = Ctx->getMarkLivePass(G->getTargetTriple())) ___ llvm-branch-commits mailing list l
[llvm-branch-commits] [llvm] b3d7e76 - [examples] Fix "Target does not support MC emission!" in HowToUseJIT example.
Author: Lang Hames Date: 2021-01-24T22:11:54+11:00 New Revision: b3d7e761e347d562333893652dcf3837fa55d777 URL: https://github.com/llvm/llvm-project/commit/b3d7e761e347d562333893652dcf3837fa55d777 DIFF: https://github.com/llvm/llvm-project/commit/b3d7e761e347d562333893652dcf3837fa55d777.diff LOG: [examples] Fix "Target does not support MC emission!" in HowToUseJIT example. Patch by Shivam Gupta. Thanks Shivam! Differential Revision: https://reviews.llvm.org/D92280 Added: Modified: llvm/examples/HowToUseJIT/CMakeLists.txt llvm/examples/HowToUseJIT/HowToUseJIT.cpp Removed: diff --git a/llvm/examples/HowToUseJIT/CMakeLists.txt b/llvm/examples/HowToUseJIT/CMakeLists.txt index e86626d5cec6..fb0adde378ba 100644 --- a/llvm/examples/HowToUseJIT/CMakeLists.txt +++ b/llvm/examples/HowToUseJIT/CMakeLists.txt @@ -2,6 +2,8 @@ set(LLVM_LINK_COMPONENTS Core ExecutionEngine Interpreter + MC + MCJIT Support nativecodegen ) diff --git a/llvm/examples/HowToUseJIT/HowToUseJIT.cpp b/llvm/examples/HowToUseJIT/HowToUseJIT.cpp index c7b3b9a7457c..f7ec2694b947 100644 --- a/llvm/examples/HowToUseJIT/HowToUseJIT.cpp +++ b/llvm/examples/HowToUseJIT/HowToUseJIT.cpp @@ -36,6 +36,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/GenericValue.h" +#include "llvm/ExecutionEngine/MCJIT.h" #include "llvm/IR/Argument.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/Constants.h" @@ -59,6 +60,7 @@ using namespace llvm; int main() { InitializeNativeTarget(); + LLVMInitializeNativeAsmPrinter(); LLVMContext Context; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 6884fbc - [JITLink] Enable exception handling for ELF.
Author: Lang Hames Date: 2021-01-25T15:31:27+11:00 New Revision: 6884fbc2c4fb46d0528c02d16d510f4f725fac11 URL: https://github.com/llvm/llvm-project/commit/6884fbc2c4fb46d0528c02d16d510f4f725fac11 DIFF: https://github.com/llvm/llvm-project/commit/6884fbc2c4fb46d0528c02d16d510f4f725fac11.diff LOG: [JITLink] Enable exception handling for ELF. Adds the EHFrameSplitter and EHFrameEdgeFixer passes to the default JITLink pass pipeline for ELF/x86-64, and teaches EHFrameEdgeFixer to handle some new pointer encodings. Together these changes enable exception handling (at least for the basic cases that I've tested so far) for ELF/x86-64 objects loaded via JITLink. Added: llvm/test/ExecutionEngine/JITLink/X86/ELF_ehframe_basic.s Modified: llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp index 8b730bc23ce0..3602601287f4 100644 --- a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp @@ -119,9 +119,10 @@ Error EHFrameSplitter::processBlock(LinkGraph &G, Block &B, } EHFrameEdgeFixer::EHFrameEdgeFixer(StringRef EHFrameSectionName, - Edge::Kind Delta64, Edge::Kind NegDelta32) -: EHFrameSectionName(EHFrameSectionName), Delta64(Delta64), - NegDelta32(NegDelta32) {} + unsigned PointerSize, Edge::Kind Delta64, + Edge::Kind Delta32, Edge::Kind NegDelta32) +: EHFrameSectionName(EHFrameSectionName), PointerSize(PointerSize), + Delta64(Delta64), Delta32(Delta32), NegDelta32(NegDelta32) {} Error EHFrameEdgeFixer::operator()(LinkGraph &G) { auto *EHFrame = G.findSectionByName(EHFrameSectionName); @@ -134,6 +135,11 @@ Error EHFrameEdgeFixer::operator()(LinkGraph &G) { return Error::success(); } + // Check that we support the graph's pointer size. + if (G.getPointerSize() != 4 && G.getPointerSize() != 8) +return make_error( +"EHFrameEdgeFixer only supports 32 and 64 bit targets"); + LLVM_DEBUG({ dbgs() << "EHFrameEdgeFixer: Processing " << EHFrameSectionName << "...\n"; }); @@ -258,7 +264,6 @@ Error EHFrameEdgeFixer::processBlock(ParseContext &PC, Block &B) { Error EHFrameEdgeFixer::processCIE(ParseContext &PC, Block &B, size_t RecordOffset, size_t RecordLength, size_t CIEDeltaFieldOffset) { - using namespace dwarf; LLVM_DEBUG(dbgs() << " Record is CIE\n"); @@ -329,11 +334,12 @@ Error EHFrameEdgeFixer::processCIE(ParseContext &PC, Block &B, uint8_t LSDAPointerEncoding; if (auto Err = RecordReader.readInteger(LSDAPointerEncoding)) return Err; - if (LSDAPointerEncoding != (DW_EH_PE_pcrel | DW_EH_PE_absptr)) + if (!isSupportedPointerEncoding(LSDAPointerEncoding)) return make_error( "Unsupported LSDA pointer encoding " + formatv("{0:x2}", LSDAPointerEncoding) + " in CIE at " + formatv("{0:x16}", CIESymbol.getAddress())); + CIEInfo.LSDAPointerEncoding = LSDAPointerEncoding; break; } case 'P': { @@ -341,7 +347,8 @@ Error EHFrameEdgeFixer::processCIE(ParseContext &PC, Block &B, if (auto Err = RecordReader.readInteger(PersonalityPointerEncoding)) return Err; if (PersonalityPointerEncoding != - (DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4)) + (dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel | + dwarf::DW_EH_PE_sdata4)) return make_error( "Unspported personality pointer " "encoding " + @@ -356,12 +363,12 @@ Error EHFrameEdgeFixer::processCIE(ParseContext &PC, Block &B, uint8_t FDEPointerEncoding; if (auto Err = RecordReader.readInteger(FDEPointerEncoding)) return Err; - if (FDEPointerEncoding != (DW_EH_PE_pcrel | DW_EH_PE_absptr)) + if (!isSupportedPointerEncoding(FDEPointerEncoding)) return make_error( -"Unsupported FDE address pointer " -"encoding " + +"Unsupported FDE pointer encoding " + formatv("{0:x2}", FDEPointerEncoding) + " in CIE at " + formatv("{0:x16}", CIESymbol.getAddress())); + CIEInfo.FDEPointerEncoding = FDEPointerEncoding; break; } default: @@ -445,11 +452,13 @@ Error EHFrameEdgeFixer::processFDE(ParseContext &PC, Block &B, JITTargetAddress PCBeginFieldOffset = RecordReader.getOffset(); auto PCEdgeItr = BlockEdges.find(RecordOffset
[llvm-branch-commits] [llvm-branch] r245347 - Add a paragraph about the ORC APIs to the 3.7 release notes.
Author: lhames Date: Tue Aug 18 15:42:17 2015 New Revision: 245347 URL: http://llvm.org/viewvc/llvm-project?rev=245347&view=rev Log: Add a paragraph about the ORC APIs to the 3.7 release notes. Modified: llvm/branches/release_37/docs/ReleaseNotes.rst Modified: llvm/branches/release_37/docs/ReleaseNotes.rst URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/docs/ReleaseNotes.rst?rev=245347&r1=245346&r2=245347&view=diff == --- llvm/branches/release_37/docs/ReleaseNotes.rst (original) +++ llvm/branches/release_37/docs/ReleaseNotes.rst Tue Aug 18 15:42:17 2015 @@ -240,6 +240,20 @@ Changes to the OCaml bindings During this release ... +Changes to the JIT APIs +--- + +* Added a new C++ JIT API called On Request Compilation, or ORC. + + ORC is a new JIT API inspired by MCJIT but designed to be more testable, and + easier to extend with new features. A key new feature already in tree is lazy, + function-at-a-time compilation for X86. Also included is a reimplementation of + MCJITâs API and behavior (OrcMCJITReplacement). MCJIT itself remains in tree, + and continues to be the default JIT ExecutionEngine, though new users are + encouraged to try ORC out for their projects. (A good place to start is the + new ORC tutorials under llvm/examples/kaleidoscope/orc). + + External Open Source Projects Using LLVM 3.7 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] cd8a80d - [Orc] Add a unit test for asynchronous definition generation.
Author: Lang Hames Date: 2021-01-13T14:23:36+11:00 New Revision: cd8a80de96080da33d0a7d5d5821120ddcfc4ece URL: https://github.com/llvm/llvm-project/commit/cd8a80de96080da33d0a7d5d5821120ddcfc4ece DIFF: https://github.com/llvm/llvm-project/commit/cd8a80de96080da33d0a7d5d5821120ddcfc4ece.diff LOG: [Orc] Add a unit test for asynchronous definition generation. Added: Modified: llvm/include/llvm/ExecutionEngine/Orc/Core.h llvm/lib/ExecutionEngine/Orc/Core.cpp llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp Removed: diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/llvm/include/llvm/ExecutionEngine/Orc/Core.h index 3020694ee732..4a4b58ed32e3 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Core.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Core.h @@ -850,6 +850,9 @@ class LookupState { friend class ExecutionSession; public: + LookupState(); + LookupState(LookupState &&); + LookupState &operator=(LookupState &&); ~LookupState(); /// Continue the lookup. This can be called by DefinitionGenerators diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp index 458dfc1ef421..3a18cd2ef761 100644 --- a/llvm/lib/ExecutionEngine/Orc/Core.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp @@ -577,7 +577,10 @@ LookupState::LookupState(std::unique_ptr IPLS) void LookupState::reset(InProgressLookupState *IPLS) { this->IPLS.reset(IPLS); } -LookupState::~LookupState() {} +LookupState::LookupState() = default; +LookupState::LookupState(LookupState &&) = default; +LookupState &LookupState::operator=(LookupState &&) = default; +LookupState::~LookupState() = default; void LookupState::continueLookup(Error Err) { assert(IPLS && "Cannot call continueLookup on empty LookupState"); diff --git a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp index 866ed7656fb6..62c55cecf20e 100644 --- a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp @@ -110,7 +110,7 @@ TEST_F(CoreAPIsStandardTest, MaterializationSideEffctsOnlyBasic) { ES.lookup( LookupKind::Static, makeJITDylibSearchOrder(&JD), - SymbolLookupSet({Foo}, SymbolLookupFlags::WeaklyReferencedSymbol), + SymbolLookupSet(Foo, SymbolLookupFlags::WeaklyReferencedSymbol), SymbolState::Ready, [&](Expected LookupResult) { if (LookupResult) @@ -1088,6 +1088,53 @@ TEST_F(CoreAPIsStandardTest, GeneratorTest) { << "Expected fallback def for Bar to be equal to BarSym"; } +TEST_F(CoreAPIsStandardTest, AsynchronousGeneratorTest) { + class TestGenerator : public DefinitionGenerator { + public: +TestGenerator(LookupState &TLS) : TLS(TLS) {} +Error tryToGenerate(LookupState &LS, LookupKind K, JITDylib &JD, +JITDylibLookupFlags JDLookupFlags, +const SymbolLookupSet &Name) override { + TLS = std::move(LS); + return Error::success(); +} + + private: +LookupState &TLS; + }; + + LookupState LS; + JD.addGenerator(std::make_unique(LS)); + + bool LookupCompleted = false; + + ES.lookup( + LookupKind::Static, makeJITDylibSearchOrder(&JD), SymbolLookupSet(Foo), + SymbolState::Ready, + [&](Expected Result) { +LookupCompleted = true; +if (!Result) { + ADD_FAILURE() << "Lookup failed unexpected"; + logAllUnhandledErrors(Result.takeError(), errs(), ""); + return; +} + +EXPECT_EQ(Result->size(), 1U) << "Unexpected number of results"; +EXPECT_EQ(Result->count(Foo), 1U) << "Expected result for Foo"; +EXPECT_EQ((*Result)[Foo].getAddress(), FooSym.getAddress()) +<< "Bad result for Foo"; + }, + NoDependenciesToRegister); + + EXPECT_FALSE(LookupCompleted); + + cantFail(JD.define(absoluteSymbols({{Foo, FooSym}}))); + + LS.continueLookup(Error::success()); + + EXPECT_TRUE(LookupCompleted); +} + TEST_F(CoreAPIsStandardTest, FailResolution) { auto MU = std::make_unique( SymbolFlagsMap({{Foo, JITSymbolFlags::Exported | JITSymbolFlags::Weak}, ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] a817f46 - [JITLink][ELF] Skip DWARF sections in ELF objects.
Author: Lang Hames Date: 2021-01-18T12:42:48+11:00 New Revision: a817f46d50c34ea6b798d28bd5fa6a3ee7435497 URL: https://github.com/llvm/llvm-project/commit/a817f46d50c34ea6b798d28bd5fa6a3ee7435497 DIFF: https://github.com/llvm/llvm-project/commit/a817f46d50c34ea6b798d28bd5fa6a3ee7435497.diff LOG: [JITLink][ELF] Skip DWARF sections in ELF objects. This matches current JITLink/MachO behavior and avoids processing currently unsupported relocations. Added: llvm/test/ExecutionEngine/JITLink/X86/ELF_skip_debug_sections.s Modified: llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp index f3a150d23737..30366a82a043 100644 --- a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp @@ -24,6 +24,7 @@ using namespace llvm::jitlink; using namespace llvm::jitlink::ELF_x86_64_Edges; namespace { + class ELF_x86_64_GOTAndStubsBuilder : public BasicGOTAndStubsBuilder { public: @@ -110,6 +111,14 @@ class ELF_x86_64_GOTAndStubsBuilder Section *GOTSection = nullptr; Section *StubsSection = nullptr; }; + +const char *const DwarfSectionNames[] = { +#define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME, OPTION) \ + ELF_NAME, +#include "llvm/BinaryFormat/Dwarf.def" +#undef HANDLE_DWARF_SECTION +}; + } // namespace const uint8_t ELF_x86_64_GOTAndStubsBuilder::NullGOTEntryContent[8] = { @@ -191,6 +200,14 @@ static Error optimizeELF_x86_64_GOTAndStubs(LinkGraph &G) { return Error::success(); } + +static bool isDwarfSection(StringRef SectionName) { + for (auto &DwarfSectionName : DwarfSectionNames) +if (SectionName == DwarfSectionName) + return true; + return false; +} + namespace llvm { namespace jitlink { @@ -305,6 +322,16 @@ class ELFLinkGraphBuilder_x86_64 { auto Name = Obj.getSectionName(SecRef); if (!Name) return Name.takeError(); + + // Skip Dwarf sections. + if (isDwarfSection(*Name)) { +LLVM_DEBUG({ + dbgs() << *Name + << " is a debug section: No graph section will be created.\n"; +}); +continue; + } + sys::Memory::ProtectionFlags Prot; if (SecRef.sh_flags & ELF::SHF_EXECINSTR) { Prot = static_cast(sys::Memory::MF_READ | @@ -373,6 +400,10 @@ class ELFLinkGraphBuilder_x86_64 { auto RelSectName = Obj.getSectionName(SecRef); if (!RelSectName) return RelSectName.takeError(); + + LLVM_DEBUG({ +dbgs() << "Adding relocations from section " << *RelSectName << "\n"; + }); // Deal with .eh_frame later if (*RelSectName == StringRef(".rela.eh_frame")) continue; @@ -385,6 +416,18 @@ class ELFLinkGraphBuilder_x86_64 { if (!UpdateSectionName) return UpdateSectionName.takeError(); + // Don't process relocations for debug sections. + if (isDwarfSection(*UpdateSectionName)) { +LLVM_DEBUG({ + dbgs() << " Target is dwarf section " << *UpdateSectionName + << ". Skipping.\n"; +}); +continue; + } else +LLVM_DEBUG({ + dbgs() << " For target section " << *UpdateSectionName << "\n"; +}); + auto JITSection = G->findSectionByName(*UpdateSectionName); if (!JITSection) return make_error( @@ -473,6 +516,9 @@ class ELFLinkGraphBuilder_x86_64 { auto Name = Obj.getSectionName(SecRef); if (!Name) return Name.takeError(); + + LLVM_DEBUG(dbgs() << "Processing symbol section " << *Name << ":\n"); + auto Section = G->findSectionByName(*Name); if (!Section) return make_error("Could not find a section " + @@ -531,6 +577,10 @@ class ELFLinkGraphBuilder_x86_64 { if (!sectName) return Name.takeError(); + // Skip debug section symbols. + if (isDwarfSection(*sectName)) +continue; + auto JitSection = G->findSectionByName(*sectName); if (!JitSection) return make_error( diff --git a/llvm/test/ExecutionEngine/JITLink/X86/ELF_skip_debug_sections.s b/llvm/test/ExecutionEngine/JITLink/X86/ELF_skip_debug_sections.s new file mode 100644 index ..506bbdfd8844 --- /dev/null +++ b/llvm/test/ExecutionEngine/JITLink/X86/ELF_skip_debug_sections.s @@ -0,0 +1,240 @@ +# RUN: llvm-mc -triple=x86_64-pc-linux-gnu -filetype=obj -o %t %s +# RUN: llvm-jitlink -debug-only=jitlink -noexec %t 2>&1 | FileCheck %s +# +# Check that debug sections are not emitted. +# +# CHECK: .debug_info is a debug section: No graph section will be created. + + .text + .file "ELF_skip_debug_sections.c" + .globl foo + .p2align4, 0x90 + .type foo,@function +foo: +.Lfunc_begin0: + .file
[llvm-branch-commits] [llvm] e561906 - [JITLink][ELF] New ELF skip-debug-sections test requires asserts.
Author: Lang Hames Date: 2021-01-18T15:41:53+11:00 New Revision: e5619065b8b8c441c0cbccbb81f5fa7857cf670a URL: https://github.com/llvm/llvm-project/commit/e5619065b8b8c441c0cbccbb81f5fa7857cf670a DIFF: https://github.com/llvm/llvm-project/commit/e5619065b8b8c441c0cbccbb81f5fa7857cf670a.diff LOG: [JITLink][ELF] New ELF skip-debug-sections test requires asserts. This should fix the failures on Release mode testers. Added: Modified: llvm/test/ExecutionEngine/JITLink/X86/ELF_skip_debug_sections.s Removed: diff --git a/llvm/test/ExecutionEngine/JITLink/X86/ELF_skip_debug_sections.s b/llvm/test/ExecutionEngine/JITLink/X86/ELF_skip_debug_sections.s index 506bbdfd8844..53132c4a987b 100644 --- a/llvm/test/ExecutionEngine/JITLink/X86/ELF_skip_debug_sections.s +++ b/llvm/test/ExecutionEngine/JITLink/X86/ELF_skip_debug_sections.s @@ -1,3 +1,4 @@ +# REQUIRES: asserts # RUN: llvm-mc -triple=x86_64-pc-linux-gnu -filetype=obj -o %t %s # RUN: llvm-jitlink -debug-only=jitlink -noexec %t 2>&1 | FileCheck %s # ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 24672dd - [ORC] Move OrcError.h to include/llvm/ExecutionEngine/Orc/Shared.
Author: Lang Hames Date: 2021-01-19T16:18:00+11:00 New Revision: 24672ddea3c97fd1eca3e905b23c0116d7759ab8 URL: https://github.com/llvm/llvm-project/commit/24672ddea3c97fd1eca3e905b23c0116d7759ab8 DIFF: https://github.com/llvm/llvm-project/commit/24672ddea3c97fd1eca3e905b23c0116d7759ab8.diff LOG: [ORC] Move OrcError.h to include/llvm/ExecutionEngine/Orc/Shared. OrcShared is the correct home for this header since Orc was split in 1d0676b54c4. (It should have been moved in that commit, but was overlooked). Added: llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcError.h Modified: llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h llvm/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h llvm/include/llvm/ExecutionEngine/Orc/Shared/Serialization.h llvm/lib/ExecutionEngine/Orc/Core.cpp llvm/lib/ExecutionEngine/Orc/LLJIT.cpp llvm/lib/ExecutionEngine/Orc/Shared/OrcError.cpp llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp llvm/unittests/ExecutionEngine/Orc/ResourceTrackerTest.cpp Removed: llvm/include/llvm/ExecutionEngine/Orc/OrcError.h diff --git a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h index 67aa09b2f1a7..91b12fd2277a 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h @@ -22,8 +22,8 @@ #include "llvm/ExecutionEngine/Orc/IndirectionUtils.h" #include "llvm/ExecutionEngine/Orc/Layer.h" #include "llvm/ExecutionEngine/Orc/LazyReexports.h" -#include "llvm/ExecutionEngine/Orc/OrcError.h" #include "llvm/ExecutionEngine/Orc/Speculation.h" +#include "llvm/ExecutionEngine/Orc/Shared/OrcError.h" #include "llvm/ExecutionEngine/RuntimeDyld.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/Constant.h" diff --git a/llvm/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h index 1dc2af49b78e..fdddc9694d0b 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h @@ -18,7 +18,7 @@ #include "llvm/ExecutionEngine/JITSymbol.h" #include "llvm/ExecutionEngine/Orc/Core.h" #include "llvm/ExecutionEngine/Orc/Mangling.h" -#include "llvm/ExecutionEngine/Orc/OrcError.h" +#include "llvm/ExecutionEngine/Orc/Shared/OrcError.h" #include "llvm/ExecutionEngine/RuntimeDyld.h" #include "llvm/Object/Archive.h" #include "llvm/Support/DynamicLibrary.h" diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h index 68eccf44cc72..ce9bf064303d 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h @@ -16,8 +16,8 @@ #include "llvm/ExecutionEngine/JITSymbol.h" #include "llvm/ExecutionEngine/Orc/IndirectionUtils.h" -#include "llvm/ExecutionEngine/Orc/OrcError.h" #include "llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h" +#include "llvm/ExecutionEngine/Orc/Shared/OrcError.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Error.h" #include "llvm/Support/Format.h" diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcError.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcError.h similarity index 100% rename from llvm/include/llvm/ExecutionEngine/Orc/OrcError.h rename to llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcError.h diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h index 1c8b8e0bc922..e0ac640ebcdd 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h @@ -22,7 +22,7 @@ #include #include "llvm/ADT/STLExtras.h" -#include "llvm/ExecutionEngine/Orc/OrcError.h" +#include "llvm/ExecutionEngine/Orc/Shared/OrcError.h" #include "llvm/ExecutionEngine/Orc/Shared/Serialization.h" #include "llvm/Support/MSVCErrorWorkarounds.h" diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/Serialization.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/Serialization.h index 64a4ab8be709..f2d07632bd5d 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/Serialization.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/Serialization.h @@ -11,7 +11,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" -#include "llvm/ExecutionEngine/Orc/OrcError.h" +#include "llvm/ExecutionEngine/Orc/Shared/OrcError.h" #include "llvm/Support/thread.h" #include #include diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp index 3a18cd2ef761..dfb558808c32 100644 --- a/llvm/lib/ExecutionEn
[llvm-branch-commits] [llvm] 95b63c7 - [ORC] Move LookupRequest from OrcShared to Orc.
Author: Lang Hames Date: 2021-01-19T20:23:47+11:00 New Revision: 95b63c7b139449b2d4084e986ca3f5bfde46b50c URL: https://github.com/llvm/llvm-project/commit/95b63c7b139449b2d4084e986ca3f5bfde46b50c DIFF: https://github.com/llvm/llvm-project/commit/95b63c7b139449b2d4084e986ca3f5bfde46b50c.diff LOG: [ORC] Move LookupRequest from OrcShared to Orc. It depends on Orc types (SymbolLookupSet), so can't be part of OrcShared. Added: Modified: llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h llvm/include/llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h llvm/include/llvm/ExecutionEngine/Orc/TargetProcessControl.h llvm/lib/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.cpp llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp Removed: diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h index 1097ae67b2a2..a8aa42799115 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h @@ -309,7 +309,7 @@ class OrcRPCTargetProcessControlBase : public TargetProcessControl { } Expected> - lookupSymbols(ArrayRef Request) override { + lookupSymbols(ArrayRef Request) override { std::vector RR; for (auto &E : Request) { RR.push_back({}); diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h index f43b9299c045..d01b3ef21f80 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h @@ -17,7 +17,6 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/ExecutionEngine/JITSymbol.h" -#include "llvm/ExecutionEngine/Orc/Core.h" #include @@ -60,14 +59,6 @@ struct BufferWrite { /// A handle used to represent a loaded dylib in the target process. using DylibHandle = JITTargetAddress; -/// A pair of a dylib and a set of symbols to be looked up. -struct LookupRequest { - LookupRequest(DylibHandle Handle, const SymbolLookupSet &Symbols) - : Handle(Handle), Symbols(Symbols) {} - DylibHandle Handle; - const SymbolLookupSet &Symbols; -}; - using LookupResult = std::vector; /// Either a uint8_t array or a uint8_t*. diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcessControl.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcessControl.h index 504a5ea0f9e9..b60b1ca6e372 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcessControl.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcessControl.h @@ -90,6 +90,14 @@ class TargetProcessControl { } }; + /// A pair of a dylib and a set of symbols to be looked up. + struct LookupRequest { +LookupRequest(tpctypes::DylibHandle Handle, const SymbolLookupSet &Symbols) +: Handle(Handle), Symbols(Symbols) {} +tpctypes::DylibHandle Handle; +const SymbolLookupSet &Symbols; + }; + virtual ~TargetProcessControl(); /// Intern a symbol name in the SymbolStringPool. @@ -123,7 +131,7 @@ class TargetProcessControl { /// symbol is not found then it be assigned a '0' value in the result. /// that correspond to the lookup order. virtual Expected> - lookupSymbols(ArrayRef Request) = 0; + lookupSymbols(ArrayRef Request) = 0; /// Run function with a main-like signature. virtual Expected runAsMain(JITTargetAddress MainFnAddr, @@ -172,7 +180,7 @@ class SelfTargetProcessControl : public TargetProcessControl, Expected loadDylib(const char *DylibPath) override; Expected> - lookupSymbols(ArrayRef Request) override; + lookupSymbols(ArrayRef Request) override; Expected runAsMain(JITTargetAddress MainFnAddr, ArrayRef Args) override; diff --git a/llvm/lib/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.cpp b/llvm/lib/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.cpp index 3442da5810cb..bbf3ada1d4ba 100644 --- a/llvm/lib/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.cpp +++ b/llvm/lib/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.cpp @@ -41,7 +41,7 @@ Error TPCDynamicLibrarySearchGenerator::tryToGenerate( SymbolMap NewSymbols; - tpctypes::LookupRequest Request(H, LookupSymbols); + TargetProcessControl::LookupRequest Request(H, LookupSymbols); auto Result = TPC.lookupSymbols(Request); if (!Result) return Result.takeError(); diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp index c607ce4d91af..7bf874e88c26 100644 --- a/llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp +++ b/llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp @@ -65,8 +65,7 @@
[llvm-branch-commits] [llvm] f9b5f69 - [JITLink][ELF/x86-64] Range check 32-bit relocs.
Author: Lang Hames Date: 2021-01-22T15:59:19+11:00 New Revision: f9b5f6937ebed5dccabfc3c287f11d18b68a36f6 URL: https://github.com/llvm/llvm-project/commit/f9b5f6937ebed5dccabfc3c287f11d18b68a36f6 DIFF: https://github.com/llvm/llvm-project/commit/f9b5f6937ebed5dccabfc3c287f11d18b68a36f6.diff LOG: [JITLink][ELF/x86-64] Range check 32-bit relocs. Also switch to using little_ / ulittle_ types to write results for consistency with MachO. Added: Modified: llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp index 30366a82a043..244975f4a51a 100644 --- a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp @@ -670,6 +670,17 @@ class ELFJITLinker_x86_64 : public JITLinker { return getELFX86RelocationKindName(R); } + static Error targetOutOfRangeError(const Block &B, const Edge &E) { +std::string ErrMsg; +{ + raw_string_ostream ErrStream(ErrMsg); + ErrStream << "Relocation target out of range: "; + printEdge(ErrStream, B, E, getELFX86RelocationKindName(E.getKind())); + ErrStream << "\n"; +} +return make_error(std::move(ErrMsg)); + } + Error applyFixup(Block &B, const Edge &E, char *BlockWorkingMem) const { using namespace ELF_x86_64_Edges; using namespace llvm::support; @@ -681,12 +692,15 @@ class ELFJITLinker_x86_64 : public JITLinker { case ELFX86RelocationKind::PCRel32: case ELFX86RelocationKind::PCRel32GOTLoad: { int64_t Value = E.getTarget().getAddress() + E.getAddend() - FixupAddress; - endian::write32le(FixupPtr, Value); + if (Value < std::numeric_limits::min() || + Value > std::numeric_limits::max()) +return targetOutOfRangeError(B, E); + *(little32_t *)FixupPtr = Value; break; } case ELFX86RelocationKind::Pointer64: { int64_t Value = E.getTarget().getAddress() + E.getAddend(); - endian::write64le(FixupPtr, Value); + *(ulittle64_t *)FixupPtr = Value; break; } } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 3b1f17c - [JITLink][ELF/x86-64] Add support for weak and hidden symbols.
Author: Lang Hames Date: 2021-01-22T20:51:11+11:00 New Revision: 3b1f17ca5498e17655ce531f13f1e8c2cf37058d URL: https://github.com/llvm/llvm-project/commit/3b1f17ca5498e17655ce531f13f1e8c2cf37058d DIFF: https://github.com/llvm/llvm-project/commit/3b1f17ca5498e17655ce531f13f1e8c2cf37058d.diff LOG: [JITLink][ELF/x86-64] Add support for weak and hidden symbols. Added: llvm/test/ExecutionEngine/JITLink/X86/ELF_weak_definitions.s llvm/test/ExecutionEngine/JITLink/X86/Inputs/ELF_weak_defs_extra.s Modified: llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp llvm/lib/ExecutionEngine/JITLink/JITLink.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp index 244975f4a51a..0ca2130150a6 100644 --- a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp @@ -544,7 +544,6 @@ class ELFLinkGraphBuilder_x86_64 { // Type != ELF::STT_COMMON) { // continue; // } -std::pair bindings; auto Name = SymRef.getName(*StringTable); // I am not sure on If this is going to hold as an invariant. Revisit. if (!Name) @@ -560,11 +559,43 @@ class ELFLinkGraphBuilder_x86_64 { continue; } -// TODO: weak and hidden -if (SymRef.isExternal()) - bindings = {Linkage::Strong, Scope::Default}; -else - bindings = {Linkage::Strong, Scope::Local}; +// Map Visibility and Binding to Scope and Linkage: +Linkage L = Linkage::Strong; +Scope S = Scope::Default; + +switch (SymRef.getBinding()) { +case ELF::STB_LOCAL: + S = Scope::Local; + break; +case ELF::STB_GLOBAL: + // Nothing to do here. + break; +case ELF::STB_WEAK: + L = Linkage::Weak; + break; +default: + return make_error("Unrecognized symbol binding for " + + *Name, + inconvertibleErrorCode()); +} + +switch (SymRef.getVisibility()) { +case ELF::STV_DEFAULT: +case ELF::STV_PROTECTED: + // FIXME: Make STV_DEFAULT symbols pre-emptible? This probably needs + // Orc support. + // Otherwise nothing to do here. + break; +case ELF::STV_HIDDEN: + // Default scope -> Hidden scope. No effect on local scope. + if (S == Scope::Default) +S = Scope::Hidden; + break; +case ELF::STV_INTERNAL: + return make_error("Unrecognized symbol visibility for " + + *Name, + inconvertibleErrorCode()); +} if (SymRef.isDefined() && (Type == ELF::STT_FUNC || Type == ELF::STT_OBJECT || @@ -591,17 +622,17 @@ class ELFLinkGraphBuilder_x86_64 { return make_error( "Section has no block", llvm::inconvertibleErrorCode()); - auto B = *bs.begin(); + auto *B = *bs.begin(); LLVM_DEBUG({ dbgs() << " " << *Name << " at index " << SymbolIndex << "\n"; }); if (SymRef.getType() == ELF::STT_SECTION) *Name = *sectName; - auto &S = G->addDefinedSymbol( - *B, SymRef.getValue(), *Name, SymRef.st_size, bindings.first, - bindings.second, SymRef.getType() == ELF::STT_FUNC, false); - JITSymbolTable[SymbolIndex] = &S; + auto &Sym = G->addDefinedSymbol( + *B, SymRef.getValue(), *Name, SymRef.st_size, L, S, + SymRef.getType() == ELF::STT_FUNC, false); + JITSymbolTable[SymbolIndex] = &Sym; } else if (SymRef.isUndefined() && SymRef.isExternal()) { - auto &S = G->addExternalSymbol(*Name, SymRef.st_size, bindings.first); - JITSymbolTable[SymbolIndex] = &S; + auto &Sym = G->addExternalSymbol(*Name, SymRef.st_size, L); + JITSymbolTable[SymbolIndex] = &Sym; } else LLVM_DEBUG({ dbgs() diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp index 41b5423dc335..93dfba9c759b 100644 --- a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp @@ -64,7 +64,7 @@ const char *getGenericEdgeKindName(Edge::Kind K) { case Edge::KeepAlive: return "Keep-Alive"; default: -llvm_unreachable("Unrecognized relocation kind"); +return ""; } } diff --git a/llvm/test/ExecutionEngine/JITLink/X86/ELF_weak_definitions.s b/llvm/test/ExecutionEngine/JITLink/X86/ELF_weak_definitions.s new file mode 100644 index ..9085f42098db --- /dev/null +++ b/llvm/test/ExecutionEngine/JITLink/X86/ELF_weak_definitions.
[llvm-branch-commits] [llvm] 5efc71e - [ORC] Move Orc RPC code into Shared, rename some RPC types.
Author: Lang Hames Date: 2020-12-30T12:48:20+11:00 New Revision: 5efc71e119d4eba235209d262e7d171361a0b9be URL: https://github.com/llvm/llvm-project/commit/5efc71e119d4eba235209d262e7d171361a0b9be DIFF: https://github.com/llvm/llvm-project/commit/5efc71e119d4eba235209d262e7d171361a0b9be.diff LOG: [ORC] Move Orc RPC code into Shared, rename some RPC types. Moves all headers from Orc/RPC to Orc/Shared, and from the llvm::orc::rpc namespace into llvm::orc::shared. Also renames RPCTypeName to SerializationTypeName and Function to RPCFunction. In addition to being a more reasonable home for this code, this will make it easier for the upcoming Orc runtime to re-use the Serialization system for creating and parsing wrapper-function binary blobs. Added: llvm/include/llvm/ExecutionEngine/Orc/Shared/FDRawByteChannel.h llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h llvm/include/llvm/ExecutionEngine/Orc/Shared/RawByteChannel.h llvm/include/llvm/ExecutionEngine/Orc/Shared/Serialization.h Modified: llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/OrcRPCTPCServer.h llvm/lib/ExecutionEngine/Orc/Shared/RPCError.cpp llvm/tools/lli/ChildTarget/ChildTarget.cpp llvm/tools/lli/RemoteJITUtils.h llvm/tools/lli/lli.cpp llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp llvm/tools/llvm-jitlink/llvm-jitlink.cpp llvm/tools/llvm-jitlink/llvm-jitlink.h llvm/unittests/ExecutionEngine/Orc/QueueChannel.h llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp Removed: llvm/include/llvm/ExecutionEngine/Orc/RPC/FDRawByteChannel.h llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h llvm/include/llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h index 1856e0d78209..1097ae67b2a2 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h @@ -13,8 +13,8 @@ #ifndef LLVM_EXECUTIONENGINE_ORC_ORCRPCTARGETPROCESSCONTROL_H #define LLVM_EXECUTIONENGINE_ORC_ORCRPCTARGETPROCESSCONTROL_H -#include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h" -#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h" +#include "llvm/ExecutionEngine/Orc/Shared/RPCUtils.h" +#include "llvm/ExecutionEngine/Orc/Shared/RawByteChannel.h" #include "llvm/ExecutionEngine/Orc/TargetProcess/OrcRPCTPCServer.h" #include "llvm/ExecutionEngine/Orc/TargetProcessControl.h" #include "llvm/Support/MSVCErrorWorkarounds.h" diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h index dfed5e09e4d4..3d139740d677 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h @@ -54,7 +54,7 @@ namespace remote { /// OrcRemoteTargetServer class) via an RPC system (see RPCUtils.h) to carry out /// its actions. class OrcRemoteTargetClient -: public rpc::SingleThreadedRPCEndpoint { +: public shared::SingleThreadedRPCEndpoint { public: /// Remote-mapped RuntimeDyld-compatible memory manager. class RemoteRTDyldMemoryManager : public RuntimeDyld::MemoryManager { @@ -703,7 +703,7 @@ class OrcRemoteTargetClient /// Channel is the ChannelT instance to communicate on. It is assumed that /// the channel is ready to be read from and written to. static Expected> - Create(rpc::RawByteChannel &Channel, ExecutionSession &ES) { + Create(shared::RawByteChannel &Channel, ExecutionSession &ES) { Error Err = Error::success(); auto Client = std::unique_ptr( new OrcRemoteTargetClient(Channel, ES, Err)); @@ -805,9 +805,10 @@ class OrcRemoteTargetClient Error terminateSession() { return callB(); } private: - OrcRemoteTargetClient(rpc::RawByteChannel &Channel, ExecutionSession &ES, + OrcRemoteTargetClient(shared::RawByteChannel &Channel, ExecutionSession &ES, Error &Err) - : rpc::SingleThreadedRPCEndpoint(Channel, true), + : shared::SingleThreadedRPCEndpoint(Channel, + true), ES(ES) { ErrorAsOutParameter EAO(&Err); diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h index 430ae2ca429b..367bfb369191 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc
[llvm-branch-commits] [llvm] a14c955 - [ORC] Remove some stale debugging output.
Author: Lang Hames Date: 2020-12-31T10:34:38+11:00 New Revision: a14c955af8602e450d75f4049eaa153387961ae1 URL: https://github.com/llvm/llvm-project/commit/a14c955af8602e450d75f4049eaa153387961ae1 DIFF: https://github.com/llvm/llvm-project/commit/a14c955af8602e450d75f4049eaa153387961ae1.diff LOG: [ORC] Remove some stale debugging output. Added: Modified: llvm/include/llvm/ExecutionEngine/Orc/Shared/FDRawByteChannel.h Removed: diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/FDRawByteChannel.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/FDRawByteChannel.h index f90b71db108b..3f96fe3da49d 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/FDRawByteChannel.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/FDRawByteChannel.h @@ -15,9 +15,6 @@ #include "llvm/ExecutionEngine/Orc/Shared/RawByteChannel.h" -#include "llvm/Support/FormatVariadic.h" -#include "llvm/Support/raw_ostream.h" - #if !defined(_MSC_VER) && !defined(__MINGW32__) #include #else @@ -34,13 +31,11 @@ class FDRawByteChannel final : public RawByteChannel { FDRawByteChannel(int InFD, int OutFD) : InFD(InFD), OutFD(OutFD) {} llvm::Error readBytes(char *Dst, unsigned Size) override { -// dbgs() << "Reading " << Size << " bytes: ["; assert(Dst && "Attempt to read into null."); ssize_t Completed = 0; while (Completed < static_cast(Size)) { ssize_t Read = ::read(InFD, Dst + Completed, Size - Completed); if (Read <= 0) { -// dbgs() << " <<<\n"; auto ErrNo = errno; if (ErrNo == EAGAIN || ErrNo == EINTR) continue; @@ -48,22 +43,17 @@ class FDRawByteChannel final : public RawByteChannel { return llvm::errorCodeToError( std::error_code(errno, std::generic_category())); } - // for (size_t I = 0; I != Read; ++I) - // dbgs() << " " << formatv("{0:x2}", Dst[Completed + I]); Completed += Read; } -// dbgs() << " ]\n"; return llvm::Error::success(); } llvm::Error appendBytes(const char *Src, unsigned Size) override { -// dbgs() << "Appending " << Size << " bytes: ["; assert(Src && "Attempt to append from null."); ssize_t Completed = 0; while (Completed < static_cast(Size)) { ssize_t Written = ::write(OutFD, Src + Completed, Size - Completed); if (Written < 0) { -// dbgs() << " <<<\n"; auto ErrNo = errno; if (ErrNo == EAGAIN || ErrNo == EINTR) continue; @@ -71,11 +61,8 @@ class FDRawByteChannel final : public RawByteChannel { return llvm::errorCodeToError( std::error_code(errno, std::generic_category())); } - // for (size_t I = 0; I != Written; ++I) - // dbgs() << " " << formatv("{0:x2}", Src[Completed + I]); Completed += Written; } -// dbgs() << " ]\n"; return llvm::Error::success(); } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] a554cd6 - [RuntimeDyld] Fix dangling reference in RuntimeDyldELF.
Author: Lang Hames Date: 2021-01-03T10:20:36+11:00 New Revision: a554cd6ae5bc24627b959b00288754712879d822 URL: https://github.com/llvm/llvm-project/commit/a554cd6ae5bc24627b959b00288754712879d822 DIFF: https://github.com/llvm/llvm-project/commit/a554cd6ae5bc24627b959b00288754712879d822.diff LOG: [RuntimeDyld] Fix dangling reference in RuntimeDyldELF. Patch by Moritz Sichert. Thanks Moritz! Differential Revision: https://reviews.llvm.org/D89373 Added: Modified: llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index dc396ae4c211..28e1faab5ac7 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -1670,30 +1670,33 @@ RuntimeDyldELF::processRelocationRef( if (Value.SymbolName) { // This is a call to an external function. // Look for an existing stub. -SectionEntry &Section = Sections[SectionID]; +SectionEntry *Section = &Sections[SectionID]; StubMap::const_iterator i = Stubs.find(Value); uintptr_t StubAddress; if (i != Stubs.end()) { - StubAddress = uintptr_t(Section.getAddress()) + i->second; + StubAddress = uintptr_t(Section->getAddress()) + i->second; LLVM_DEBUG(dbgs() << " Stub function found\n"); } else { // Create a new stub function (equivalent to a PLT entry). LLVM_DEBUG(dbgs() << " Create a new stub function\n"); - uintptr_t BaseAddress = uintptr_t(Section.getAddress()); + uintptr_t BaseAddress = uintptr_t(Section->getAddress()); uintptr_t StubAlignment = getStubAlignment(); StubAddress = - (BaseAddress + Section.getStubOffset() + StubAlignment - 1) & + (BaseAddress + Section->getStubOffset() + StubAlignment - 1) & -StubAlignment; unsigned StubOffset = StubAddress - BaseAddress; Stubs[Value] = StubOffset; createStubFunction((uint8_t *)StubAddress); // Bump our stub offset counter - Section.advanceStubOffset(getMaxStubSize()); + Section->advanceStubOffset(getMaxStubSize()); // Allocate a GOT Entry uint64_t GOTOffset = allocateGOTEntries(1); + // This potentially creates a new Section which potentially + // invalidates the Section pointer, so reload it. + Section = &Sections[SectionID]; // The load of the GOT address has an addend of -4 resolveGOTOffsetRelocation(SectionID, StubOffset + 2, GOTOffset - 4, @@ -1706,7 +1709,7 @@ RuntimeDyldELF::processRelocationRef( } // Make the target call a call into the stub table. -resolveRelocation(Section, Offset, StubAddress, ELF::R_X86_64_PC32, +resolveRelocation(*Section, Offset, StubAddress, ELF::R_X86_64_PC32, Addend); } else { RelocationEntry RE(SectionID, Offset, ELF::R_X86_64_PC32, Value.Addend, ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 7b11f56 - [JITLink] Rename PostAllocationPasses to PreFixupPasses.
Author: Lang Hames Date: 2021-01-11T18:33:50+11:00 New Revision: 7b11f564dcfc867c3e7a2075e8a943014fe30780 URL: https://github.com/llvm/llvm-project/commit/7b11f564dcfc867c3e7a2075e8a943014fe30780 DIFF: https://github.com/llvm/llvm-project/commit/7b11f564dcfc867c3e7a2075e8a943014fe30780.diff LOG: [JITLink] Rename PostAllocationPasses to PreFixupPasses. PreFixupPasses better reflects when these passes will run. A future patch will (re)introduce a PostAllocationPasses list that will run after allocation, but before JITLinkContext::notifyResolved is called to notify the rest of the JIT about the resolved symbol addresses. Added: Modified: llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp Removed: diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h index 6de0cd589aad..72daf76b501a 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -1227,11 +1227,11 @@ struct PassConfiguration { /// /// These passes are called on the graph after memory has been allocated, /// content copied into working memory, and nodes have been assigned their - /// final addresses. + /// final addresses, but before any fixups have been applied. /// /// Notable use cases: Late link-time optimizations like GOT and stub /// elimination. - LinkGraphPassList PostAllocationPasses; + LinkGraphPassList PreFixupPasses; /// Post-fixup passes. /// diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp index ea05b6c7e638..f3a150d23737 100644 --- a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp @@ -679,7 +679,7 @@ void link_ELF_x86_64(std::unique_ptr G, }); // Add GOT/Stubs optimizer pass. - Config.PostAllocationPasses.push_back(optimizeELF_x86_64_GOTAndStubs); + Config.PreFixupPasses.push_back(optimizeELF_x86_64_GOTAndStubs); if (auto Err = Ctx->modifyPassConfig(G->getTargetTriple(), Config)) return Ctx->notifyFailed(std::move(Err)); diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp index f29f6592e6ff..d6ad364add12 100644 --- a/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp @@ -114,7 +114,7 @@ void JITLinkerBase::linkPhase2(std::unique_ptr Self, dumpGraph(dbgs()); }); - if (auto Err = runPasses(Passes.PostAllocationPasses)) + if (auto Err = runPasses(Passes.PreFixupPasses)) return deallocateAndBailOut(std::move(Err)); LLVM_DEBUG({ diff --git a/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp index 34e0c3250495..e32bf847014b 100644 --- a/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp @@ -685,7 +685,7 @@ void link_MachO_x86_64(std::unique_ptr G, }); // Add GOT/Stubs optimizer pass. -Config.PostAllocationPasses.push_back(optimizeMachO_x86_64_GOTAndStubs); +Config.PreFixupPasses.push_back(optimizeMachO_x86_64_GOTAndStubs); } if (auto Err = Ctx->modifyPassConfig(G->getTargetTriple(), Config)) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] ef50c07 - [JITLink] Add a new PostAllocationPasses list.
Author: Lang Hames Date: 2021-01-12T11:57:07+11:00 New Revision: ef50c07b1fad368f6a8d326b4f73dd531009dca4 URL: https://github.com/llvm/llvm-project/commit/ef50c07b1fad368f6a8d326b4f73dd531009dca4 DIFF: https://github.com/llvm/llvm-project/commit/ef50c07b1fad368f6a8d326b4f73dd531009dca4.diff LOG: [JITLink] Add a new PostAllocationPasses list. Passes in the new PostAllocationPasses list will run immediately after memory allocation and address assignment for defined symbols, and before JITLinkContext::notifyResolved is called. These passes can set up state associated with the addresses of defined symbols before any query for these addresses completes. Added: Modified: llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp Removed: diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h index 72daf76b501a..e8c0e28b83aa 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -1223,11 +1223,27 @@ struct PassConfiguration { /// Notable use cases: Building GOT, stub, and TLV symbols. LinkGraphPassList PostPrunePasses; + /// Post-allocation passes. + /// + /// These passes are called on the graph after memory has been allocated and + /// defined nodes have been assigned their final addresses, but before the + /// context has been notified of these addresses. At this point externals + /// have not been resolved, and symbol content has not yet been copied into + /// working memory. + /// + /// Notable use cases: Setting up data structures associated with addresses + /// of defined symbols (e.g. a mapping of __dso_handle to JITDylib* for the + /// JIT runtime) -- using a PostAllocationPass for this ensures that the + /// data structures are in-place before any query for resolved symbols + /// can complete. + LinkGraphPassList PostAllocationPasses; + /// Pre-fixup passes. /// /// These passes are called on the graph after memory has been allocated, - /// content copied into working memory, and nodes have been assigned their - /// final addresses, but before any fixups have been applied. + /// content copied into working memory, and all nodes (including externals) + /// have been assigned their final addresses, but before any fixups have been + /// applied. /// /// Notable use cases: Late link-time optimizations like GOT and stub /// elimination. diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp index d6ad364add12..7a5e014f223d 100644 --- a/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp @@ -55,6 +55,16 @@ void JITLinkerBase::linkPhase1(std::unique_ptr Self) { if (auto Err = allocateSegments(Layout)) return Ctx->notifyFailed(std::move(Err)); + LLVM_DEBUG({ +dbgs() << "Link graph \"" << G->getName() + << "\" before post-allocation passes:\n"; +dumpGraph(dbgs()); + }); + + // Run post-allocation passes. + if (auto Err = runPasses(Passes.PostAllocationPasses)) +return Ctx->notifyFailed(std::move(Err)); + // Notify client that the defined symbols have been assigned addresses. LLVM_DEBUG( { dbgs() << "Resolving symbols defined in " << G->getName() << "\n"; }); @@ -110,7 +120,7 @@ void JITLinkerBase::linkPhase2(std::unique_ptr Self, LLVM_DEBUG({ dbgs() << "Link graph \"" << G->getName() - << "\" before post-allocation passes:\n"; + << "\" before pre-fixup passes:\n"; dumpGraph(dbgs()); }); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] ec6b71d - [JITLink][ORC] Enable creation / linking of raw jitlink::LinkGraphs.
Author: Lang Hames Date: 2020-12-16T14:01:50+11:00 New Revision: ec6b71df70a09681cc0ae87945db9f71649cf188 URL: https://github.com/llvm/llvm-project/commit/ec6b71df70a09681cc0ae87945db9f71649cf188 DIFF: https://github.com/llvm/llvm-project/commit/ec6b71df70a09681cc0ae87945db9f71649cf188.diff LOG: [JITLink][ORC] Enable creation / linking of raw jitlink::LinkGraphs. Separates link graph creation from linking. This allows raw LinkGraphs to be created and passed to a link. ObjectLinkingLayer is updated to support emission of raw LinkGraphs in addition to object buffers. Raw LinkGraphs can be created by in-memory compilers to bypass object encoding / decoding (though this prevents caching, as LinkGraphs have do not have an on-disk representation), and by utility code to add programatically generated data structures to the JIT target process. Added: Modified: llvm/include/llvm/ExecutionEngine/JITLink/ELF.h llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h llvm/include/llvm/ExecutionEngine/JITLink/MachO.h llvm/include/llvm/ExecutionEngine/JITLink/MachO_arm64.h llvm/include/llvm/ExecutionEngine/JITLink/MachO_x86_64.h llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h llvm/lib/ExecutionEngine/JITLink/ELF.cpp llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp llvm/lib/ExecutionEngine/JITLink/JITLink.cpp llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h llvm/lib/ExecutionEngine/JITLink/MachO.cpp llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp Removed: diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF.h index 9f6ea5271f4b..8912f3a2db45 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF.h @@ -19,11 +19,20 @@ namespace llvm { namespace jitlink { -/// jit-link the given ObjBuffer, which must be a ELF object file. +/// Create a LinkGraph from an ELF relocatable object. +/// +/// Note: The graph does not take ownership of the underlying buffer, nor copy +/// its contents. The caller is responsible for ensuring that the object buffer +/// outlives the graph. +Expected> +createLinkGraphFromELFObject(MemoryBufferRef ObjectBuffer); + +/// Link the given graph. /// /// Uses conservative defaults for GOT and stub handling based on the target /// platform. -void jitLink_ELF(std::unique_ptr Ctx); +void link_ELF(std::unique_ptr G, + std::unique_ptr Ctx); } // end namespace jitlink } // end namespace llvm diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h index 1e1e282a8997..1423b0c30b2a 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h @@ -44,8 +44,18 @@ enum ELFX86RelocationKind : Edge::Kind { } // end namespace ELF_x86_64_Edges +/// Create a LinkGraph from an ELF/x86-64 relocatable object. +/// +/// Note: The graph does not take ownership of the underlying buffer, nor copy +/// its contents. The caller is responsible for ensuring that the object buffer +/// outlives the graph. +Expected> +createLinkGraphFromELFObject_x86_64(MemoryBufferRef ObjectBuffer); + /// jit-link the given object buffer, which must be a ELF x86-64 object file. -void jitLink_ELF_x86_64(std::unique_ptr Ctx); +void link_ELF_x86_64(std::unique_ptr G, + std::unique_ptr Ctx); + /// Return the string name of the given ELF x86-64 edge kind. StringRef getELFX86RelocationKindName(Edge::Kind R); } // end namespace jitlink diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h index 48e64335613b..6de0cd589aad 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -786,24 +786,40 @@ class LinkGraph { Section::const_block_iterator, const Block *, getSectionConstBlocks>; - LinkGraph(std::string Name, unsigned PointerSize, + LinkGraph(std::string Name, const Triple &TT, unsigned PointerSize, support::endianness Endianness) - : Name(std::move(Name)), PointerSize(PointerSize), + : Name(std::move(Name)), TT(TT), PointerSize(PointerSize), Endianness(Endianness) {} /// Returns the name of this graph (usually the name of the original /// underlyin
[llvm-branch-commits] [llvm] 5bc9c85 - [ORC] Fix missing forward of Allow filter in TPCDynamicLibrarySearchGenerator.
Author: Lang Hames Date: 2020-12-06T15:42:45+11:00 New Revision: 5bc9c858e34026462070dbe0f937d4f243682bef URL: https://github.com/llvm/llvm-project/commit/5bc9c858e34026462070dbe0f937d4f243682bef DIFF: https://github.com/llvm/llvm-project/commit/5bc9c858e34026462070dbe0f937d4f243682bef.diff LOG: [ORC] Fix missing forward of Allow filter in TPCDynamicLibrarySearchGenerator. Added: Modified: llvm/include/llvm/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.h Removed: diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.h b/llvm/include/llvm/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.h index 07720f5c0f33..ed4f6080bb4e 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.h @@ -47,7 +47,7 @@ class TPCDynamicLibrarySearchGenerator : public DefinitionGenerator { static Expected> GetForTargetProcess(TargetProcessControl &TPC, SymbolPredicate Allow = SymbolPredicate()) { -return Load(TPC, nullptr); +return Load(TPC, nullptr, std::move(Allow)); } Error tryToGenerate(LookupState &LS, LookupKind K, JITDylib &JD, ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 5bb28fa - [JITLink][ELF] Reformat/add debug logging in ELF_x86_64.cpp.
Author: Lang Hames Date: 2020-12-10T18:46:44+11:00 New Revision: 5bb28fa0f51e94522644fe5633877b441b9ad8d3 URL: https://github.com/llvm/llvm-project/commit/5bb28fa0f51e94522644fe5633877b441b9ad8d3 DIFF: https://github.com/llvm/llvm-project/commit/5bb28fa0f51e94522644fe5633877b441b9ad8d3.diff LOG: [JITLink][ELF] Reformat/add debug logging in ELF_x86_64.cpp. Moves symbol name to the end of the output and makes other columns fixed width so that they line up. Added: Modified: llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp index a0f944db7943..20504b861155 100644 --- a/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp @@ -286,17 +286,13 @@ class ELFLinkGraphBuilder_x86_64 { return NameOrErr.takeError(); LLVM_DEBUG({ - dbgs() << " "; - if (!Name) -dbgs() << ""; - else -dbgs() << *Name; - dbgs() << ": value = " << formatv("{0:x16}", SymRef.getValue()) + dbgs() << " value = " << formatv("{0:x16}", SymRef.getValue()) << ", type = " << formatv("{0:x2}", SymRef.getType()) - << ", binding = " << SymRef.getBinding() - << ", size =" << SymRef.st_size - << ", info =" << SymRef.st_info; - dbgs() << "\n"; + << ", binding = " << formatv("{0:x2}", SymRef.getBinding()) + << ", size = " + << formatv("{0:x16}", static_cast(SymRef.st_size)) + << ", info = " << formatv("{0:x2}", SymRef.st_info) + << " :" << (Name ? *Name : "") << "\n"; }); } } @@ -333,7 +329,7 @@ class ELFLinkGraphBuilder_x86_64 { LLVM_DEBUG({ dbgs() << " " << *Name << ": " << formatv("{0:x16}", Address) << " -- " << formatv("{0:x16}", Address + Size) << ", align: " << Alignment - << " Flags:" << Flags << "\n"; + << " Flags: " << formatv("{0:x}", Flags) << "\n"; }); if (SecRef.sh_type != ELF::SHT_NOBITS) { @@ -418,8 +414,8 @@ class ELFLinkGraphBuilder_x86_64 { if (!TargetSymbol) { return make_error( "Could not find symbol at given index, did you add it to " - "JITSymbolTable? index: " + - std::to_string((*Symbol)->st_shndx) + + "JITSymbolTable? index: " + std::to_string(SymbolIndex) + + ", shndx: " + std::to_string((*Symbol)->st_shndx) + " Size of table: " + std::to_string(JITSymbolTable.size()), llvm::inconvertibleErrorCode()); } @@ -546,7 +542,7 @@ class ELFLinkGraphBuilder_x86_64 { "Section has no block", llvm::inconvertibleErrorCode()); auto B = *bs.begin(); - LLVM_DEBUG({ dbgs() << " " << *Name << ": "; }); + LLVM_DEBUG({ dbgs() << " " << *Name << " at index " << SymbolIndex << "\n"; }); if (SymRef.getType() == ELF::STT_SECTION) *Name = *sectName; auto &S = G->addDefinedSymbol( @@ -556,7 +552,12 @@ class ELFLinkGraphBuilder_x86_64 { } else if (SymRef.isUndefined() && SymRef.isExternal()) { auto &S = G->addExternalSymbol(*Name, SymRef.st_size, bindings.first); JITSymbolTable[SymbolIndex] = &S; -} +} else + LLVM_DEBUG({ + dbgs() +<< "Not creating graph symbol for normalized symbol at index " +<< SymbolIndex << ", \"" << *Name << "\"\n"; +}); // TODO: The following has to be implmented. // leaving commented out to save time for future patchs ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 0207de0 - [ORC] Prefer preincrement on iterator.
Author: Lang Hames Date: 2020-12-14T12:00:21+11:00 New Revision: 0207de0bfe77b643adb27605e9f0fdfb8929 URL: https://github.com/llvm/llvm-project/commit/0207de0bfe77b643adb27605e9f0fdfb8929 DIFF: https://github.com/llvm/llvm-project/commit/0207de0bfe77b643adb27605e9f0fdfb8929.diff LOG: [ORC] Prefer preincrement on iterator. Added: Modified: llvm/lib/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.cpp b/llvm/lib/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.cpp index 80d8f34ea447..3442da5810cb 100644 --- a/llvm/lib/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.cpp +++ b/llvm/lib/ExecutionEngine/Orc/TPCDynamicLibrarySearchGenerator.cpp @@ -55,7 +55,7 @@ Error TPCDynamicLibrarySearchGenerator::tryToGenerate( if (*ResultI) NewSymbols[KV.first] = JITEvaluatedSymbol(*ResultI, JITSymbolFlags::Exported); -ResultI++; +++ResultI; } // If there were no resolved symbols bail out. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 77bb3c1 - [JITLink] Fix include guard end comment.
Author: Lang Hames Date: 2020-12-14T12:00:21+11:00 New Revision: 77bb3c1ac200079abf4eec57a81a2f6cb14a6eae URL: https://github.com/llvm/llvm-project/commit/77bb3c1ac200079abf4eec57a81a2f6cb14a6eae DIFF: https://github.com/llvm/llvm-project/commit/77bb3c1ac200079abf4eec57a81a2f6cb14a6eae.diff LOG: [JITLink] Fix include guard end comment. Added: Modified: llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h Removed: diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h index 0c8514a60a50..a3dc6c1a7005 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h @@ -107,4 +107,4 @@ class InProcessMemoryManager : public JITLinkMemoryManager { } // end namespace jitlink } // end namespace llvm -#endif // LLVM_EXECUTIONENGINE_JITLINK_JITLINK_H +#endif // LLVM_EXECUTIONENGINE_JITLINK_JITLINKMEMORYMANAGER_H ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 8904ee8 - [JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs.
Author: Lang Hames Date: 2020-12-14T12:29:16+11:00 New Revision: 8904ee8ac7ebcc50a60de0914abc6862e28b6664 URL: https://github.com/llvm/llvm-project/commit/8904ee8ac7ebcc50a60de0914abc6862e28b6664 DIFF: https://github.com/llvm/llvm-project/commit/8904ee8ac7ebcc50a60de0914abc6862e28b6664.diff LOG: [JITLink] Add JITLinkDylib type, thread through JITLinkMemoryManager APIs. JITLinkDylib represents a target dylib for a JITLink link. By representing this explicitly we can: - Enable JITLinkMemoryManagers to manage allocations on a per-dylib basis (e.g by maintaining a seperate allocation pool for each JITLinkDylib). - Enable new features and diagnostics that require information about the target dylib (not implemented in this patch). Added: Modified: llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h llvm/include/llvm/ExecutionEngine/Orc/Core.h llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp llvm/lib/ExecutionEngine/Orc/TPCIndirectionUtils.cpp llvm/tools/llvm-jitlink/llvm-jitlink.cpp Removed: diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h index f0b4d9bcd49c..48e64335613b 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -1270,9 +1270,15 @@ class JITLinkContext { public: using LookupMap = DenseMap; + /// Create a JITLinkContext. + JITLinkContext(const JITLinkDylib *JD) : JD(JD) {} + /// Destroy a JITLinkContext. virtual ~JITLinkContext(); + /// Return the JITLinkDylib that this link is targeting, if any. + const JITLinkDylib *getJITLinkDylib() const { return JD; } + /// Return the MemoryManager to be used for this link. virtual JITLinkMemoryManager &getMemoryManager() = 0; @@ -1324,6 +1330,9 @@ class JITLinkContext { /// Called by JITLink to modify the pass pipeline prior to linking. /// The default version performs no modification. virtual Error modifyPassConfig(const Triple &TT, PassConfiguration &Config); + +private: + const JITLinkDylib *JD = nullptr; }; /// Marks all symbols in a graph live. This can be used as a default, diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h index a3dc6c1a7005..cee7d6b09c48 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h @@ -14,10 +14,11 @@ #define LLVM_EXECUTIONENGINE_JITLINK_JITLINKMEMORYMANAGER_H #include "llvm/ADT/DenseMap.h" +#include "llvm/ExecutionEngine/JITLink/JITLinkDylib.h" #include "llvm/ExecutionEngine/JITSymbol.h" #include "llvm/Support/Error.h" -#include "llvm/Support/Memory.h" #include "llvm/Support/MSVCErrorWorkarounds.h" +#include "llvm/Support/Memory.h" #include #include @@ -93,15 +94,25 @@ class JITLinkMemoryManager { virtual ~JITLinkMemoryManager(); /// Create an Allocation object. + /// + /// The JD argument represents the target JITLinkDylib, and can be used by + /// JITLinkMemoryManager implementers to manage per-dylib allocation pools + /// (e.g. one pre-reserved address space slab per dylib to ensure that all + /// allocations for the dylib are within a certain range). The JD argument + /// may be null (representing an allocation not associated with any + /// JITDylib. + /// + /// The request argument describes the segment sizes and permisssions being + /// requested. virtual Expected> - allocate(const SegmentsRequestMap &Request) = 0; + allocate(const JITLinkDylib *JD, const SegmentsRequestMap &Request) = 0; }; /// A JITLinkMemoryManager that allocates in-process memory. class InProcessMemoryManager : public JITLinkMemoryManager { public: Expected> - allocate(const SegmentsRequestMap &Request) override; + allocate(const JITLinkDylib *JD, const SegmentsRequestMap &Request) override; }; } // end namespace jitlink diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/llvm/include/llvm/ExecutionEngine/Orc/Core.h index 6256872b1094..3020694ee732 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Core.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Core.h @@ -17,6 +17,7 @@ #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/FunctionExtras.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" +#include "llvm/ExecutionEngine/JITLink/JITLinkDylib.h" #include "llvm/ExecutionEngine/JITSymbol.h" #include "llvm/ExecutionEngine/Orc/SymbolStringPool.h" #include "llvm/ExecutionEngi
[llvm-branch-commits] [llvm] 04795ab - Re-apply 8904ee8ac7e with missing header included this time.
Author: Lang Hames Date: 2020-12-14T13:39:33+11:00 New Revision: 04795ab8368a9f4169b737e6db2aebea47d6cf10 URL: https://github.com/llvm/llvm-project/commit/04795ab8368a9f4169b737e6db2aebea47d6cf10 DIFF: https://github.com/llvm/llvm-project/commit/04795ab8368a9f4169b737e6db2aebea47d6cf10.diff LOG: Re-apply 8904ee8ac7e with missing header included this time. Added: llvm/include/llvm/ExecutionEngine/JITLink/JITLinkDylib.h Modified: llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h llvm/include/llvm/ExecutionEngine/Orc/Core.h llvm/include/llvm/ExecutionEngine/Orc/OrcRPCTargetProcessControl.h llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp llvm/lib/ExecutionEngine/Orc/TPCIndirectionUtils.cpp llvm/tools/llvm-jitlink/llvm-jitlink.cpp Removed: diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h index f0b4d9bcd49c..48e64335613b 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -1270,9 +1270,15 @@ class JITLinkContext { public: using LookupMap = DenseMap; + /// Create a JITLinkContext. + JITLinkContext(const JITLinkDylib *JD) : JD(JD) {} + /// Destroy a JITLinkContext. virtual ~JITLinkContext(); + /// Return the JITLinkDylib that this link is targeting, if any. + const JITLinkDylib *getJITLinkDylib() const { return JD; } + /// Return the MemoryManager to be used for this link. virtual JITLinkMemoryManager &getMemoryManager() = 0; @@ -1324,6 +1330,9 @@ class JITLinkContext { /// Called by JITLink to modify the pass pipeline prior to linking. /// The default version performs no modification. virtual Error modifyPassConfig(const Triple &TT, PassConfiguration &Config); + +private: + const JITLinkDylib *JD = nullptr; }; /// Marks all symbols in a graph live. This can be used as a default, diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkDylib.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkDylib.h new file mode 100644 index ..2aa88cb50074 --- /dev/null +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkDylib.h @@ -0,0 +1,24 @@ +//===-- JITLinkDylib.h - JITLink Dylib type -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// Defines the JITLinkDylib API. +// +//===--===// + +#ifndef LLVM_EXECUTIONENGINE_JITLINK_JITLINKDYLIB_H +#define LLVM_EXECUTIONENGINE_JITLINK_JITLINKDYLIB_H + +namespace llvm { +namespace jitlink { + +class JITLinkDylib {}; + +} // end namespace jitlink +} // end namespace llvm + +#endif // LLVM_EXECUTIONENGINE_JITLINK_JITLINKDYLIB_H diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h index a3dc6c1a7005..cee7d6b09c48 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h @@ -14,10 +14,11 @@ #define LLVM_EXECUTIONENGINE_JITLINK_JITLINKMEMORYMANAGER_H #include "llvm/ADT/DenseMap.h" +#include "llvm/ExecutionEngine/JITLink/JITLinkDylib.h" #include "llvm/ExecutionEngine/JITSymbol.h" #include "llvm/Support/Error.h" -#include "llvm/Support/Memory.h" #include "llvm/Support/MSVCErrorWorkarounds.h" +#include "llvm/Support/Memory.h" #include #include @@ -93,15 +94,25 @@ class JITLinkMemoryManager { virtual ~JITLinkMemoryManager(); /// Create an Allocation object. + /// + /// The JD argument represents the target JITLinkDylib, and can be used by + /// JITLinkMemoryManager implementers to manage per-dylib allocation pools + /// (e.g. one pre-reserved address space slab per dylib to ensure that all + /// allocations for the dylib are within a certain range). The JD argument + /// may be null (representing an allocation not associated with any + /// JITDylib. + /// + /// The request argument describes the segment sizes and permisssions being + /// requested. virtual Expected> - allocate(const SegmentsRequestMap &Request) = 0; + allocate(const JITLinkDylib *JD, const SegmentsRequestMap &Request) = 0; }; /// A JITLinkMemoryManager that allocates in-process memory. class InProcessMemoryManager : public JITLinkMemoryManager { public: Expected> -
[llvm-branch-commits] [clang] [compiler-rt] [llvm] release/20.x: [ORC-RT] Use templates to express deeply nested function calls in testcase. (PR #126015)
https://github.com/lhames closed https://github.com/llvm/llvm-project/pull/126015 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [compiler-rt] [llvm] release/20.x: [ORC-RT] Use templates to express deeply nested function calls in testcase. (PR #126015)
lhames wrote: Abandoning this pull request: It will be superseded by the one for https://github.com/llvm/llvm-project/issues/126360. https://github.com/llvm/llvm-project/pull/126015 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [ORC] Switch to singleton pattern for UnwindInfoManager. (#126691) (PR #126825)
lhames wrote: @tstellar Apologies -- this was superseded by https://github.com/llvm/llvm-project/pull/126831. I thought that that one had been merged already, but it has not been. Are you able to take a look? https://github.com/llvm/llvm-project/pull/126825 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [NFC] [clang] fixed unused variable warning (PR #126831)
https://github.com/lhames approved this pull request. https://github.com/llvm/llvm-project/pull/126831 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [ORC] Switch to singleton pattern for UnwindInfoManager. (#126691) (PR #126825)
https://github.com/lhames closed https://github.com/llvm/llvm-project/pull/126825 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [ORC][unittests] Remove hard coded 16k page size (#127115) (PR #127144)
https://github.com/lhames approved this pull request. https://github.com/llvm/llvm-project/pull/127144 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] llvm-jitlink: Fix bug in target address computation. (PR #138794)
@@ -194,7 +194,8 @@ Error registerELFGraphInfo(Session &S, LinkGraph &G) { else FileInfo.SectionInfos[Sec.getName()] = { ArrayRef(FirstSym->getBlock().getContent().data(), SecSize), - SecAddr.getValue(), FirstSym->getTargetFlags()}; + (SecAddr - FirstSym->getOffset()).getValue(), lhames wrote: Instead of setting this here, it seems like it'd be tidier to define SecAddr like this on line 183: ```c++ auto SecAddr = FirstSym->getAddress() - FirstSym->getOffset(); ``` Unless you've already tried that and hit other issues I'm happy to go ahead and make that change. https://github.com/llvm/llvm-project/pull/138794 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits