Bug 127776

Summary: Fix linking failure on EFL and GTK for the jsCStack branch merge
Product: WebKit Reporter: Csaba Osztrogonác <ossy>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Blocker CC: mhahnenberg, msaboff, ossy
Priority: P1    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 127782    
Bug Blocks: 127763    

Description Csaba Osztrogonác 2014-01-28 06:53:06 PST
After adding the missing files to the cmake buildsystem and removed
the dead code I managed to build EFLWebKit. But I got linking failure
with SHARED_CORE=ON build. Unfortunately it is necessary to be able
run layout tests. (https://bugs.webkit.org/show_bug.cgi?id=80683)

Additionally I got the same linking failure with WebKitGTK build.


GTK build failure:
-------------------
/usr/bin/ld: Source/JavaScriptCore/llint/.libs/libjavascriptcoregtk_3_0_la-LowLevelInterpreter.o: relocation R_X86_64_PC32 against symbol `llint_throw_stack_overflow_error' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value


EFL build failure with SHARED_CORE=ON:
---------------------------------------
Linking CXX shared library ../../lib/libjavascriptcore_efl.so
/usr/bin/ld: CMakeFiles/JavaScriptCore.dir/llint/LowLevelInterpreter.cpp.o: relocation R_X86_64_PC32 against symbol `llint_throw_stack_overflow_error' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
Comment 1 Csaba Osztrogonác 2014-01-28 07:30:09 PST
Additional info: The build fails on GTK always and fails on EFL bots, 
because ENABLE_DRT=1 environment variable forces the SHARED_CORE=ON build.
Comment 2 Mark Hahnenberg 2014-01-28 08:33:41 PST
After reading a little bit about this error, it seems that gcc requires that code linked into a shared library should, by default, be compiled with -fpic due to the constraints of the small code model and the size of the address space on 64-bit platforms. I can see two obvious solutions:

(1) Use -fpic to enable position independent code when building shared libraries.
(2) Use -mcmodel=large to enable the large code model when building shared libraries.

Either one of these should work.
Comment 3 Mark Hahnenberg 2014-01-28 08:36:44 PST
(In reply to comment #2)
> After reading a little bit about this error, it seems that gcc requires that code linked into a shared library should, by default, be compiled with -fpic due to the constraints of the small code model and the size of the address space on 64-bit platforms. I can see two obvious solutions:
> 
> (1) Use -fpic to enable position independent code when building shared libraries.
> (2) Use -mcmodel=large to enable the large code model when building shared libraries.
> 
> Either one of these should work.

This also might be the result of a lack of proper extern-ing for these symbols. Let me try that first.
Comment 4 Csaba Osztrogonác 2014-01-28 09:20:11 PST
It seems https://bugs.webkit.org/show_bug.cgi?id=127782 solved the linking problem. Thanks for the quick fix.