[PATCH] D114749: [JITLink][ELF] Don't skip sections of size 0

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 30 09:14:34 PST 2021


steven_wu updated this revision to Diff 390737.
steven_wu added a comment.

Address review feedback


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114749/new/

https://reviews.llvm.org/D114749

Files:
  llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
  llvm/test/ExecutionEngine/JITLink/X86/ELF_empty_section.s


Index: llvm/test/ExecutionEngine/JITLink/X86/ELF_empty_section.s
===================================================================
--- /dev/null
+++ llvm/test/ExecutionEngine/JITLink/X86/ELF_empty_section.s
@@ -0,0 +1,12 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t
+// RUN: llvm-jitlink -noexec %t
+
+.section	.foo,"ax"
+.globl  zero
+zero:
+
+
+.text
+.globl main
+main:
+nop
Index: llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
+++ llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
@@ -299,11 +299,6 @@
     else
       Prot = MemProt::Read | MemProt::Write;
 
-    // For now we just use this to skip the "undefined" section, probably need
-    // to revist.
-    if (Sec.sh_size == 0)
-      continue;
-
     auto &GraphSec = G->createSection(*Name, Prot);
     if (Sec.sh_type != ELF::SHT_NOBITS) {
       auto Data = Obj.template getSectionContentsAsArray<char>(Sec);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114749.390737.patch
Type: text/x-patch
Size: 1044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211130/3199ae0b/attachment.bin>


More information about the llvm-commits mailing list