bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, wh


From: giulio.benetti at micronovasrl dot com
Subject: [Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking libQtGui.so.4.8.7
Date: Mon, 22 Mar 2021 23:57:37 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=21464

--- Comment #14 from Giulio Benetti <giulio.benetti at micronovasrl dot com> ---
Il 23/03/2021 00:36, shorne at sourceware dot org ha scritto:
> https://sourceware.org/bugzilla/show_bug.cgi?id=21464
> 
> Stafford Horne <shorne at sourceware dot org> changed:
> 
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>       Ever confirmed|0                           |1
>             Assignee|unassigned at sourceware dot org   |shorne at sourceware 
> dot org
>     Last reconfirmed|                            |2021-03-22
>               Status|UNCONFIRMED                 |ASSIGNED
> 
> --- Comment #13 from Stafford Horne <shorne at sourceware dot org> ---
> Hi Giulio,
> 
> What issue are you seeing for geos, I am wondering if it is also something
> different.  I tried to build it and I see again different issues, not the
> "relocation truncated to fit: R_OR1K_GOT16 against symbol" issue.
> 
> See below for what I see.
> 
> Note, I am not sure I am building this correctly and maybe this is an issue
> with how cmake is passing link arguments to ld.
> 
>   # Cross compile setting CXX/CC compilers
>   CXX=or1k-smh-linux-gnu-g++ CC=or1k-smh-linux-gnu-gcc cmake ../geos/
> 
>   # Need to suppress this warning
>   make CXX_FLAGS="$CXX_FLAGS -Wno-error=nonnull"
> 
>   # then I see:
> 
> [ 34%] Linking CXX shared library lib/libgeos.so
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: pc-relative relocation
> against dynamic symbol _ZN4geos5index7strtree15AbstractSTRtreeC2Ej
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: pc-relative relocation
> against dynamic symbol _ZN4geos5index12SpatialIndexC2Ev
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: non-pic relocation 
> against
> symbol _ZTVN4geos5index7strtree7STRtreeE
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: non-pic relocation 
> against
> symbol _ZTVN4geos5index7strtree7STRtreeE
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: non-pic relocation 
> against
> symbol _ZTVN4geos5index7strtree7STRtreeE
> ...
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: pc-relative relocation
> against dynamic symbol
> _ZNK9__gnu_cxx17__normal_iteratorIPPN4geos5index7strtree9BoundableESt6vectorIS5_SaIS5_EEEdeEv
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: pc-relative relocation
> against dynamic symbol
> _ZNK9__gnu_cxx17__normal_iteratorIPPN4geos5index7strtree9BoundableESt6vectorIS5_SaIS5_EEEplEi
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: pc-relative relocation
> against dynamic symbol
> _ZSt4moveIRPN4geos5index7strtree9BoundableEEONSt16remove_referenceIT_E4typeEOS7_
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: pc-relative relocation
> against dynamic symbol
> _ZNK9__gnu_cxx17__normal_iteratorIPPN4geos5index7strtree9BoundableESt6vectorIS5_SaIS5_EEEplEi
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: pc-relative relocation
> against dynamic symbol
> _ZNK9__gnu_cxx17__normal_iteratorIPPN4geos5index7strtree9BoundableESt6vectorIS5_SaIS5_EEEdeEv
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: pc-relative relocation
> against dynamic symbol
> _ZNK9__gnu_cxx17__normal_iteratorIPPN4geos5index7strtree9BoundableESt6vectorIS5_SaIS5_EEEdeEv
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: pc-relative relocation
> against dynamic symbol
> _ZNK9__gnu_cxx17__normal_iteratorIPPN4geos5index7strtree9BoundableESt6vectorIS5_SaIS5_EEEdeEv
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: non-pic relocation 
> against
> symbol
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: non-pic relocation 
> against
> symbol
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: pc-relative relocation
> against dynamic symbol _ZNSt8ios_base4InitC1Ev@@GLIBCXX_3.4
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: non-pic relocation 
> against
> symbol __dso_handle
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: non-pic relocation 
> against
> symbol __dso_handle
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: non-pic relocation 
> against
> symbol
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: non-pic relocation 
> against
> symbol
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: non-pic relocation 
> against
> symbol _ZNSt8ios_base4InitD1Ev@@GLIBCXX_3.4
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: non-pic relocation 
> against
> symbol _ZNSt8ios_base4InitD1Ev@@GLIBCXX_3.4
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o: pc-relative relocation
> against dynamic symbol __cxa_atexit@@GLIBC_2.33
> /home/shorne/work/gnu-toolchain/local/lib/gcc/or1k-smh-linux-gnu/11.0.0/../../../../or1k-smh-linux-gnu/bin/ld:
> final link failed: bad value
> collect2: error: ld returned 1 exit status

This link failure should be due to lacking of -fPIC

> make[2]: *** [CMakeFiles/geos.dir/build.make:5370: lib/libgeos.so.3.10.0dev]
> Error 1
> make[1]: *** [CMakeFiles/Makefile2:1173: CMakeFiles/geos.dir/all] Error 2
> 
> 
> 
> readelf -r CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o | grep
> __dso_handle
> 000059a4  0006aa23 R_OR1K_AHI16      00000000   __dso_handle + 0
> 000059a8  0006aa04 R_OR1K_LO_16_IN_I 00000000   __dso_handle + 0
> 
> 
>   readelf -r CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o | grep
> __cxa_atexit
> 000059bc  0006ac06 R_OR1K_INSN_REL_2 00000000   __cxa_atexit + 0
> 

Hi Stafford,

have you tried to reproduce it with Buildroot with this:
'''
# git clone git://git.busybox.net/buildroot
# wget https://git.busybox.net/buildroot-test/tree/utils/br-reproduce-build

- modify BASE_GIT=... with your buildroot path in br-reproduce-build then:
# chmod a+x br-reproduce-build
# ./br-reproduce-build 3eb9f9d0f6d8274b2d19753c006bd83f7d536e3c
'''
?

Other commands are needed to avoid rebuilding everything again and again.

so after the ones above:
# cd 9084cd777aefe0fa8235514c33767d8640ad7a5b
# cd output
# make V=1 libgeos
This ^^^^ is to rebuilding even if it failed and passing V=1 evrything 
is verbose, so you can get exactly C/CXX/LDFLAGS.
You can also find the sources of binutils under 
output/build/host-binutilsXX.X/ so there you can modify and then rebuild 
binutils with:
# cd output
# make host-binutils
This ^^^ should rebuild modified sources and re-install the binaries 
under output/host/usr/bin that is were buildroot takes binutils binaries.

I give you the exact FLAGS passed by Buildroot anyway:
CXX_FLAGS =  -DNDEBUG -fPIC   -ffp-contract=off -std=c++11
LDFLAGS = -fPIC  -DNDEBUG

Hope this helps

Best regards

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]