summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/JavaScriptCore/jit/ThunkGenerators.cpp24
-rw-r--r--Source/WTF/wtf/InlineASM.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/jit/ThunkGenerators.cpp b/Source/JavaScriptCore/jit/ThunkGenerators.cpp
index fde1347a0..fbf550ba4 100644
--- a/Source/JavaScriptCore/jit/ThunkGenerators.cpp
+++ b/Source/JavaScriptCore/jit/ThunkGenerators.cpp
@@ -524,6 +524,30 @@ double jsRound(double d)
} \
static MathThunk UnaryDoubleOpWrapper(function) = &function##Thunk;
+#elif CPU(X86) && COMPILER(GCC) && OS(LINUX) && defined(__PIC__)
+#define defineUnaryDoubleOpWrapper(function) \
+ asm( \
+ ".text\n" \
+ ".globl " SYMBOL_STRING(function##Thunk) "\n" \
+ HIDE_SYMBOL(function##Thunk) "\n" \
+ SYMBOL_STRING(function##Thunk) ":" "\n" \
+ "pushl %ebx\n" \
+ "subl $20, %esp\n" \
+ "movsd %xmm0, (%esp) \n" \
+ "call __x86.get_pc_thunk.bx\n" \
+ "addl $_GLOBAL_OFFSET_TABLE_, %ebx\n" \
+ "call " GLOBAL_REFERENCE(function) "\n" \
+ "fstpl (%esp) \n" \
+ "movsd (%esp), %xmm0 \n" \
+ "addl $20, %esp\n" \
+ "popl %ebx\n" \
+ "ret\n" \
+ );\
+ extern "C" { \
+ MathThunkCallingConvention function##Thunk(MathThunkCallingConvention); \
+ } \
+ static MathThunk UnaryDoubleOpWrapper(function) = &function##Thunk;
+
#elif CPU(X86) && COMPILER(GCC) && (OS(DARWIN) || OS(LINUX))
#define defineUnaryDoubleOpWrapper(function) \
asm( \
diff --git a/Source/WTF/wtf/InlineASM.h b/Source/WTF/wtf/InlineASM.h
index 0a2fe78b7..2dc40ef4e 100644
--- a/Source/WTF/wtf/InlineASM.h
+++ b/Source/WTF/wtf/InlineASM.h
@@ -46,6 +46,8 @@
#define GLOBAL_REFERENCE(name) #name "@plt"
#elif CPU(X86) && COMPILER(MINGW)
#define GLOBAL_REFERENCE(name) "@" #name "@4"
+#elif OS(LINUX) && CPU(X86) && defined(__PIC__)
+#define GLOBAL_REFERENCE(name) SYMBOL_STRING(name) "@plt"
#else
#define GLOBAL_REFERENCE(name) SYMBOL_STRING(name)
#endif