llvm.org GIT mirror llvm / 4d45f1e
X86: handle external tail calls in Windows JIT If there was a tail call, we would incorrectly handle the relocation. It would end up indexing into the array with an incorrect section id. The symbol was external to the module, so the Section ID was UNDEFINED (-1). We would then index the SmallVector with this ID, triggering an assertion. Use the Value rather than the section load address in this case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275442 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 4 years ago
2 changed file(s) with 8 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
173173 }
174174 case COFF::IMAGE_REL_I386_REL32: {
175175 // 32-bit relative displacement to the target.
176 uint64_t Result = Sections[RE.Sections.SectionA].getLoadAddress() -
177 Section.getLoadAddress() + RE.Addend - 4 - RE.Offset;
176 uint64_t Result = RE.Sections.SectionA == static_cast(-1)
177 ? Value
178 : Sections[RE.Sections.SectionA].getLoadAddress();
179 Result = Result - Section.getLoadAddress() + RE.Addend - 4 - RE.Offset;
178180 assert(static_cast(Result) <= INT32_MAX &&
179181 "relocation overflow");
180182 assert(static_cast(Result) >= INT32_MIN &&
0 // RUN: llvm-mc -triple i686-windows -filetype obj -o %t.obj %s
1 // RUN: llvm-rtdyld -triple i686-windows -dummy-extern _OutputDebugStringA@4=0xfffffffe -dummy-extern _ExitProcess@4=0xffffffff -verify -check=%s %t.obj
1 // RUN: llvm-rtdyld -triple i686-windows -dummy-extern _printf=0xfffffffd -dummy-extern _OutputDebugStringA@4=0xfffffffe -dummy-extern _ExitProcess@4=0xffffffff -verify -check=%s %t.obj
22
33 .text
44
1212 call _function // IMAGE_REL_I386_REL32
1313 # rtdyld-check: decode_operand(rel1, 0) = (_function-_main-4-1)
1414 xorl %eax, %eax
15 retl
15 rel12:
16 jmp _printf
17 # rtdyld-check: decode_operand(rel12, 0)[31:0] = (_printf-_main-4-8)
1618
1719 .def _function
1820 .scl 2