gcc/libgcc/config
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
..
aarch64 Update copyright years. 2020-01-01 12:51:42 +01:00
alpha Update copyright years. 2020-01-01 12:51:42 +01:00
arc [ARC] Make libgcc compatible with ARC's reduced register set config. 2020-01-27 14:51:03 +02:00
arm [PATCH, GCC/ARM, 1/10] Fix -mcmse check in libgcc 2020-01-16 15:09:19 +00:00
avr Typo. 2020-01-14 11:14:23 +01:00
bfin Update copyright years. 2020-01-01 12:51:42 +01:00
bpf GCC port for eBPF 2019-09-09 12:13:23 +02:00
c6x Update copyright years. 2020-01-01 12:51:42 +01:00
cr16 Update copyright years. 2020-01-01 12:51:42 +01:00
cris libgcc: cris: config/cris/arit.c (DS): Apply attribute __fallthrough__. 2020-01-18 16:38:56 +01:00
csky Update copyright years. 2020-01-01 12:51:42 +01:00
epiphany Update copyright years. 2020-01-01 12:51:42 +01:00
fr30 Update copyright years. 2020-01-01 12:51:42 +01:00
frv Update copyright years. 2020-01-01 12:51:42 +01:00
ft32 Update copyright years. 2020-01-01 12:51:42 +01:00
gcn [amdgcn] Remove dependency on stdint.h in libgcc 2020-01-10 23:19:41 +00:00
h8300 Update copyright years. 2020-01-01 12:51:42 +01:00
i386 Update copyright years. 2020-01-01 12:51:42 +01:00
ia64 Update copyright years. 2020-01-01 12:51:42 +01:00
iq2000 Update copyright years. 2020-01-01 12:51:42 +01:00
libbid Update copyright years. 2020-01-01 12:51:42 +01:00
lm32 Update copyright years. 2020-01-01 12:51:42 +01:00
m32c Update copyright years. 2020-01-01 12:51:42 +01:00
m32r Update copyright years. 2020-01-01 12:51:42 +01:00
m68k Update copyright years. 2020-01-01 12:51:42 +01:00
mcore Update copyright years. 2020-01-01 12:51:42 +01:00
microblaze Update copyright years. 2020-01-01 12:51:42 +01:00
mips Emit .note.GNU-stack for hard-float linux targets. 2020-01-23 17:00:03 +01:00
mmix Update copyright years. 2020-01-01 12:51:42 +01:00
moxie Update copyright years. 2020-01-01 12:51:42 +01:00
msp430 Update copyright years. 2020-01-01 12:51:42 +01:00
nds32 Update copyright years. 2020-01-01 12:51:42 +01:00
nios2 nios2: Support for GOT-relative DW_EH_PE_datarel encoding. 2020-01-31 16:46:50 -08:00
nvptx Update copyright years. 2020-01-01 12:51:42 +01:00
or1k Update copyright years. 2020-01-01 12:51:42 +01:00
pa Update copyright years. 2020-01-01 12:51:42 +01:00
pdp11 t-pdp11 (LIB2ADD): Add divmod.c. 2018-11-01 14:36:52 -04:00
pru Update copyright years. 2020-01-01 12:51:42 +01:00
riscv Update copyright years. 2020-01-01 12:51:42 +01:00
rl78 Update copyright years. 2020-01-01 12:51:42 +01:00
rs6000 Update copyright years. 2020-01-01 12:51:42 +01:00
rx Update copyright years. 2020-01-01 12:51:42 +01:00
s390 Update copyright years. 2020-01-01 12:51:42 +01:00
score Update copyright years. 2020-01-01 12:51:42 +01:00
sh Update copyright years. 2020-01-01 12:51:42 +01:00
sol2 Update copyright years. 2020-01-01 12:51:42 +01:00
sparc Update copyright years. 2020-01-01 12:51:42 +01:00
stormy16 Update copyright years. 2020-01-01 12:51:42 +01:00
tilegx
tilepro Update copyright years. 2020-01-01 12:51:42 +01:00
v850 Update copyright years. 2020-01-01 12:51:42 +01:00
vax Update copyright years. 2020-01-01 12:51:42 +01:00
visium Update copyright years. 2020-01-01 12:51:42 +01:00
vms Update copyright years. 2020-01-01 12:51:42 +01:00
xtensa Update copyright years. 2020-01-01 12:51:42 +01:00
darwin10-unwind-find-enc-func.c Move Darwin10 unwinder fix to a crt shim. 2018-08-22 11:58:43 +00:00
darwin-64.c Update copyright years. 2020-01-01 12:51:42 +01:00
darwin-crt3.c Update copyright years. 2020-01-01 12:51:42 +01:00
darwin-crt-tm.c Update copyright years. 2020-01-01 12:51:42 +01:00
gthr-lynx.h Update copyright years. 2020-01-01 12:51:42 +01:00
gthr-rtems.h Update copyright years. 2020-01-01 12:51:42 +01:00
gthr-vxworks-cond.c Update copyright years. 2020-01-01 12:51:42 +01:00
gthr-vxworks-thread.c Update copyright years. 2020-01-01 12:51:42 +01:00
gthr-vxworks-tls.c Update copyright years. 2020-01-01 12:51:42 +01:00
gthr-vxworks.c Update copyright years. 2020-01-01 12:51:42 +01:00
gthr-vxworks.h Guard inclusion of vxAtomicLib.h from gthr-vxworks.h 2020-01-05 12:45:54 +00:00
hardfp.c Update copyright years. 2020-01-01 12:51:42 +01:00
libgcc-glibc.ver Update copyright years. 2020-01-01 12:51:42 +01:00
libgcc-libsystem.ver
no-sfp-machine.h
no-unwind.h
t-crtfm
t-crtstuff-pic
t-darwin [Darwin] Some TLC for older Darwin versions. 2019-07-03 18:36:28 +00:00
t-dfprules
t-eh-dw2-dip
t-fdpbit
t-fixedpoint-gnu-prefix
t-fpbit
t-freebsd-thread
t-gnu-prefix
t-gthr-noweak musl: Don't use gthr weak refs in libgcc PR91737 2019-11-18 12:08:18 +00:00
t-gthr-vxworks Improve the thread support for VxWorks 2019-11-14 15:58:31 +00:00
t-gthr-vxworksae Update the libgcc support for VxWorks AE/653 2019-11-14 16:00:55 +00:00
t-hardfp Update copyright years. 2020-01-01 12:51:42 +01:00
t-hardfp-sfdf Update copyright years. 2020-01-01 12:51:42 +01:00
t-libgcc-pic
t-libunwind
t-libunwind-elf Update copyright years. 2020-01-01 12:51:42 +01:00
t-linux
t-openbsd-thread
t-rtems
t-slibgcc Update copyright years. 2020-01-01 12:51:42 +01:00
t-slibgcc-darwin
t-slibgcc-elf-ver
t-slibgcc-fuchsia Update copyright years. 2020-01-01 12:51:42 +01:00
t-slibgcc-gld
t-slibgcc-gld-nover
t-slibgcc-hpux
t-slibgcc-libgcc Update copyright years. 2020-01-01 12:51:42 +01:00
t-slibgcc-nolc-override
t-slibgcc-sld Use v2 map syntax in libgcc-unwind.map if Solaris ld supports it 2018-09-18 07:04:15 +00:00
t-slibgcc-vms
t-softfp Update copyright years. 2020-01-01 12:51:42 +01:00
t-softfp-compat
t-softfp-excl
t-softfp-sfdf
t-softfp-sfdftf
t-softfp-tf
t-stack
t-tls
t-vxcrtstuff Introduce vxworks specific crtstuff support 2019-11-14 15:53:23 +00:00
t-vxworks Improve the thread support for VxWorks 2019-11-14 15:58:31 +00:00
t-vxworks7 Improve the thread support for VxWorks 2019-11-14 15:58:31 +00:00
t-vxworksae Update the libgcc support for VxWorks AE/653 2019-11-14 16:00:55 +00:00
unwind-dw2-fde-darwin.c Update copyright years. 2020-01-01 12:51:42 +01:00
vxcache.c Update copyright years. 2020-01-01 12:51:42 +01:00
vxcrtstuff.c Fix typo in macro name guarding conditional in vxcrtstuff.c 2019-12-30 21:11:22 +00:00