[Bug gas/25184] or1k gas errors on any backwards jump on 32-bit host

2019-12-02 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=25184

Stafford Horne  changed:

   What|Removed |Added

 CC||shorne at sourceware dot org

--- Comment #1 from Stafford Horne  ---
I have reproduced this.  There are a few issues here:

  1. One reason for the truncations seems to be related to including 64-bit and
32-bit targets in the OR1K architecture definitions.  If I remove the 64-bit
bit definitions everything seems to work fine.
  2. The other reason is that the PC Address type is 'unsigned int'.  Doing the
computation of ((int)value - (unsigned int)pc)  results in an unsigned int.  We
want for PC to be casted to a signed int, However it seems CGEN doesn't support
that.  It may required a patch to cgen.

My thought it to remove the 64-bit definitions, we don't really use them (2-
lines).  If we need it we can add them back as a separate architecture.

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


[Bug gas/25184] or1k gas errors on any backwards jump on 32-bit host

2019-12-02 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=25184

Stafford Horne  changed:

   What|Removed |Added

   Assignee|unassigned at sourceware dot org   |shorne at sourceware 
dot org

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


[Bug gas/25184] or1k gas errors on any backwards jump on 32-bit host

2019-12-02 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=25184

Stafford Horne  changed:

   What|Removed |Added

   Assignee|shorne at sourceware dot org   |unassigned at 
sourceware dot org

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


[Bug gas/25184] or1k gas errors on any backwards jump on 32-bit host

2019-12-02 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=25184

Stafford Horne  changed:

   What|Removed |Added

   Assignee|unassigned at sourceware dot org   |shorne at gmail dot com

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


[Bug gas/25184] or1k gas errors on any backwards jump on 32-bit host

2019-12-02 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=25184

Stafford Horne  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-12-02
 Ever confirmed|0   |1

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


[Bug ld/20475] Linking PIC executables with a linker script that does not place _GLOBAL_OFFSET_TABLE_ results in incorrect relocation

2019-12-02 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=20475

Stafford Horne  changed:

   What|Removed |Added

 Target||or1k-*-*
 CC||shorne at sourceware dot org

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


[Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking libQtGui.so.4.8.7

2019-12-02 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

Stafford Horne  changed:

   What|Removed |Added

 Target||or1k-*-*
 CC||shorne at sourceware dot org

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


[Bug gas/25184] or1k gas errors on any backwards jump on 32-bit host

2020-05-19 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=25184

Stafford Horne  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Stafford Horne  ---
The committed patches fix this for me.

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


[Bug ld/27624] OpenRisc BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377

2021-03-22 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27624

Stafford Horne  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 CC||shorne at sourceware dot org
 Target||or1k-*-*
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2021-03-22

--- Comment #1 from Stafford Horne  ---
I confirm this is an issue, I will submit my patch to the list for review.  So
far with my testing it works.

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


[Bug ld/27624] OpenRisc BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377

2021-03-22 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27624

Stafford Horne  changed:

   What|Removed |Added

   Assignee|unassigned at sourceware dot org   |shorne at sourceware 
dot org

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


[Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking libQtGui.so.4.8.7

2021-03-22 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

Stafford Horne  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  ---
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:
CMakeFile

[Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking libQtGui.so.4.8.7

2021-03-22 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

--- Comment #15 from Stafford Horne  ---
(In reply to Stafford Horne from comment #13)
> /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
> 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
> 59a4  0006aa23 R_OR1K_AHI16     __dso_handle + 0
> 59a8  0006aa04 R_OR1K_LO_16_IN_I    __dso_handle + 0
> 
> 
>  readelf -r CMakeFiles/geos.dir/src/index/strtree/STRtree.cpp.o | grep
> __cxa_atexit
> 59bc  0006ac06 R_OR1K_INSN_REL_2    __cxa_atexit + 0

OK, these errors are bogus.  They looked strange to me, the issue here was that
I changed CXX_FLAGS mid build and it caused the new files to be created without
-fPIC, so the final link created all these crazy issues.

Rebuilding now with the correct CXX_FLAGS throughout and I see, everything
builds fine.  What error are you seeing?  Am I using the right libgeos?

< shorne@lianli ~/work/gnu-toolchain/geos > git remote -v
origin  https://git.osgeo.org/gitea/geos/geos.git (fetch)
origin  https://git.osgeo.org/gitea/geos/geos.git (push)

< shorne@lianli ~/work/gnu-toolchain/build-geos > make 
[  0%] Built target ryu
[ 57%] Built target geos
[ 58%] Built target geos_c
[ 92%] Built target test_geos_unit
[ 93%] Built target tinyxml2
[ 93%] Built target test_xmltester
[ 94%] Built target test_simplewkttester
[ 95%] Built target test_big_sweep_line_speed
[ 95%] Built target perf_class_sizes
[ 95%] Built target perf_unary
[ 95%] Built target perf_intersection
[ 95%] Built target perf_geospreparedcontains
[ 96%] Built target perf_memleak_mp_prep
[ 97%] Built target perf_unaryunion_segments
[ 97%] Built target perf_voronoi
[ 98%] Built target perf_interiorpoint_area
[ 98%] Built target perf_iterated_buffer
[ 98%] Built target perf_rectangle_intersects
[ 99%] Built target geosop
[100%] Built target astyle

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


[Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking libQtGui.so.4.8.7

2021-03-22 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

--- Comment #16 from Stafford Horne  ---
(In reply to Giulio Benetti from comment #14)
> Il 23/03/2021 00:36, shorne at sourceware dot org ha scritto:
> > https://sourceware.org/bugzilla/show_bug.cgi?id=21464
> 
> 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

Hello,

I tried to use the br-reproduce-build command before but it was not working. 
Let me try again with you extra steps.

Thanks.

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


[Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking libQtGui.so.4.8.7

2021-03-24 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

--- Comment #18 from Stafford Horne  ---
I confirm, when building with libgeos as you described I also see the familiar
R_OR1K_GOT16 truncation issue.

I did some investigation, some points

  - In an earlier comment I mentioned the runtime PLT overflow, this is not
related to this R_OR1K_GOT16 relocation, sorry my mistake.  When creating the
PLT in or1k_elf_finish_dynamic_symbol the plt_reloc address may have a 16-bit
overflow in the l.ori instruction which is not checked. Similar but a different
issue.  Thats a different bug that I should raise.

  - This issue is an overflow in the 16-bit immediate in the l.lwz load
instruction generated for R_OR1K_GOT16 by GCC.  So the fix has to start with
GCC.  I will need to have a bit further look on how to handle this.

For the record some of the errors Errors:

linux-uclibc/9.3.0/crtbeginS.o: in function `__do_global_dtors_aux':
crtstuff.c:(.text+0x118): relocation truncated to fit: R_OR1K_GOT16 against
symbol `__cxa_finalize' defined in .text section in 
/home/shorne/work/openrisc/3eb9f9d0f6d8274b2d19753c006bd83f7d536e3c/output/host/or1k-buildroot-linux-uclibc/sysroot/lib/libc.so.
1
crtstuff.c:(.text+0x140): relocation truncated to fit: R_OR1K_GOT16 against
symbol `__deregister_frame_info@@GLIBC_2.0' defined 
in .text section in
/home/shorne/work/openrisc/3eb9f9d0f6d8274b2d19753c006bd83f7d536e3c/output/host/opt/ext-toolchain/bin/../lib
/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/lib/libgcc_s.so
/home/shorne/work/openrisc/3eb9f9d0f6d8274b2d19753c006bd83f7d536e3c/output/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-
linux-uclibc/9.3.0/crtbeginS.o: in function `frame_dummy':
crtstuff.c:(.text+0x1a0): relocation truncated to fit: R_OR1K_GOT16 against
symbol `__register_frame_info@@GLIBC_2.0' defined in
 .text section in
/home/shorne/work/openrisc/3eb9f9d0f6d8274b2d19753c006bd83f7d536e3c/output/host/opt/ext-toolchain/bin/../lib/g
cc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/lib/libgcc_s.so
CMakeFiles/geos.dir/src/algorithm/BoundaryNodeRule.cpp.o: in function
`geos::algorithm::BoundaryNodeRule::~BoundaryNodeRule()':
BoundaryNodeRule.cpp:(.text._ZN4geos9algorithm16BoundaryNodeRuleD2Ev[_ZN4geos9algorithm16BoundaryNodeRuleD5Ev]+0x24):
relocation
 truncated to fit: R_OR1K_GOT16 against symbol `vtable for
geos::algorithm::BoundaryNodeRule' defined in .data.rel.ro._ZTVN4geos
9algorithm16BoundaryNodeRuleE[_ZTVN4geos9algorithm16BoundaryNodeRuleE] section
in CMakeFiles/geos.dir/src/algorithm/BoundaryNode
Rule.cpp.o
CMakeFiles/geos.dir/src/algorithm/CGAlgorithmsDD.cpp.o: in function
`geos::algorithm::CGAlgorithmsDD::orientationIndex(double, d
ouble, double, double, double, double)':
CGAlgorithmsDD.cpp:(.text+0x308): relocation truncated to fit: R_OR1K_GOT16
against symbol `geos::util::IllegalArgumentException
::~IllegalArgumentException()' defined in
.text._ZN4geos4util24IllegalArgumentExceptionD2Ev[_ZN4geos4util24IllegalArgumentExcept
ionD5Ev] section in CMakeFiles/geos.dir/src/algorithm/CGAlgorithmsDD.cpp.o
CGAlgorithmsDD.cpp:(.text+0x310): relocation truncated to fit: R_OR1K_GOT16
against symbol `typeinfo for geos::util::IllegalArgu
mentException' defined in
.data.rel.ro._ZTIN4geos4util24IllegalArgumentExceptionE[_ZTIN4geos4util24IllegalArgumentExceptionE]
se
ction in CMakeFiles/geos.dir/src/algorithm/CGAlgorithmsDD.cpp.o
CMakeFiles/geos.dir/src/algorithm/CGAlgorithmsDD.cpp.o: in function
`geos::algorithm::CGAlgorithmsDD::signOfDet2x2(double, doubl
e, double, double)':
CGAlgorithmsDD.cpp:(.text+0xa34): relocation truncated to fit: R_OR1K_GOT16
against symbol `geos::util::IllegalArgumentException
::~IllegalArgumentException()' defined in
.text._ZN4geos4util24IllegalArgumentExceptionD2Ev[_ZN4geos4util24IllegalArgumentExcept
ionD5Ev] section in CMakeFiles/geos.dir/src/algorithm/CGAlgorithmsDD.cpp.o
CGAlgorithmsDD.cpp:(.text+0xa3c): relocation truncated to fit: R_OR1K_GOT16
against symbol `typeinfo for geos::util::IllegalArgu
mentException' defined in
.data.rel.ro._ZTIN4geos4util24IllegalArgumentExceptionE[_ZTIN4geos4util24IllegalArgumentExceptionE]
se
ction in CMakeFiles/geos.dir/src/algorithm/CGAlgorithmsDD.cpp.o
CMakeFiles/geos.dir/src/algorithm/CGAlgorithmsDD.cpp.o: in function
`geos::util::GEOSException::GEOSException(std::__cxx11::basi
c_string, std::allocator > const&,
std::__cxx11::basic_string, s
td::allocator > const&)':
CGAlgorithmsDD.cpp:(.text._ZN4geos4util13GEOSExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_[_ZN4geos4util
13GEOSExceptionC5ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_]+0xc0):
additional relocation overflows omitted from
 the output
collect2: error: ld returned 1 exit status
make[4]: *** [CMakeFiles/geos.dir/build.make:5369: lib/libgeos.so.3.9.0] Error
1
make[3]: *** [CMakeFiles/Makefile2:359: CMakeFiles/geos.dir/all] Error 2
make[2]: *** [Makefile:172: all] Error 2
make[1]: *** [package/p

[Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking libQtGui.so.4.8.7

2021-03-25 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

--- Comment #20 from Stafford Horne  ---
Sure, I will open an issue in GCC there for the R_OR1K_GOT16 truncation issue. 
I had a look at other architectures they have the ability to pass an argument
-mcmodel=large or -mxgot to generate code that will handle large binary sizes.

I will have to implement something that does something similar in GCC and then
add code to handle the new relocations in the assembler and linker/bfd.

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


[Bug ld/27652] New: OpenRISC: PLT got offset overflow in big binaries

2021-03-25 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27652

Bug ID: 27652
   Summary: OpenRISC: PLT got offset overflow in big binaries
   Product: binutils
   Version: 2.35.2
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: shorne at sourceware dot org
  Target Milestone: ---

As discussed in Bug 21464

When creating the PLT in or1k_elf_finish_dynamic_symbol the plt_reloc address
may have a 16-bit overflow in the l.ori instruction the overflow is not
checked, and creates binaries that will crash during runtime symbol lookup.

This was found via a glibc test failure:

FAIL: nptl/tst-audit-threads - works with LD_BIND_NOW=1, fails because PLT is
too large and overruns instruction 16-bit immediate.

.plt

   75e70:   19 80 00 0b l.movhi r12,0xb
   75e74:   85 8c 95 64 l.lwz r12,-27292(r12)
   75e78:   44 00 60 00 l.jr r12
   75e7c:   a9 60 ff f0 l.ori r11,r0,0xfff0

   75e80:   19 80 00 0b l.movhi r12,0xb
   75e84:   85 8c 95 68 l.lwz r12,-27288(r12)
   75e88:   44 00 60 00 l.jr r12
   75e8c:   a9 60 ff fc l.ori r11,r0,0xfffc

   75e90:   19 80 00 0b l.movhi r12,0xb
   75e94:   85 8c 95 6c l.lwz r12,-27284(r12)
   75e98:   44 00 60 00 l.jr r12
   75e9c:   a9 61 00 08 l.ori r11,r1,0x8< r0 changed to r1 from
overflow

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


[Bug ld/27652] OpenRISC: PLT got offset overflow in big binaries

2021-03-25 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27652

Stafford Horne  changed:

   What|Removed |Added

 Target||or1k-*-*
 CC||giulio.benetti@micronovasrl
   ||.com, shorne at sourceware dot 
org
   Assignee|unassigned at sourceware dot org   |shorne at sourceware 
dot org

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


[Bug binutils/27746] New: or1k bfd overflow in plt reloc argument

2021-04-16 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27746

Bug ID: 27746
   Summary: or1k bfd overflow in plt reloc argument
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: shorne at sourceware dot org
  Target Milestone: ---

Related to 21464

When generating PLT entries the or1k bfd implementation will silently overflow
the PLT argument to _dl_fixup causing a crash at runtime.  This was noticed
with glibc test elf/tst-audit-threads.

Workaround run library with LD_BIND_NOW=1.

Example

.plt

   75e70:   19 80 00 0b l.movhi r12,0xb
   75e74:   85 8c 95 64 l.lwz r12,-27292(r12)
   75e78:   44 00 60 00 l.jr r12
   75e7c:   a9 60 ff f0 l.ori r11,r0,0xfff0

   75e80:   19 80 00 0b l.movhi r12,0xb
   75e84:   85 8c 95 68 l.lwz r12,-27288(r12)
   75e88:   44 00 60 00 l.jr r12
   75e8c:   a9 60 ff fc l.ori r11,r0,0xfffc

   75e90:   19 80 00 0b l.movhi r12,0xb
   75e94:   85 8c 95 6c l.lwz r12,-27284(r12)
   75e98:   44 00 60 00 l.jr r12
   75e9c:   a9 61 00 08 l.ori r11,r1,0x8< r0 changed to r1 from
overflow

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


[Bug binutils/27746] or1k bfd overflow in plt reloc argument

2021-04-16 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27746

Stafford Horne  changed:

   What|Removed |Added

 Target||or1k-*-*
   Assignee|unassigned at sourceware dot org   |shorne at sourceware 
dot org

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


[Bug binutils/27746] or1k bfd overflow in plt reloc argument

2021-04-16 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27746

Stafford Horne  changed:

   What|Removed |Added

 Blocks||21464


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=21464
[Bug 21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking
libQtGui.so.4.8.7
-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking libQtGui.so.4.8.7

2021-04-16 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

Stafford Horne  changed:

   What|Removed |Added

 Depends on||27746


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=27746
[Bug 27746] or1k bfd overflow in plt reloc argument
-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/27624] OpenRisc BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377

2021-05-06 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27624

Stafford Horne  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Stafford Horne  ---
The latest commit comment should have fixed this.

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


[Bug binutils/27746] or1k bfd overflow in plt reloc argument

2021-05-06 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27746

Stafford Horne  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #3 from Stafford Horne  ---
The latest commit comment should have fixed this.

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


[Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking libQtGui.so.4.8.7

2021-05-06 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21464
Bug 21464 depends on bug 27746, which changed state.

Bug 27746 Summary: or1k bfd overflow in plt reloc argument
https://sourceware.org/bugzilla/show_bug.cgi?id=27746

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

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


[Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking libQtGui.so.4.8.7

2021-05-06 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

Stafford Horne  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #25 from Stafford Horne  ---
The latest commit should fix this.

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


[Bug ld/28735] New: relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, building libgeos

2022-01-01 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=28735

Bug ID: 28735
   Summary: relocation truncated to fit: R_OR1K_GOT16 on OpenRISC,
building libgeos
   Product: binutils
   Version: 2.37
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: shorne at sourceware dot org
  Target Milestone: ---

This is related to 21464, the original fix was not sufficient.

Creating this binutils filing as a copy of the gcc bug: 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99783

>From that bug:

OK, I can reproduce, but I am not sure what is going on I will need to debug a
bit more.  This is what I have so far.

ERROR:

  I am seeing the same error you report.

   
buildroot/output/host/lib/gcc/or1k-buildroot-linux-uclibc/11.2.0/crtbeginS.o:
in function `deregister_tm_clones':
crtstuff.c:(.text+0x44): relocation truncated to fit: R_OR1K_GOT16 against
undefined symbol `_ITM_deregisterTMCloneTable'
   
buildroot/output/host/lib/gcc/or1k-buildroot-linux-uclibc/11.2.0/crtbeginS.o:
in function `register_tm_clones':
crtstuff.c:(.text+0xcc): relocation truncated to fit: R_OR1K_GOT16 against
undefined symbol `_ITM_registerTMCloneTable'
   
buildroot/output/host/lib/gcc/or1k-buildroot-linux-uclibc/11.2.0/crtbeginS.o:
in function `__do_global_dtors_aux':
crtstuff.c:(.text+0x12c): relocation truncated to fit: R_OR1K_GOT16 against
symbol `__cxa_finalize' defined in .text section in
buildroot/output/host/or1k-buildroot-linux-uclibc/sysroot/lib/libc.so.1
crtstuff.c:(.text+0x15c): relocation truncated to fit: R_OR1K_GOT16 against
symbol `__deregister_frame_info@@GLIBC_2.0' defined in .text section in
buildroot/output/host/lib/gcc/or1k-buildroot-linux-uclibc/11.2.0/../../../../or1k-buildroot-linux-uclibc/lib/libgcc_s.so
   
buildroot/output/host/lib/gcc/or1k-buildroot-linux-uclibc/11.2.0/crtbeginS.o:
in function `frame_dummy':


Actual Code patterns:

  Looking at the generated object file.
  We can see R_OR1K_GOT_AHI16 followed by R_OR1K_GOT16.  This confirms the
  cmodel=large is ON.

or1k-elf-objdump -dr
buildroot/output/host/lib/gcc/or1k-buildroot-linux-uclibc/11.2.0/crtbeginS.o

deregister_tm_clones:

  38:   1a 20 00 00 l.movhi r17,0x0
38: R_OR1K_GOT_AHI16_ITM_deregisterTMCloneTable
  3c:   e2 31 98 00 l.add r17,r17,r19
  40:   1a 60 00 00 l.movhi r19,0x0
  44:   86 31 00 00 l.lwz r17,0(r17)
44: R_OR1K_GOT16_ITM_deregisterTMCloneTable
  48:   e4 11 98 00 l.sfeq r17,r19
  4c:   10 00 00 04 l.bf 5c 
  50:   85 21 00 00 l.lwz r9,0(r1)

register_tm_clones:

  c0:   10 00 00 09 l.bf e4 
  c4:   1a 20 00 00 l.movhi r17,0x0
c4: R_OR1K_GOT_AHI16_ITM_registerTMCloneTable
  c8:   e2 31 98 00 l.add r17,r17,r19
  cc:   86 31 00 00 l.lwz r17,0(r17)
cc: R_OR1K_GOT16_ITM_registerTMCloneTable
  d0:   e4 11 a8 00 l.sfeq r17,r21

__do_global_dtors_aux:

 150:   1a 20 00 00 l.movhi r17,0x0
150: R_OR1K_GOT_AHI16   __deregister_frame_info
 154:   e2 31 80 00 l.add r17,r17,r16
 158:   1a 60 00 00 l.movhi r19,0x0
 15c:   86 31 00 00 l.lwz r17,0(r17)
15c: R_OR1K_GOT16   __deregister_frame_info
 160:   e4 11 98 00 l.sfeq r17,r19
 164:   10 00 00 07 l.bf 180 <__do_global_dtors_aux+0x90>

IN buildroot/output/build/host-binutils-2.37/bfd/elf32-or1k.c:

   We have this bit of code which confirms we have the correct patches
   available in binutils.  This code shows we should be avoiding this
truncation
   if we have R_OR1K_GOT_AHI16 followed by R_OR1K_GOT16 which is what we have.

   Note, the comment above if (r_type == R_OR1K_GOT16 && saw_gotha) seems
   backwards.

if (r_type == R_OR1K_GOT_AHI16)
  saw_gotha = true;

/* If we have a R_OR1K_GOT16 followed by a R_OR1K_GOT_AHI16
   relocation we assume the code is doing the right thing to avoid
   overflows.  Here we mask the lower 16-bit of the relocation to
   avoid overflow validation failures.  */
if (r_type == R_OR1K_GOT16 && saw_gotha)
  relocation &= 0x;

I will have to look at this more.

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


[Bug ld/28735] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, building libgeos

2022-01-01 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=28735

--- Comment #1 from Stafford Horne  ---
The issue is the the relation has the 16-bit sign bit set.  So even though we
are masking out upper bits to try to avoid overflow we still get an error for
signed overflow.

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


[Bug ld/28735] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, building libgeos

2022-01-01 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=28735

Stafford Horne  changed:

   What|Removed |Added

   Assignee|unassigned at sourceware dot org   |shorne at sourceware 
dot org
 Status|NEW |ASSIGNED

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


[Bug ld/28735] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, building libgeos

2022-01-01 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=28735

Stafford Horne  changed:

   What|Removed |Added

 Depends on||21464


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=21464
[Bug 21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking
libQtGui.so.4.8.7
-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/21464] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, when linking libQtGui.so.4.8.7

2022-01-01 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

Stafford Horne  changed:

   What|Removed |Added

 Blocks||28735


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=28735
[Bug 28735] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, building
libgeos
-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/28735] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, building libgeos

2022-01-01 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=28735

--- Comment #2 from Stafford Horne  ---
Posted patch:
https://sourceware.org/pipermail/binutils/2022-January/119078.html

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


[Bug ld/28735] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, building libgeos

2022-02-02 Thread shorne at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=28735

Stafford Horne  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Stafford Horne  ---
This patch should fix it.

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