diff --git a/llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h b/llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h --- a/llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h +++ b/llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h @@ -316,11 +316,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(Sec); diff --git a/llvm/test/ExecutionEngine/JITLink/X86/ELF_empty_section.s b/llvm/test/ExecutionEngine/JITLink/X86/ELF_empty_section.s new file mode 100644 --- /dev/null +++ b/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