Skip to content

Commit c737d4d

Browse files
[JITLink][ELF] Don't skip sections of size 0
Size 0 sections can have symbols that have size 0. Build those sections and symbols into the LinkGraph so they can be used properly if needed. Reviewed By: lhames Differential Revision: https://reviews.llvm.org/D114749
1 parent 5e3200f commit c737d4d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,6 @@ template <typename ELFT> Error ELFLinkGraphBuilder<ELFT>::graphifySections() {
316316
else
317317
Prot = MemProt::Read | MemProt::Write;
318318

319-
// For now we just use this to skip the "undefined" section, probably need
320-
// to revist.
321-
if (Sec.sh_size == 0)
322-
continue;
323-
324319
auto &GraphSec = G->createSection(*Name, Prot);
325320
if (Sec.sh_type != ELF::SHT_NOBITS) {
326321
auto Data = Obj.template getSectionContentsAsArray<char>(Sec);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t
2+
// RUN: llvm-jitlink -noexec %t
3+
4+
.section .foo,"ax"
5+
.globl zero
6+
zero:
7+
8+
9+
.text
10+
.globl main
11+
main:
12+
nop

0 commit comments

Comments
 (0)