Skip to content

Commit 54bacab

Browse files
committed
Merge 81132 from mainline.
Do not create calls via PLT in compilation callback - this is higly platform dependent. Hopefully, this will fix PR3801. llvm-svn: 81691
1 parent 26116ab commit 54bacab

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

llvm/lib/Target/X86/X86JITInfo.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ static TargetJITInfo::JITCompilerFn JITCompilerFunction;
5252
#define GETASMPREFIX(X) GETASMPREFIX2(X)
5353
#define ASMPREFIX GETASMPREFIX(__USER_LABEL_PREFIX__)
5454

55-
// Check if building with -fPIC
56-
#if defined(__PIC__) && __PIC__ && defined(__linux__)
57-
#define ASMCALLSUFFIX "@PLT"
58-
#else
59-
#define ASMCALLSUFFIX
60-
#endif
61-
6255
// For ELF targets, use a .size and .type directive, to let tools
6356
// know the extent of functions defined in assembler.
6457
#if defined(__ELF__)
@@ -131,7 +124,7 @@ extern "C" {
131124
// JIT callee
132125
"movq %rbp, %rdi\n" // Pass prev frame and return address
133126
"movq 8(%rbp), %rsi\n"
134-
"call " ASMPREFIX "X86CompilationCallback2" ASMCALLSUFFIX "\n"
127+
"call " ASMPREFIX "X86CompilationCallback2\n"
135128
// Restore all XMM arg registers
136129
"movaps 112(%rsp), %xmm7\n"
137130
"movaps 96(%rsp), %xmm6\n"
@@ -207,7 +200,7 @@ extern "C" {
207200
"movl 4(%ebp), %eax\n" // Pass prev frame and return address
208201
"movl %eax, 4(%esp)\n"
209202
"movl %ebp, (%esp)\n"
210-
"call " ASMPREFIX "X86CompilationCallback2" ASMCALLSUFFIX "\n"
203+
"call " ASMPREFIX "X86CompilationCallback2\n"
211204
"movl %ebp, %esp\n" // Restore ESP
212205
CFI(".cfi_def_cfa_register %esp\n")
213206
"subl $12, %esp\n"
@@ -263,7 +256,7 @@ extern "C" {
263256
"movl 4(%ebp), %eax\n" // Pass prev frame and return address
264257
"movl %eax, 4(%esp)\n"
265258
"movl %ebp, (%esp)\n"
266-
"call " ASMPREFIX "X86CompilationCallback2" ASMCALLSUFFIX "\n"
259+
"call " ASMPREFIX "X86CompilationCallback2\n"
267260
"addl $16, %esp\n"
268261
"movaps 48(%esp), %xmm3\n"
269262
CFI(".cfi_restore %xmm3\n")
@@ -331,7 +324,14 @@ extern "C" {
331324
/// function stub when we did not know the real target of a call. This function
332325
/// must locate the start of the stub or call site and pass it into the JIT
333326
/// compiler function.
334-
extern "C" void ATTRIBUTE_USED
327+
extern "C" {
328+
#if !(defined (X86_64_JIT) && defined(_MSC_VER))
329+
// the following function is called only from this translation unit,
330+
// unless we are under 64bit Windows with MSC, where there is
331+
// no support for inline assembly
332+
static
333+
#endif
334+
void ATTRIBUTE_USED
335335
X86CompilationCallback2(intptr_t *StackPtr, intptr_t RetAddr) {
336336
intptr_t *RetAddrLoc = &StackPtr[1];
337337
assert(*RetAddrLoc == RetAddr &&
@@ -403,6 +403,7 @@ X86CompilationCallback2(intptr_t *StackPtr, intptr_t RetAddr) {
403403
*RetAddrLoc -= 5;
404404
#endif
405405
}
406+
}
406407

407408
TargetJITInfo::LazyResolverFn
408409
X86JITInfo::getLazyResolverFunction(JITCompilerFn F) {

0 commit comments

Comments
 (0)