gcc/libgcc
Sandra Loosemore 2d33dcfe9f nios2: Support for GOT-relative DW_EH_PE_datarel encoding.
On nios2-linux-gnu, there has been a long-standing bug in C++ exception
handling that sometimes resulted in link errors like

../nios2-linux-gnu/bin/ld: FDE encoding in /tmp/cccfpQ2l.o(.eh_frame) prevents .eh_frame_hdr table being created

when building some shared libraries or PIE executables.  The root of
the problem is that GCC was incorrectly emitting an absolute encoding
in EH tables for PIC.  This patch changes it to use either
DW_EH_PE_indirect (for global) or DW_EH_PE_datarel (for local), and
fixes libgcc so it can find the address of the GOT as the base address
for DW_EH_PE_datarel.

Complicating matters somewhat, GAS was missing support for
%gotoff(symbol) relocation syntax.  I have just pushed a fix for that,
but I've added a configure check to test for presence of the binutils
support and fall back to the current absolute encoding (which works
most of the time) if it is not available.  Once the fix makes it into
an official binutils release it might be appropriate to make this
error out instead.

Since this is a wrong-code bug and affects only nios2 target, I think
this is appropriate for Stage 4.  I regression-tested on both
nios2-linux-gnu and nios2-elf, with and without the binutils support
present, before committing this.

2020-01-31  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/
	* configure.ac [nios2-*-*]: Check HAVE_AS_NIOS2_GOTOFF_RELOCATION.
	* config.in: Regenerated.
	* configure: Regenerated.
	* config/nios2/nios2.h (ASM_PREFERRED_EH_DATA_FORMAT): Fix handling
	for PIC when HAVE_AS_NIOS2_GOTOFF_RELOCATION.
	(ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): New.

	gcc/testsuite/
	* g++.target/nios2/hello-pie.C: New.
	* g++.target/nios2/nios2.exp: New.

	libgcc/
	* config.host [nios2-*-linux*] (tmake_file, tm_file): Adjust.
	* config/nios2-elf-lib.h: New.
	* unwind-dw2-fde-dip.c (_Unwind_IteratePhdrCallback): Use existing
	code for finding GOT base for nios2.
