> From: Jeremie Courreges-Anglas <j...@wxcvbn.org>
> Date: Thu, 13 Aug 2020 11:54:53 +0200
> 
> On Wed, Aug 12 2020, Christian Weisgerber <na...@mips.inka.de> wrote:
> > On 2020-08-10, Stuart Henderson <s...@spacehopper.org> wrote:
> >
> >> x11/qt4
> >>
> >> ld: error: relocation R_386_PC32 cannot be used against symbol 
> >> cti_vm_throw; recompile with -fPIC
> >>>>> defined in ../../JavaScriptCore/release/libjscore.a(JITStubs.o)
> >>>>> referenced by JITStubs.cpp
> >>>>>               JITStubs.o:(.text+0x21) in archive 
> >>>>> ../../JavaScriptCore/release/libjscore.a
> >
> > We've seen that error before.  That was in textproc/wkhtmltopdf,
> > which builds its own included copy of Qt4 WebKit.  Back then, removing
> > -ffunction-sections from the compiler flags fixed it.
> >
> > Now the problem is back, in both wkhtmltopdf and qt4, without
> > -ffunction-sections.  I thought maybe LLVM 10 had enabled this
> > option by default, but it doesn't look like it.  -fno-function-sections
> > also has no effect.
> >
> > I don't understand what's going on.  There is a short assembly stub,
> > ctiVMThrowTrampoline(), which CALLs cti_vm_throw().  Somehow that
> > generates an R_386_PC32 relocation, and somehow that is incompatible
> > with PIC.  (How can PC-relative addressing be incompatible with
> > position-independent code?)
> >
> > With LLVM 8, there is no callable ctiVMThrowTrampoline() function
> > in the object file, and ctiVMThrowTrampoline's code is inlined...
> > somewhere.
> 
> I suspect the problem is similar to what happened with binutils-2.17 on
> amd64 (fixed by kettenis@ in 2015).  Mark, sounds fair?  Note that qt4
> is unsupported upstream, so no need for a "clean" patch.
> 
> I don't have an i386 ports test rig.  naddy, do you still run i386 test
> builds?  Else I can just push it in the tree for sthen to pick up in
> the next bulk, it won't make things worse...

Can't say I fully understand what's happening here either.  But the
fix doesn't look entirely wrong.

> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/x11/qt4/Makefile,v
> retrieving revision 1.163
> diff -u -p -r1.163 Makefile
> --- Makefile  18 Mar 2020 05:14:03 -0000      1.163
> +++ Makefile  13 Aug 2020 09:42:18 -0000
> @@ -26,7 +26,7 @@ PKGNAME-main =              qt4-${PKGVERSION}
>  PKGNAME-debug =              qt4-debug-${PKGVERSION}
>  FULLPKGNAME-html =   qt4-html-${PKGVERSION}
>  FULLPKGPATH-html =   ${BASE_PKGPATH},-html
> -REVISION-main =              22
> +REVISION-main =              23
>  REVISION-mysql =     8
>  REVISION-postgresql =        7
>  REVISION-sqlite2 =   7
> Index: 
> patches/patch-src_3rdparty_webkit_Source_JavaScriptCore_jit_JITStubs_cpp
> ===================================================================
> RCS file: 
> /cvs/ports/x11/qt4/patches/patch-src_3rdparty_webkit_Source_JavaScriptCore_jit_JITStubs_cpp,v
> retrieving revision 1.1
> diff -u -p -r1.1 
> patch-src_3rdparty_webkit_Source_JavaScriptCore_jit_JITStubs_cpp
> --- patches/patch-src_3rdparty_webkit_Source_JavaScriptCore_jit_JITStubs_cpp  
> 13 May 2015 14:03:07 -0000      1.1
> +++ patches/patch-src_3rdparty_webkit_Source_JavaScriptCore_jit_JITStubs_cpp  
> 13 Aug 2020 09:42:18 -0000
> @@ -1,12 +1,17 @@
>  $OpenBSD: patch-src_3rdparty_webkit_Source_JavaScriptCore_jit_JITStubs_cpp,v 
> 1.1 2015/05/13 14:03:07 kettenis Exp $
> ---- src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp.orig  Thu Apr 
> 10 20:37:11 2014
> -+++ src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp       Wed May 
> 13 11:03:44 2015
> +
> +- ld: error: relocation R_386_PC32 cannot be used against symbol 
> cti_vm_throw; recompile with -fPIC
> +                        ^ on i386
> +
> +Index: src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp
> +--- src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp.orig
> ++++ src/3rdparty/webkit/Source/JavaScriptCore/jit/JITStubs.cpp
>  @@ -79,7 +79,7 @@ namespace JSC {
>   #define THUMB_FUNC_PARAM(name)
>   #endif
>   
>  -#if (OS(LINUX) || OS(FREEBSD)) && CPU(X86_64)
> -+#if (OS(LINUX) || OS(FREEBSD) || OS(OPENBSD)) && CPU(X86_64)
> ++#if (OS(LINUX) || OS(FREEBSD) || OS(OPENBSD)) && (CPU(X86) || CPU(X86_64))
>   #define SYMBOL_STRING_RELOCATION(name) #name "@plt"
>   #elif OS(DARWIN) || (CPU(X86_64) && COMPILER(MINGW) && 
> !GCC_VERSION_AT_LEAST(4, 5, 0))
>   #define SYMBOL_STRING_RELOCATION(name) "_" #name
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 

Reply via email to