From 548380af096f8277e460383c81a4ecdf2b77523f Mon Sep 17 00:00:00 2001 From: Magnus Granberg Date: Tue, 19 Aug 2014 21:25:22 +0000 Subject: TEXTREL in libjavascriptcoregtk-1.0.so.0.11.0 on x86 (or i586) https://bugs.webkit.org/show_bug.cgi?id=70610 Patch by Magnus Granberg on 2014-08-19 Reviewed by Darin Adler. Source/JavaScriptCore: Setup %ebx so we can use the plt. * jit/ThunkGenerators.cpp: Source/WTF: Add PLT if we're building with PIC. * wtf/InlineASM.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172759 268f45cc-cd09-0410-ab3c-d52691b4dbfc Change-Id: I7524a662f76f75f8dee0a07bf2360420d7b23d2d Reviewed-by: Allan Sandfeld Jensen --- Source/JavaScriptCore/jit/ThunkGenerators.cpp | 24 ++++++++++++++++++++++++ Source/WTF/wtf/InlineASM.h | 2 ++ 2 files changed, 26 insertions(+) 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 -- cgit v1.2.3