2020-01-31 16:46:50 -08:00
..
config nios2: Support for GOT-relative DW_EH_PE_datarel encoding. 2020-01-31 16:46:50 -08:00
soft-fp soft-fp: Update soft-fp from glibc 2019-05-17 07:37:39 -07:00
ChangeLog nios2: Support for GOT-relative DW_EH_PE_datarel encoding. 2020-01-31 16:46:50 -08:00
Makefile.in Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
config.host nios2: Support for GOT-relative DW_EH_PE_datarel encoding. 2020-01-31 16:46:50 -08:00
config.in aarch64: Configure for sys/auxv.h in libgcc for lse-init.c 2019-09-25 15:51:55 -07:00
configure Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
configure.ac Add `--with-toolexeclibdir=' configuration option 2020-01-24 11:24:25 +00:00
crtstuff.c Fix compilation of crtstuff.c when DEFAULT_USE_CXA_ATEXIT is false 2020-01-18 10:30:29 -05:00
dfp-bit.c Update copyright years. 2020-01-01 12:51:42 +01:00
dfp-bit.h Update copyright years. 2020-01-01 12:51:42 +01:00
divmod.c Update copyright years. 2020-01-01 12:51:42 +01:00
empty.mk
emutls.c Update copyright years. 2020-01-01 12:51:42 +01:00
enable-execute-stack-empty.c
enable-execute-stack-mprotect.c Update copyright years. 2020-01-01 12:51:42 +01:00
find-symver.awk Update copyright years. 2020-01-01 12:51:42 +01:00
fixed-bit.c Update copyright years. 2020-01-01 12:51:42 +01:00
fixed-bit.h Update copyright years. 2020-01-01 12:51:42 +01:00
fixed-obj.mk
floatunsidf.c
floatunsisf.c
floatunsitf.c
floatunsixf.c
fp-bit.c Update copyright years. 2020-01-01 12:51:42 +01:00
fp-bit.h Update copyright years. 2020-01-01 12:51:42 +01:00
gbl-ctors.h Update copyright years. 2020-01-01 12:51:42 +01:00
gcov.h Update copyright years. 2020-01-01 12:51:42 +01:00
gen-fixed.sh
generic-morestack-thread.c Update copyright years. 2020-01-01 12:51:42 +01:00
generic-morestack.c Update copyright years. 2020-01-01 12:51:42 +01:00
generic-morestack.h Update copyright years. 2020-01-01 12:51:42 +01:00
gstdint.h
gthr-posix.h Update copyright years. 2020-01-01 12:51:42 +01:00
gthr-single.h Update copyright years. 2020-01-01 12:51:42 +01:00
gthr.h Update copyright years. 2020-01-01 12:51:42 +01:00
libgcc-std.ver.in Update copyright years. 2020-01-01 12:51:42 +01:00
libgcc2.c Update copyright years. 2020-01-01 12:51:42 +01:00
libgcc2.h Update copyright years. 2020-01-01 12:51:42 +01:00
libgcov-driver-system.c Update copyright years. 2020-01-01 12:51:42 +01:00
libgcov-driver.c Remove wrong bail out in prune_topn_counter. 2020-01-23 14:34:59 +01:00
libgcov-interface.c Update copyright years. 2020-01-01 12:51:42 +01:00
libgcov-merge.c libgcov: Fix merging of topn [PR92924] 2020-01-24 12:12:17 +01:00
libgcov-profiler.c Add __gcov_indirect_call_profiler_v4_atomic. 2020-01-27 16:20:10 +01:00
libgcov-util.c Update copyright years. 2020-01-01 12:51:42 +01:00
libgcov.h Add __gcov_indirect_call_profiler_v4_atomic. 2020-01-27 16:20:10 +01:00
memcmp.c
memcpy.c
memmove.c
memset.c
mkheader.sh Update copyright years. 2020-01-01 12:51:42 +01:00
mkmap-flat.awk Update copyright years. 2020-01-01 12:51:42 +01:00
mkmap-symver.awk Update copyright years. 2020-01-01 12:51:42 +01:00
offloadstuff.c Update copyright years. 2020-01-01 12:51:42 +01:00
shared-object.mk Add the nvptx port. 2014-11-10 16:12:42 +00:00
siditi-object.mk
static-object.mk Add the nvptx port. 2014-11-10 16:12:42 +00:00
sync.c Update copyright years. 2020-01-01 12:51:42 +01:00
udivhi3.c Update copyright years. 2020-01-01 12:51:42 +01:00
udivmod.c Update copyright years. 2020-01-01 12:51:42 +01:00
udivmodhi4.c Update copyright years. 2020-01-01 12:51:42 +01:00
udivmodsi4.c Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-arm-common.inc Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-c.c Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-compat.c Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-compat.h Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-dw2-fde-compat.c Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-dw2-fde-dip.c nios2: Support for GOT-relative DW_EH_PE_datarel encoding. 2020-01-31 16:46:50 -08:00
unwind-dw2-fde.c Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-dw2-fde.h Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-dw2.c Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-dw2.h Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-generic.h Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-pe.h Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-seh.c Update copyright years. 2020-01-01 12:51:42 +01:00
unwind-sjlj.c Update copyright years. 2020-01-01 12:51:42 +01:00
unwind.inc Update copyright years. 2020-01-01 12:51:42 +01:00
vtv_end.c Update copyright years. 2020-01-01 12:51:42 +01:00
vtv_end_preinit.c Update copyright years. 2020-01-01 12:51:42 +01:00
vtv_start.c Update copyright years. 2020-01-01 12:51:42 +01:00
vtv_start_preinit.c Update copyright years. 2020-01-01 12:51:42 +01:00