[PATCH] D88867: Fix JITLink for ELF X86 so that it accepts a .bss section by adding a call to createZeroFillBlock

Chris Schafmeister via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 19:38:21 PDT 2020


drmeister created this revision.
drmeister added reviewers: lhames, jaredwy.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
drmeister requested review of this revision.

Add an invocation to createZeroFillBlock to allow the .bss section to be loaded.
Also, enhance two error messages so that they print the name of the section that they could not find.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88867

Files:
  llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp


Index: llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
+++ llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
@@ -357,6 +357,9 @@
         if (SecRef.sh_type == ELF::SHT_SYMTAB)
           // TODO: Dynamic?
           SymTab = SecRef;
+      } else {
+        auto &section = G->createSection(*Name, Prot);
+        G->createZeroFillBlock(section,Size,Address,Alignment,0);
       }
     }

@@ -480,7 +483,7 @@
         return Name.takeError();
       auto Section = G->findSectionByName(*Name);
       if (!Section)
-        return make_error<llvm::StringError>("Could not find a section",
+        return make_error<llvm::StringError>("Could not find the section "+*Name,
                                              llvm::inconvertibleErrorCode());
       // we only have one for now
       auto blocks = Section->blocks();
@@ -527,7 +530,7 @@
           auto JitSection = G->findSectionByName(*sectName);
           if (!JitSection)
             return make_error<llvm::StringError>(
-                "Could not find a section", llvm::inconvertibleErrorCode());
+                "Could not find the JitSection "+*sectName, llvm::inconvertibleErrorCode());
           auto bs = JitSection->blocks();
           if (bs.empty())
             return make_error<llvm::StringError>(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88867.296350.patch
Type: text/x-patch
Size: 1399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201006/4082e7af/attachment.bin>


More information about the llvm-commits mailing list