[PATCH] D38872: [ExecutionEngine] Correct the size of a write in a COFF i386 relocation
Alex Langford via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 13 13:26:10 PDT 2017
xiaobai updated this revision to Diff 118968.
xiaobai added a comment.
Replacing uses of space with tab where appropriate.
https://reviews.llvm.org/D38872
Files:
lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h
test/ExecutionEngine/RuntimeDyld/X86/COFF_i386.s
Index: test/ExecutionEngine/RuntimeDyld/X86/COFF_i386.s
===================================================================
--- test/ExecutionEngine/RuntimeDyld/X86/COFF_i386.s
+++ test/ExecutionEngine/RuntimeDyld/X86/COFF_i386.s
@@ -49,11 +49,6 @@
.long "_ExitProcess at 4" // IMAGE_REL_I386_DIR32
# rtdyld-check: *{4}__imp__ExitProcess = 0xffffffff
- .global string
- .align 1
-string:
- .asciz "Hello World!\n"
-
.global relocations
relocations:
rel5:
@@ -63,8 +58,8 @@
# rtdyld-check: *{2}rel6 = 1
.secidx __imp__OutputDebugStringA // IMAGE_REL_I386_SECTION
rel7:
-# rtdyld-check: *{4}rel7 = relocations - section_addr(COFF_i386.s.tmp.obj, .data)
- .secrel32 relocations // IMAGE_REL_I386_SECREL
+# rtdyld-check: *{4}rel7 = string - section_addr(COFF_i386.s.tmp.obj, .data)
+ .secrel32 string // IMAGE_REL_I386_SECREL
# Test that addends work.
rel8:
@@ -79,3 +74,12 @@
rel11:
# rtdyld-check: *{4}rel11 = string - section_addr(COFF_i386.s.tmp.obj, .data) + 1
.long string at SECREL32+1 // IMAGE_REL_I386_SECREL
+
+# 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/RuntimeDyldCOFFI386.h
===================================================================
--- lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h
+++ lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h
@@ -209,7 +209,7 @@
DEBUG(dbgs() << "\t\tOffset: " << RE.Offset
<< " RelType: IMAGE_REL_I386_SECREL Value: " << RE.Addend
<< '\n');
- writeBytesUnaligned(RE.Addend, Target, 2);
+ writeBytesUnaligned(RE.Addend, Target, 4);
break;
default:
llvm_unreachable("unsupported relocation type");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38872.118968.patch
Type: text/x-patch
Size: 1972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171013/54a8d4c0/attachment.bin>
More information about the llvm-commits
mailing list