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

2021-03-25 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99783

Bug ID: 99783
   Summary: relocation truncated to fit: R_OR1K_GOT16 on OpenRISC,
building libgeos
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: shorne at gcc dot gnu.org
  Target Milestone: ---

I confirm, when building with libgeos as described by Giulio

'''
# 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
'''

  - 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.

Some of the 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]: *** [CMake

[Bug target/99783] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, building libgeos

2021-03-25 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99783

Stafford Horne  changed:

   What|Removed |Added

 Target||or1k-*-*
   Assignee|unassigned at gcc dot gnu.org  |shorne at gcc dot 
gnu.org
 Status|UNCONFIRMED |ASSIGNED
 CC||giulio.benetti@micronovasrl
   ||.com, shorne at gcc dot gnu.org
 Ever confirmed|0   |1
   Last reconfirmed||2021-03-26

--- Comment #1 from Stafford Horne  ---
Reported originally in binutils.

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

[Bug rtl-optimization/12754] Faulty register allocation under certain circumstances

2021-03-25 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12754

Stafford Horne  changed:

   What|Removed |Added

 CC||shorne at gcc dot gnu.org

--- Comment #5 from Stafford Horne  ---
There has been a complete rewrite of the or1k compiler now.  Should this be
closed?

[Bug rtl-optimization/12754] Faulty register allocation under certain circumstances

2021-04-05 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12754

Stafford Horne  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |shorne at gcc dot 
gnu.org
 Status|NEW |SUSPENDED

--- Comment #6 from Stafford Horne  ---
Suspending as this is on the old re-written port.

[Bug rtl-optimization/12754] Faulty register allocation under certain circumstances

2021-04-05 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12754

Stafford Horne  changed:

   What|Removed |Added

 Status|SUSPENDED   |RESOLVED
 Resolution|--- |FIXED

[Bug rtl-optimization/12754] Faulty register allocation under certain circumstances

2021-04-05 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12754

Stafford Horne  changed:

   What|Removed |Added

 Resolution|FIXED   |WONTFIX

[Bug target/99783] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, building libgeos

2022-01-01 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99783

Stafford Horne  changed:

   What|Removed |Added

 Resolution|--- |MOVED
 Status|ASSIGNED|RESOLVED

--- Comment #10 from Stafford Horne  ---
Closing this as its a binutils issue.  I have opened:
https://sourceware.org/bugzilla/show_bug.cgi?id=28735

[Bug target/94372] pthread doesn't define _REENTRANT in preprocessor on OpenRISC

2022-01-31 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94372

Stafford Horne  changed:

   What|Removed |Added

 Status|WAITING |ASSIGNED

--- Comment #2 from Stafford Horne  ---
The patch looks fine, I missed it as it seems the patch was only posted in
bugzilla.  Usually sending a patch to gcc-patches will get more attention.

[Bug target/94372] pthread doesn't define _REENTRANT in preprocessor on OpenRISC

2022-02-02 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94372

Stafford Horne  changed:

   What|Removed |Added

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

--- Comment #4 from Stafford Horne  ---
Patch applied. Thank you

[Bug target/102584] [OpenRISC] backend generates wrong halfword constant

2022-02-02 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102584

Stafford Horne  changed:

   What|Removed |Added

 CC||shorne at gcc dot gnu.org
   Last reconfirmed||2022-02-02
   Assignee|unassigned at gcc dot gnu.org  |shorne at gcc dot 
gnu.org
 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1

--- Comment #2 from Stafford Horne  ---
I confirm this looks strange. It seems to be due to not handling some case for
HImode in or1k_expand_move, see below.

Is this causing any actual issue?  As I see it the result is that the registers
will be loaded with f123 instead of f123, but if using HImode only the
lower 16-bits will be used. I confirmed with some simple tests.

void
or1k_expand_move (machine_mode mode, rtx op0, rtx op1)
{
  if (MEM_P (op0))
{ 
  if (!const0_operand (op1, mode))
op1 = force_reg (mode, op1);
}
  else if (mode == QImode || mode == HImode)
{ 
  /* ??? Maybe promote MEMs and CONST_INT to SImode,
 and then squish back with gen_lowpart.  */
}
  else
{   
...
}
  // NOTE at this point op0 and op1 are, checked using print_rtl()
  // (reg:HI 3 r3)
  // (const_int -3805 [0xf123])
  emit_insn (gen_rtx_SET (op0, op1));
}

[Bug rtl-optimization/104153] [12 Regression] ICE due to recent ifcvt changes

2022-02-08 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104153

Stafford Horne  changed:

   What|Removed |Added

 CC||shorne at gcc dot gnu.org

--- Comment #8 from Stafford Horne  ---
I am seeing a similar ICE when building glibc.

/home/shorne/work/gnu-toolchain/gcc/libstdc++-v3/src/c++98/localename.cc: In
constructor 'std::locale::_Impl::_Impl(const char*, std::size_t)':
/home/shorne/work/gnu-toolchain/gcc/libstdc++-v3/src/c++98/localename.cc:315:3:
internal compiler error: in df_refs_verify, at df-scan.cc:4003
  315 |   }
  |   ^
0x6ad94e df_refs_verify
/home/shorne/work/gnu-toolchain/gcc/gcc/df-scan.cc:4003
0xc2d286 df_insn_refs_verify
/home/shorne/work/gnu-toolchain/gcc/gcc/df-scan.cc:4086
0xc2eefb df_bb_verify
/home/shorne/work/gnu-toolchain/gcc/gcc/df-scan.cc:4119
0xc2f28f df_scan_verify()
/home/shorne/work/gnu-toolchain/gcc/gcc/df-scan.cc:4240
0xc1bc14 df_verify()
/home/shorne/work/gnu-toolchain/gcc/gcc/df-core.cc:1818
0xc1bc14 df_analyze_1
/home/shorne/work/gnu-toolchain/gcc/gcc/df-core.cc:1214
0x177e1e1 execute_rtl_cprop
/home/shorne/work/gnu-toolchain/gcc/gcc/cprop.cc:1925
0x177e1e1 execute
/home/shorne/work/gnu-toolchain/gcc/gcc/cprop.cc:1964
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

I confirm the patch also fixes things for me.

[Bug rtl-optimization/104153] [12 Regression] ICE due to recent ifcvt changes

2022-02-08 Thread shorne at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104153

--- Comment #9 from Stafford Horne  ---
Note, I said glibc but of course error I listed was when compiling gcc during
glibc toolchain building.