mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
[ExecutionEngine] Correct the size of a write in a COFF i386 relocation
We want to be writing a 32bit value, so we should be writing 4 bytes instead of 2. Patch by Alex Langford <apl@fb.com>. Differential Revision: https://reviews.llvm.org/D38872 llvm-svn: 315964
This commit is contained in:
parent
200728ffcb
commit
81eb39490f
@ -209,7 +209,7 @@ public:
|
|||||||
DEBUG(dbgs() << "\t\tOffset: " << RE.Offset
|
DEBUG(dbgs() << "\t\tOffset: " << RE.Offset
|
||||||
<< " RelType: IMAGE_REL_I386_SECREL Value: " << RE.Addend
|
<< " RelType: IMAGE_REL_I386_SECREL Value: " << RE.Addend
|
||||||
<< '\n');
|
<< '\n');
|
||||||
writeBytesUnaligned(RE.Addend, Target, 2);
|
writeBytesUnaligned(RE.Addend, Target, 4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("unsupported relocation type");
|
llvm_unreachable("unsupported relocation type");
|
||||||
|
@ -49,11 +49,6 @@ __imp__ExitProcess:
|
|||||||
.long "_ExitProcess@4" // IMAGE_REL_I386_DIR32
|
.long "_ExitProcess@4" // IMAGE_REL_I386_DIR32
|
||||||
# rtdyld-check: *{4}__imp__ExitProcess = 0xffffffff
|
# rtdyld-check: *{4}__imp__ExitProcess = 0xffffffff
|
||||||
|
|
||||||
.global string
|
|
||||||
.align 1
|
|
||||||
string:
|
|
||||||
.asciz "Hello World!\n"
|
|
||||||
|
|
||||||
.global relocations
|
.global relocations
|
||||||
relocations:
|
relocations:
|
||||||
rel5:
|
rel5:
|
||||||
@ -63,8 +58,8 @@ rel6:
|
|||||||
# rtdyld-check: *{2}rel6 = 1
|
# rtdyld-check: *{2}rel6 = 1
|
||||||
.secidx __imp__OutputDebugStringA // IMAGE_REL_I386_SECTION
|
.secidx __imp__OutputDebugStringA // IMAGE_REL_I386_SECTION
|
||||||
rel7:
|
rel7:
|
||||||
# rtdyld-check: *{4}rel7 = relocations - section_addr(COFF_i386.s.tmp.obj, .data)
|
# rtdyld-check: *{4}rel7 = string - section_addr(COFF_i386.s.tmp.obj, .data)
|
||||||
.secrel32 relocations // IMAGE_REL_I386_SECREL
|
.secrel32 string // IMAGE_REL_I386_SECREL
|
||||||
|
|
||||||
# Test that addends work.
|
# Test that addends work.
|
||||||
rel8:
|
rel8:
|
||||||
@ -79,3 +74,12 @@ rel10:
|
|||||||
rel11:
|
rel11:
|
||||||
# rtdyld-check: *{4}rel11 = string - section_addr(COFF_i386.s.tmp.obj, .data) + 1
|
# rtdyld-check: *{4}rel11 = string - section_addr(COFF_i386.s.tmp.obj, .data) + 1
|
||||||
.long string@SECREL32+1 // IMAGE_REL_I386_SECREL
|
.long string@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"
|
||||||
|
Loading…
Reference in New Issue
Block a user