[llvm] r348904 - Implement IMAGE_REL_AMD64_SECREL for RuntimeDyldCOFFX86_64
Nathan Lanza via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 11 16:04:06 PST 2018
Author: lanza
Date: Tue Dec 11 16:04:06 2018
New Revision: 348904
URL: http://llvm.org/viewvc/llvm-project?rev=348904&view=rev
Log:
Implement IMAGE_REL_AMD64_SECREL for RuntimeDyldCOFFX86_64
lldb on Windows uses the ExecutionEngine for expression evaluation
and hits the llvm_unreachable due to this relocation. Thus, implement
the relocation and add a test to verify it's function.
Modified:
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/COFF_x86_64_IMGREL.s
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h?rev=348904&r1=348903&r2=348904&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h Tue Dec 11 16:04:06 2018
@@ -128,6 +128,13 @@ public:
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;
Modified: llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/COFF_x86_64_IMGREL.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/COFF_x86_64_IMGREL.s?rev=348904&r1=348903&r2=348904&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/COFF_x86_64_IMGREL.s (original)
+++ llvm/trunk/test/ExecutionEngine/RuntimeDyld/X86/COFF_x86_64_IMGREL.s Tue Dec 11 16:04:06 2018
@@ -24,3 +24,17 @@ inst1:
# 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"
More information about the llvm-commits
mailing list