[PATCH] D55389: Implement IMAGE_REL_AMD64_SECREL for RuntimeDyldCOFFX86_64
Nathan Lanza via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 6 15:23:10 PST 2018
lanza updated this revision to Diff 177066.
lanza added a comment.
clang format so Saleem doesn't murder me
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55389/new/
https://reviews.llvm.org/D55389
Files:
lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
test/ExecutionEngine/RuntimeDyld/X86/COFF_x86_64_IMGREL.s
Index: test/ExecutionEngine/RuntimeDyld/X86/COFF_x86_64_IMGREL.s
===================================================================
--- test/ExecutionEngine/RuntimeDyld/X86/COFF_x86_64_IMGREL.s
+++ test/ExecutionEngine/RuntimeDyld/X86/COFF_x86_64_IMGREL.s
@@ -24,3 +24,17 @@
# rtdyld-check: decode_operand(inst2, 3) = section_addr(COFF_x86_64_IMGREL.o, .rdata)+5-40960000000000
inst2:
mov %ebx, (__constdata at imgrel+5)
+ .data
+ .space 375
+rel1:
+# rtdyld-check: *{4}rel1 = string - section_addr(COFF_x86_64_IMGREL.o, .data)
+ .secrel32 string
+
+# We explicitly add padding to put string outside of the 16bit address space
+# (absolute and as an offset from .data), so that relocations involving
+# 32bit addresses / offsets are not accidentally truncated to 16 bits.
+ .space 65536
+ .global string
+ .align 1
+string:
+ .asciz "Hello World\n"
Index: lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
===================================================================
--- lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
+++ lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
@@ -128,6 +128,15 @@
break;
}
+ case COFF::IMAGE_REL_AMD64_SECREL: {
+ assert(static_cast<int64_t>(RE.Addend) <= INT32_MAX &&
+ "Relocation overflow");
+ assert(static_cast<int64_t>(RE.Addend) >= INT32_MIN &&
+ "Relocation underflow");
+ writeBytesUnaligned(RE.Addend, Target, 4);
+ break;
+ }
+
default:
llvm_unreachable("Relocation type not implemented yet!");
break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55389.177066.patch
Type: text/x-patch
Size: 1624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181206/a8617ca8/attachment.bin>
More information about the llvm-commits
mailing list