llvm.org GIT mirror llvm / d8da420
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315964 91177308-0d34-0410-b5e6-96231b3b80d8 Shoaib Meenai 3 years ago
2 changed file(s) with 12 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
208208 DEBUG(dbgs() << "\t\tOffset: " << RE.Offset
209209 << " RelType: IMAGE_REL_I386_SECREL Value: " << RE.Addend
210210 << '\n');
211 writeBytesUnaligned(RE.Addend, Target, 2);
211 writeBytesUnaligned(RE.Addend, Target, 4);
212212 break;
213213 default:
214214 llvm_unreachable("unsupported relocation type");
4848 .long "_ExitProcess@4" // IMAGE_REL_I386_DIR32
4949 # rtdyld-check: *{4}__imp__ExitProcess = 0xffffffff
5050
51 .global string
52 .align 1
53 string:
54 .asciz "Hello World!\n"
55
5651 .global relocations
5752 relocations:
5853 rel5:
6257 # rtdyld-check: *{2}rel6 = 1
6358 .secidx __imp__OutputDebugStringA // IMAGE_REL_I386_SECTION
6459 rel7:
65 # rtdyld-check: *{4}rel7 = relocations - section_addr(COFF_i386.s.tmp.obj, .data)
66 .secrel32 relocations // IMAGE_REL_I386_SECREL
60 # rtdyld-check: *{4}rel7 = string - section_addr(COFF_i386.s.tmp.obj, .data)
61 .secrel32 string // IMAGE_REL_I386_SECREL
6762
6863 # Test that addends work.
6964 rel8:
7873 rel11:
7974 # rtdyld-check: *{4}rel11 = string - section_addr(COFF_i386.s.tmp.obj, .data) + 1
8075 .long string@SECREL32+1 // IMAGE_REL_I386_SECREL
76
77 # We explicitly add padding to put string outside of the 16bit address space
78 # (absolute and as an offset from .data), so that relocations involving
79 # 32bit addresses / offsets are not accidentally truncated to 16 bits.
80 .space 65536
81 .global string
82 .align 1
83 string:
84 .asciz "Hello World!\n"