Skip to content

Commit b3a029d

Browse files
authored
Merge pull request #7105 from compnerd/my-section
ExecutionEngine: support `IMAGE_REL_AMD64_SECTION` relocations
2 parents b4d760a + d7c07d3 commit b3a029d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ class RuntimeDyldCOFFX86_64 : public RuntimeDyldCOFF {
134134
break;
135135
}
136136

137+
case COFF::IMAGE_REL_AMD64_SECTION: {
138+
assert(static_cast<int16_t>(RE.SectionID) <= INT16_MAX && "Relocation overflow");
139+
assert(static_cast<int16_t>(RE.SectionID) >= INT16_MIN && "Relocation underflow");
140+
writeBytesUnaligned(RE.SectionID, Target, 2);
141+
break;
142+
}
143+
137144
default:
138145
llvm_unreachable("Relocation type not implemented yet!");
139146
break;

llvm/test/ExecutionEngine/RuntimeDyld/X86/COFF_x86_64.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
# RUN: -dummy-extern external_data=0x2 -verify -check=%s %t/COFF_x86_64.o
55

66

7+
.section section,"rx"
8+
section:
9+
.long 0
10+
Lreloc:
11+
.long 0
12+
# rtdyld-check: *{2}Lreloc = 1
13+
.reloc 4, secidx, section+4
14+
15+
716
.text
817
.def F;
918
.scl 2;

0 commit comments

Comments
 (0)