Commit Graph

1147 Commits

Author SHA1 Message Date
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
Martin Liska 3ae37f9297
Add __gcov_indirect_call_profiler_v4_atomic.
PR gcov-profile/93403
	* tree-profile.c (gimple_init_gcov_profiler): Generate
	both __gcov_indirect_call_profiler_v4 and
	__gcov_indirect_call_profiler_v4_atomic.
	PR gcov-profile/93403
	* libgcov-profiler.c (__gcov_indirect_call_profiler_v4):
	Call __gcov_indirect_call_profiler_body.
	(__gcov_indirect_call_profiler_body): New.
	(__gcov_indirect_call_profiler_v4_atomic): New.
	* libgcov.h (__gcov_indirect_call_profiler_v4_atomic):
	New declaration.
2020-01-27 16:20:10 +01:00
Claudiu Zissulescu 2744b8b286 [ARC] Make libgcc compatible with ARC's reduced register set config.
ARC processors can work with a reduced register set (i.e. registers
r4-r9 and r16-r25 are not available). This option can be enabled
passing -mrf16 option to the compiler, or by using -mcpu=em_mini CPU
configuration. Using RF16 config requires all the hand-made assembly
files used in libgcc to have the corresponding RF16 object attribute
set.

This patch qualifies the relevant hand-made assembly files to
RF16 config, and also adds generic c-functions for the one which are
not.

libgcc/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/crti.S: Add RF16 object attribute.
	* config/arc/crtn.S: Likewise.
	* config/arc/crttls.S: Likewise.
	* config/arc/lib1funcs.S: Likewise.
	* config/arc/fp-hack.h (ARC_OPTFPE): Define.
	* config/arc/lib2funcs.c: New file.
	* config/arc/t-arc: Add lib2funcs to LIB2ADD.
2020-01-27 14:51:03 +02:00
Maciej W. Rozycki e8e66971cd Add `--with-toolexeclibdir=' configuration option
Provide means, in the form of a `--with-toolexeclibdir=' configuration
option, to override the default installation directory for target
libraries, otherwise known as $toolexeclibdir.  This is so that it is
possible to get newly-built libraries, particularly the shared ones,
installed in a common place, so that they can be readily used by the
target system as their host libraries, possibly over NFS, without a need
to manually copy them over from the currently hardcoded location they
would otherwise be installed in.

In the presence of the `--enable-version-specific-runtime-libs' option
and for configurations building native GCC the option is ignored.

	config/
	* toolexeclibdir.m4: New file.

	gcc/
	* doc/install.texi (Cross-Compiler-Specific Options): Document
	`--with-toolexeclibdir' option.

	libada/
	* Makefile.in (configure_deps): Add `toolexeclibdir.m4'.
	* configure.ac: Handle `--with-toolexeclibdir='.
	* configure: Regenerate.

	libatomic/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	libffi/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* include/Makefile.in: Regenerate.
	* man/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	libgcc/
	* Makefile.in (configure_deps): Add `toolexeclibdir.m4'.
	* configure.ac: Handle `--with-toolexeclibdir='.
	* configure: Regenerate.

	libgfortran/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libgomp/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	libhsail-rt/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libitm/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	libobjc/
	* Makefile.in (aclocal_deps): Add `toolexeclibdir.m4'.
	* aclocal.m4: Include `toolexeclibdir.m4'.
	* configure.ac: Handle `--with-toolexeclibdir='.
	* configure: Regenerate.

	liboffloadmic/
	* plugin/configure.ac: Handle `--with-toolexeclibdir='.
	* plugin/Makefile.in: Regenerate.
	* plugin/aclocal.m4: Regenerate.
	* plugin/configure: Regenerate.
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libphobos/
	* m4/druntime.m4: Handle `--with-toolexeclibdir='.
	* m4/Makefile.in: Regenerate.
	* libdruntime/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libquadmath/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libsanitizer/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* asan/Makefile.in: Regenerate.
	* interception/Makefile.in: Regenerate.
	* libbacktrace/Makefile.in: Regenerate.
	* lsan/Makefile.in: Regenerate.
	* sanitizer_common/Makefile.in: Regenerate.
	* tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.in: Regenerate.

	libssp/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libstdc++-v3/
	* acinclude.m4: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* doc/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++98/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	libvtv/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	zlib/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
2020-01-24 11:24:25 +00:00
Dragan Mladjenovic 54b3d52c3c Emit .note.GNU-stack for hard-float linux targets.
libgcc/ChangeLog:

2020-01-23  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>

	* config/mips/gnustack.h: Check for TARGET_LIBC_GNUSTACK also.

gcc/ChangeLog:

2020-01-23  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>

	* config.in: Regenerated.
	* config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to 1
	for TARGET_LIBC_GNUSTACK.
	* configure: Regenerated.
	* configure.ac: Define TARGET_LIBC_GNUSTACK if glibc version is
	found to be 2.31 or greater.
2020-01-23 17:00:03 +01:00
Dragan Mladjenovic a3c1e1f2ff Emit .note.GNU-stack for soft-float linux targets.
gcc/ChangeLog:

2020-01-23  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>

	* config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to
	TARGET_SOFT_FLOAT.
	* config/mips/mips.c (TARGET_ASM_FILE_END): Define to ...
	(mips_asm_file_end): New function. Delegate to
	file_end_indicate_exec_stack if NEED_INDICATE_EXEC_STACK is true.
	* config/mips/mips.h (NEED_INDICATE_EXEC_STACK): Define to 0.

libgcc/ChangeLog:

2020-01-23  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>

	* config/mips/gnustack.h: New file.
	* config/mips/crti.S: Include gnustack.h.
	* config/mips/crtn.S: Likewise.
	* config/mips/mips16.S: Likewise.
	* config/mips/vr4120-div.S: Likewise.
2020-01-23 17:00:02 +01:00
Martin Liska e9ee848dcd
Remove wrong bail out in prune_topn_counter.
* libgcov-driver.c (prune_topn_counter): Remove
	check for -1 as we only prune run-time counters
	that do not generate an invalid state.
2020-01-23 14:34:59 +01:00
Martin Liska 7491c17fe0
Fix TOP N counter update.
PR tree-optimization/92924
	* libgcov-profiler.c (__gcov_topn_values_profiler_body): First
	try to find an existing value, then find an empty slot
	if not found.
2020-01-22 13:40:12 +01:00
Martin Liska 5f32f9cf13
Smart relaxation of TOP N counter.
PR tree-optimization/92924
	* profile.c (compute_value_histograms): Divide
	all counter values.
	PR tree-optimization/92924
	* libgcov-driver.c (prune_topn_counter): New.
	(prune_counters): Likewise.
	(dump_one_gcov): Prune a run-time counter.
	* libgcov-profiler.c (__gcov_topn_values_profiler_body):
	For a known value, add GCOV_TOPN_VALUES to value.
	Otherwise, decrement all counters by one.
2020-01-22 12:08:11 +01:00
Hans-Peter Nilsson 463f649944 libgcc: cris: config/cris/arit.c (DS): Apply attribute __fallthrough__.
* config/cris/arit.c (DS): Apply attribute fallthrough.

Without this, there are, for each compilation of arit.c, 30ish
occurrences of "this statement may fall through
[-Wimplicit-fallthrough=]", for lines that look like
    case 32: DS; case 31: DS; case 30: DS; case 29: DS;
2020-01-18 16:38:56 +01:00
John David Anglin 84479e3a4c Fix compilation of crtstuff.c when DEFAULT_USE_CXA_ATEXIT is false
PR libgcc/92988
	* crtstuff.c (__do_global_dtors_aux): Only call __cxa_finalize if
	DEFAULT_USE_CXA_ATEXIT is true.
2020-01-18 10:30:29 -05:00
Jakub Jelinek 674dcc3f73 Fix up ChangeLog. 2020-01-17 19:45:35 +01:00
Mihail Ionescu e953433f08 [PATCH, GCC/ARM, 1/10] Fix -mcmse check in libgcc
This patch is part of a patch series to add support for Armv8.1-M
Mainline Security Extensions architecture.

Code to detect whether cmse.c can be buit with -mcmse checks the output
of host GCC when invoked with -mcmse. However, an error from the
compiler does not prevent some minimal output so this always holds true.

2020-01-16  Mihail-Calin Ionescu  <mihail.ionescu@arm.com>
2020-01-16  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* config/arm/t-arm: Check return value of gcc rather than lack of
	output.
2020-01-16 15:09:19 +00:00
Georg-Johann Lay 03e8772486 Typo.
libgcc/
	* config/avr/lib1funcs.S (skip): Simplify.
2020-01-14 11:14:23 +01:00
Kwok Cheung Yeung af9bd92015 [amdgcn] Remove dependency on stdint.h in libgcc
2020-01-10  Kwok Cheung Yeung  <kcy@codesourcery.com>

	libgcc/
	* config/gcn/atomic.c: Remove include of stdint.h.
	(__sync_val_compare_and_swap_##SIZE): Replace uintptr_t with
	__UINTPTR_TYPE__.

From-SVN: r280152
2020-01-10 23:19:41 +00:00
Kwok Cheung Yeung d6491d1567 [amdgcn] Add support for sub-word sync_compare_and_swap operations
2020-01-09  Kwok Cheung Yeung  <kcy@codesourcery.com>

	libgcc/
	* config/gcn/atomic.c: New.
	* config/gcn/t-amdgcn (LIB2ADD): Add atomic.c.

From-SVN: r280055
2020-01-09 15:35:14 +00:00
Georg-Johann Lay f30dd60766 Implement 64-bit double functions.
gcc/
	PR target/92055
	* config.gcc (tm_defines) [target=avr]: Support --with-libf7,
	--with-double-comparison.
	* doc/install.texi: Document them.
	* config/avr/avr-c.c (avr_cpu_cpp_builtins)
	<WITH_LIBF7_LIBGCC, WITH_LIBF7_MATH, WITH_LIBF7_MATH_SYMBOLS>
	<WITH_DOUBLE_COMPARISON>: New built-in defines.
	* doc/invoke.texi (AVR Built-in Macros): Document them.
	* config/avr/avr-protos.h (avr_float_lib_compare_returns_bool): New.
	* config/avr/avr.c (avr_float_lib_compare_returns_bool): New function.
	* config/avr/avr.h (FLOAT_LIB_COMPARE_RETURNS_BOOL): New macro.
libgcc/
	PR target/92055
	* config.host (tmake_file) [target=avr]: Add t-libf7,
	t-libf7-math, t-libf7-math-symbols as specified by --with-libf7=.
	* config/avr/t-avrlibc: Don't copy libgcc.a if there are modules
	depending on sizeof (double) or sizeof (long double).
	* config/avr/libf7: New folder.
libgcc/config/avr/libf7/
	PR target/92055
	* t-libf7: New file.
	* t-libf7-math: New file.
	* t-libf7-math-symbols: New file.
	* libf7-common.mk: New file.
	* libf7-asm-object.mk: New file.
	* libf7-c-object.mk: New file.
	* asm-defs.h: New file.
	* libf7.h: New file.
	* libf7.c: New file.
	* libf7-asm.sx: New file.
	* libf7-array.def: New file.
	* libf7-const.def: New file.
	* libf7-constdef.h: New file.
	* f7renames.sh: New script.
	* f7wraps.sh: New script.
	* f7-renames.h: New generated file.
	* f7-wraps.h: New generated file.

From-SVN: r279994
2020-01-08 09:31:07 +00:00
Olivier Hainque 5205a4456b Guard inclusion of vxAtomicLib.h from gthr-vxworks.h
2020-01-05  Olivier Hainque  <hainque@adacore.com>

        * config/gthr-vxworks.h: Guard #include vxAtomicLib.h
	by IN_LIBGCC2.

From-SVN: r279885
2020-01-05 12:45:54 +00:00
Jakub Jelinek 8d9254fc8a Update copyright years.
From-SVN: r279813
2020-01-01 12:51:42 +01:00
Olivier Hainque abb6c3eecf Introduce an internal API for VxWorks version checks
This changes introduces an internal API for VxWorks version checks
within runtime files, a prerequisite to a few fixes coming up for libstdc++
builds on more recent versions of the OS.

2019-12-30  Olivier Hainque  <hainque@adacore.com>

	gcc/
	* config/vxworks/_vxworks-versions.h: New file.
	* config.gcc (*-*-vxworks*): Add it to extra_headers.

	libgcc/
	* config/gthr-vxworks.h: Use _vxworks-versions.h.
	* config/gthr-vxworks-tls.c: Likewise.

From-SVN: r279783
2019-12-30 21:42:26 +00:00
Olivier Hainque d7f5094aa3 Improve VxWorks GTHREAD_ONCE_INIT
2019-12-30  Olivier Hainque  <hainque@adacore.com>

	* config/gthr-vxworks.h (GTHREAD_ONCE_INIT): Use
	standard zero-initializer syntax.

From-SVN: r279776
2019-12-30 21:22:21 +00:00
Olivier Hainque 49cfaa2a71 Fix macro reference in gthr-vxworks-tls.c
2019-12-30  Olivier Hainque  <hainque@adacore.com>

	libgcc/
	* config/gthr-vxworks-tls.c (__gthread_getspecific): Fix
	reference to the internal VX_GET_TLS_DATA interface.

From-SVN: r279775
2019-12-30 21:14:35 +00:00
Olivier Hainque 89b9a55472 Fix typo in macro name guarding conditional in vxcrtstuff.c
2019-12-30  Olivier Hainque  <hainque@adacore.com>

	libgcc/
	* config/vxcrtstuff.c: Fix incorrect spelling of
	USE_INITFINI_ARRAY in guard.

From-SVN: r279774
2019-12-30 21:11:22 +00:00
Jozef Lawrynowicz e8aa9f55f6 MSP430: Add new msp430-elfbare target
contrib/ChangeLog:

2019-12-16  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config-list.mk: Add msp430-elfbare.

gcc/ChangeLog:

2019-12-16  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config.gcc: s/msp430*-*-*/msp430-*-*.
	Handle msp430-*-elfbare.
	* config/msp430/msp430-devices.c (TARGET_SUBDIR): Define.
	(_MSPMKSTR): Define.
	(__MSPMKSTR): Define.
	(rest_of_devices_path): Use TARGET_SUBDIR value in string.
	* config/msp430/msp430.c (msp430_option_override): Error if
	-fuse-cxa-atexit is used when it has been disabled at configure time.
	* config/msp430/t-msp430: Define TARGET_SUBDIR when building
	msp430-devices.o.
	* doc/install.texi: Document msp430-*-elf and msp430-*-elfbare.
	* doc/invoke.texi: Update documentation about which path devices.csv is
	searched for.

gcc/testsuite/ChangeLog:

2019-12-16  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* g++.dg/init/dso_handle1.C: Require cxa_atexit support.
	* g++.dg/init/dso_handle2.C: Likewise.
	* g++.dg/other/cxa-atexit1.C: Likewise.
	* gcc.target/msp430/msp430.exp: Update csv-using-installed.c test to
	handle msp430-elfbare configuration.

libgcc/ChangeLog:

2019-12-16  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config.host: s/msp430*-*-elf/msp430-*-elf*.
	Override default "extra_parts" variable.
	* configure: Regenerate.
	* configure.ac: Disable TM clone registry by default for
	msp430-elfbare.

From-SVN: r279442
2019-12-16 11:02:10 +00:00
Jozef Lawrynowicz a9046e9853 MSP430: Add -fno-exceptions multilib
ChangeLog:

2019-12-11  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config-ml.in (msp430-*-*): Support --disable-no-exceptions configure
	flag.

gcc/ChangeLog:

2019-12-11  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config/msp430/msp430.h (STARTFILE_SPEC) [!fexceptions]: Use
	crtbegin_no_eh.o if building for the C language.
	[fno-exceptions]: Use crtbegin_no_eh.o if building for any language
	except C.
	(ENDFILE_SPEC) [!fexceptions]: Use crtend_no_eh.o if building for 
	the C language.
	[fno-exceptions]: Use crtend_no_eh.o if building for any language
	except C.
	* config/msp430/t-msp430: Add -fno-exceptions multilib.
	* doc/install.texi: Document --disable-no-exceptions multilib configure
	option.
	* doc/sourcebuild.texi: Document exceptions_enabled effective target.

gcc/testsuite/ChangeLog:

2019-12-11  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* lib/gcc-dg.exp: Add dg-prune messages for when exception handling is
	disabled.
	* lib/target-supports.exp (check_effective_target_exceptions_enabled):
	New.

libgcc/ChangeLog:

2019-12-11  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config.host: Add crt{begin,end}_no_eh.o to "extra_parts".
	* config.host (msp430*-*-elf): Add crt{begin,end}_no_eh.o to
	"extra_parts".

From-SVN: r279246
2019-12-11 19:19:50 +00:00
Jozef Lawrynowicz 34a53788fe libgcc: Declare __dso_handle only if DEFAULT_USE_CXA_ATEXIT is true
2019-12-11  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* crtstuff.c: Declare __dso_handle only if DEFAULT_USE_CXA_ATEXIT is
	true.

From-SVN: r279243
2019-12-11 18:59:38 +00:00
Jozef Lawrynowicz 21a098f4a1 libgcc: Fix misuse of USE_EH_FRAME_REGISTRY in crtstuff.c
2019-12-09  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* crtstuff.c (__do_global_dtors_aux): Check if USE_EH_FRAME_REGISTRY is
	defined instead of its value.

From-SVN: r279125
2019-12-09 12:35:55 +00:00
Jozef Lawrynowicz ad8b778345 libgcc: Dont define __do_global_dtors_aux if it will be empty
2019-12-09  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* crtstuff.c (__do_global_dtors_aux): Wrap in #if so it's only defined
	if it will have contents.

From-SVN: r279123
2019-12-09 11:41:07 +00:00
Georg-Johann Lay 08d7ff78b3 re PR target/92055 ([avr] Support 64-bit double)
PR target/92055
	* config/avr/t-avrlibc (MULTISUBDIR): Search for double, not double64.

From-SVN: r278992
2019-12-05 09:47:35 +00:00
Szabolcs Nagy 34b4d99d0c fix ChangeLog to reference the PR
From-SVN: r278403
2019-11-18 12:46:56 +00:00
Szabolcs Nagy 3d3a96a26e musl: Don't use gthr weak refs in libgcc PR91737
The gthr weak reference based single thread detection is unsafe with
static linking and in case of dynamic linking it's ineffective on musl
since pthread symbols are defined in libc.so.

(Ideally this should be fixed for all targets, since glibc plans to move
libpthread.so into libc.so too and users want to static link to pthread
without --whole-archive: PR87189.)

For now we have to explicitly opt out from the broken behaviour in the
config machinery of each target lib and libgcc was previously missed.

libgcc/ChangeLog:

2019-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* config.host: Add t-gthr-noweak on *-*-musl*.
	* config/t-gthr-noweak: New file.

From-SVN: r278399
2019-11-18 12:08:18 +00:00
John David Anglin 632b5e3da7 linux-atomic.c (__kernel_cmpxchg): Change argument 1 to volatile void *.
* config/pa/linux-atomic.c (__kernel_cmpxchg): Change argument 1 to
	volatile void *.  Remove trap check.
	(__kernel_cmpxchg2): Likewise.
	(FETCH_AND_OP_2): Adjust operand types.
	(OP_AND_FETCH_2): Likewise.
	(FETCH_AND_OP_WORD): Likewise.
	(OP_AND_FETCH_WORD): Likewise.
	(COMPARE_AND_SWAP_2): Likewise.
	(__sync_val_compare_and_swap_4): Likewise.
	(__sync_bool_compare_and_swap_4): Likewise.
	(SYNC_LOCK_TEST_AND_SET_2): Likewise.
	(__sync_lock_test_and_set_4): Likewise.
	(SYNC_LOCK_RELEASE_1): Likewise.  Use __kernel_cmpxchg2 for release.
	(__sync_lock_release_4): Adjust operand types.  Use __kernel_cmpxchg
	for release.
	(__sync_lock_release_8): Remove.

From-SVN: r278377
2019-11-17 23:11:52 +00:00
Szabolcs Nagy 838fd641a6 m68k: add musl support
Add the dynamic linker name and fix a type name to use the public name
instead of the glibc internal name.

gcc/ChangeLog:

2019-11-15  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* config/m68k/linux.h (MUSL_DYNAMIC_LINKER): Define.

libgcc/ChangeLog:

2019-11-15  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* config/m68k/linux-unwind.h (struct uw_ucontext): Use sigset_t instead
	of __sigset_t.

From-SVN: r278312
2019-11-15 19:47:12 +00:00
Jerome Lambourg 27204060db Update the arm-*-vxworks* support
2019-11-13  Jerome Lambourg  <lambourg@adacore.com>
            Doug Rupp <rupp@adacore.com>
            Olivier Hainque  <hainque@adacore.com>

	gcc/
	* config.gcc: Collapse the arm-vxworks entries into
	a single arm-wrs-vxworks7* one, bpabi based.  Update
	the default cpu from arm8 to armv7-a
	* config/arm/vxworks.h (CC1_SPEC): Simplify, knowing that
	we always use ARM_UNWIND_INFO.
	(DWARF2_UNWIND_INFO): Remove redefinition.
	(ARM_TARGET2_DWARF_FORMAT): Likewise.
	(VXWORKS_PERSONALITY): Define, to "llvm".
	(VXWORKS_EXTRA_LIBS_RTP): Define, to "-lllvm".

	libgcc/
	* config.host: Collapse the arm-vxworks entries into
	a single arm-wrs-vxworks7* one.
	* config/arm/unwind-arm-vxworks.c: Update comments.  Provide
	__gnu_Unwind_Find_exidx and a weak dummy __cxa_type_match for
	kernel modules, to be overriden by libstdc++ when we link with
	it.  Rely on externally provided __exidx_start/end.

Co-Authored-By: Doug Rupp <rupp@adacore.com>
Co-Authored-By: Olivier Hainque <hainque@adacore.com>

From-SVN: r278253
2019-11-14 16:11:30 +00:00
Doug Rupp 3004f893b4 Base support for vxworks 7 on aarch64
2019-11-14  Doug Rupp  <rupp@adacore.com>
           Olivier Hainque  <hainque@adacore.com>
           Jerome Lambourg  <lambourg@adacore.com>

       gcc/
       * config.gcc: Handle aarch64*-wrs-vxworks7*.
       * config/aarch64/aarch64-vxworks.h: New file.
       * config/aarch64/t-aarch64-vxworks: New file.

       libgcc/
       * config.host: Handle aarch64*-wrs-vxworks7*.

Co-Authored-By: Jerome Lambourg <lambourg@adacore.com>
Co-Authored-By: Olivier Hainque <hainque@adacore.com>

From-SVN: r278251
2019-11-14 16:05:08 +00:00
Olivier Hainque 36e5f4d4f3 Update the libgcc support for VxWorks AE/653
2019-11-12  Olivier Hainque  <hainque@adacore.com>

	libgcc/

        * config/t-gthr-vxworksae: New file, add all the gthr-vxworks
        sources except the cxx0x support to LIB2ADDEH.  We don't support
        cxx0x on AE/653.
        * config/t-vxworksae: New file.

        * config.host: Handle *-*-vxworksae: Add the two aforementioned
	Makefile fragment files at their expected position in the tmake_file
	list, in accordance with what is done for other VxWorks variants.

From-SVN: r278250
2019-11-14 16:00:55 +00:00
Corentin Gay 806dd0472f Improve the thread support for VxWorks
2019-11-12  Corentin Gay  <gay@adacore.com>
	    Jerome Lambourg  <lambourg@adacore.com>
	    Olivier Hainque  <hainque@adacore.com>

	libgcc/

	* config/t-gthr-vxworks: New file, add all the gthr-vxworks
	sources to LIB2ADDEH.
	* config/t-vxworks: Remove adjustments to LIB2ADDEH.
	* config/t-vxworks7: Likewise.

	* config.host: Append a block at the end of the file to add the
	t-gthr files to the tmake_file list for VxWorks after everything
	else.

	* config/vxlib.c: Rename as gthr-vxworks.c.
	* config/vxlib-tls.c: Rename as gthr-vxworks-tls.c.

	* config/gthr-vxworks.h: Simplify a few comments.  Expose a TAS
	API and a basic error checking API, both internal.  Simplify the
	__gthread_once_t type definition and initializers.  Add sections
	for condition variables support and for the C++0x thread support,
	conditioned against Vx653 for the latter.

	* config/gthr-vxworks.c (__gthread_once): Simplify comments and
	implementation, leveraging the TAS internal API.
	* config/gthr-vxworks-tls.c: Introduce an internal TLS data access
	API, leveraging the general availability of TLS services in VxWorks7
	post SR6xxx.
	(__gthread_setspecific, __gthread_setspecific): Use it.
	(tls_delete_hook): Likewise, and simplify the enter/leave dtor logic.
	* config/gthr-vxworks-cond.c: New file.  GTHREAD_COND variable
	support based on VxWorks primitives.
	* config/gthr-vxworks-thread.c: New file.  GTHREAD_CXX0X support
	based on VxWorks primitives.

Co-Authored-By: Jerome Lambourg <lambourg@adacore.com>
Co-Authored-By: Olivier Hainque <hainque@adacore.com>

From-SVN: r278249
2019-11-14 15:58:31 +00:00
Jerome Lambourg 78e49fb1bc Introduce vxworks specific crtstuff support
2019-11-06  Jerome Lambourg  <lambourg@adacore.com>
            Olivier Hainque  <hainque@adacore.com>

	libgcc/
	* config/vxcrtstuff.c: New file.
	* config/t-vxcrtstuff: New Makefile fragment.
	* config.host: Append t-vxcrtstuff to the tmake_file list
	on all VxWorks ports using dwarf for table based EH.

	gcc/
	* config/vx-common.h (USE_TM_CLONE_REGISTRY): Remove
	definition, pointless with a VxWorks specific version
	of crtstuff.
	(DWARF2_UNWIND_INFO): Conditionalize on !ARM_UNWIND_INFO.
	* config/vxworks.h (VX_CRTBEGIN_SPEC, VX_CRTEND_SPEC):
	New local macros, controlling the addition of vxworks specific
	crtstuff objects depending on the EH mechanism and kind of
	module being linked.
	(VXWORKS_STARTFILE_SPEC, VXWORKS_ENDFILE_SPEC): Use them.

Co-Authored-By: Olivier Hainque <hainque@adacore.com>

From-SVN: r278248
2019-11-14 15:53:23 +00:00
Georg-Johann Lay 29f3def308 Support 64-bit double and 64-bit long double configurations.
gcc/
	Support 64-bit double and 64-bit long double configurations.

	PR target/92055
	* config.gcc (tm_defines) [avr]: Set from --with-double=,
	--with-long-double=.
	* config/avr/t-multilib: Remove.
	* config/avr/t-avr: Output of genmultilib.awk is now fully
	dynamically generated and no more part of the repo.
	(HAVE_DOUBLE_MULTILIB, HAVE_LONG_DOUBLE_MULTILIB): New variables.
	Pass them down to...
	* config/avr/genmultilib.awk: ...here and handle them.
	* gcc/config/avr/avr.opt (-mdouble=, avr_double). New option and var.
	(-mlong-double=, avr_long_double). New option and var.
	* common/config/avr/avr-common.c (opts.h, diagnostic.h): Include.
	(TARGET_OPTION_OPTIMIZATION_TABLE) <-mdouble=, -mlong-double=>:
	Set default as requested by --with-double=
	(TARGET_HANDLE_OPTION): Define to this...
	(avr_handle_option): ...new hook worker.
	* config/avr/avr.h (DOUBLE_TYPE_SIZE): Define to avr_double.
	(LONG_DOUBLE_TYPE_SIZE): Define to avr_long_double.
	(avr_double_lib): New proto for spec function.
	(EXTRA_SPEC_FUNCTIONS) <double-lib>: Add.
	(DRIVER_SELF_SPECS): Call %:double-lib.
	* config/avr/avr.c (avr_option_override): Assert
	sizeof(long double) >= sizeof(double) for the target.
	* config/avr/avr-c.c (avr_cpu_cpp_builtins)
	[__HAVE_DOUBLE_MULTILIB__, __HAVE_LONG_DOUBLE_MULTILIB__]
	[__HAVE_DOUBLE64__, __HAVE_DOUBLE32__, __DEFAULT_DOUBLE__=]
	[__HAVE_LONG_DOUBLE64__, __HAVE_LONG_DOUBLE32__]
	[__HAVE_LONG_DOUBLE_IS_DOUBLE__, __DEFAULT_LONG_DOUBLE__=]:
	New built-in define depending on --with-double=, --with-long-double=.
	* config/avr/driver-avr.c (avr_double_lib): New spec function.
	* doc/invoke.tex (AVR Options) <-mdouble=,-mlong-double=>: Doc.
	* doc/install.texi (Cross-Compiler-Specific Options)
	<--with-double=, --with-long-double=>: Doc.

libgcc/
	Support 64-bit double and 64-bit long double configurations.

	PR target/92055
	* config/avr/t-avr (HOST_LIBGCC2_CFLAGS): Only add -DF=SF if
	long double is a 32-bit type.
	* config/avr/t-avrlibc: Copy double64 and long-double64
	multilib(s) from the vanilla one.
	* config/avr/t-copy-libgcc: New Makefile snip.

From-SVN: r277908
2019-11-07 09:19:31 +00:00
Jozef Lawrynowicz 62ec242ea1 libgcc: Fix incorrect use of USE_TM_CLONE_REGISTRY
2019-11-04  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* crtstuff.c: Define USE_TM_CLONE_REGISTRY to 0 if it's undefined and
	the target output object format is not ELF.
	s/defined(USE_TM_CLONE_REGISTRY)/USE_TM_CLONE_REGISTRY.

From-SVN: r277775
2019-11-04 12:41:56 +00:00
Oleg Endo da5c1bbe97 re PR libgcc/78804 ([RX] -m64bit-doubles does not work)
libgcc/
	PR libgcc/78804
	* fp-bit.h: Remove FLOAT_BIT_ORDER_MISMATCH.
	* fp-bit.c (pack_d, unpack_d): Remove special cases for
	FLOAT_BIT_ORDER_MISMATCH.
	* config/arc/t-arc: Remove FLOAT_BIT_ORDER_MISMATCH.

From-SVN: r277752
2019-11-03 12:09:26 +00:00
Jim Wilson 8dc56a2244 RISC-V: Build soft-float divide routines for -mno-fdiv.
Using -mno-fdiv gives linker errors unless we build the missing divide
routines in libgcc always.  There is at least one university project
designing RISC-V parts without FP divide that wants to use the option.

	libgcc/
	* config/riscv/t-softfp32 (softfp_extra): Add FP divide routines

From-SVN: r277723
2019-11-01 13:35:12 -07:00
Jozef Lawrynowicz 91c64455e8 lib2hw_mul.S: Fix wrong syntax in branch instruction.
2019-10-23  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config/msp430/lib2hw_mul.S: Fix wrong syntax in branch instruction.
	s/RESULT_LO/RESLO, s/RESULT_HI/RESHI, s/MPY_OP1/MPY, 
	s/MPY_OP1_S/MPYS, s/MAC_OP1/MAC, s/MPY_OP2/OP2, s/MAC_OP2/OP2.
	Define symbols for 32-bit and f5series hardware multiply
	register addresses.
	Replace hard-coded register addresses with symbols.
	Fix "_mspabi*" typo.
	Fix whitespace.
	* config/msp430/lib2mul.c: Add comment.

From-SVN: r277340
2019-10-23 16:52:47 +00:00
John David Anglin 85093ac6c9 fptr.c (_dl_read_access_allowed): Change argument to unsigned int.
* config/pa/fptr.c (_dl_read_access_allowed): Change argument to
	unsigned int.  Adjust callers.
	(__canonicalize_funcptr_for_compare): Change plabel type to volatile
	unsigned int *.  Load relocation offset before function pointer.
	Add barrier to ensure ordering.

From-SVN: r277015
2019-10-15 22:17:14 +00:00
John David Anglin 1aea083d4b lib2funcs.S (__gcc_plt_call): Load branch target to %r21.
* config/pa/lib2funcs.S (__gcc_plt_call): Load branch target to %r21.
	Load PIC register after branch target.  Fix white space.
	* config/pa/milli64.S ($$dyncall): Separate LINUX and non LINUX
	implementations.  Load PIC register after branch target.  Don't
	clobber function pointer when it points to function descriptor.
	Use nullification instead of branch in LINUX implementation.

From-SVN: r276925
2019-10-12 19:40:42 +00:00
John David Anglin c49af82c5f fptr.c: Disable -Warray-bounds warning.
* config/pa/fptr.c: Disable -Warray-bounds warning.

From-SVN: r276556
2019-10-03 23:51:42 +00:00
Richard Henderson 9e46fd072b libgcc: Rebuild autoconf files
* config.in, configure: Re-rebuild with stock autoconf 2.69,
        not the ubuntu modified 2.69.

From-SVN: r276135
2019-09-25 16:04:58 -07:00
Richard Henderson 58d169ba9f aarch64: Configure for sys/auxv.h in libgcc for lse-init.c
PR target/91833
	* config/aarch64/lse-init.c: Include auto-target.h.  Disable
	initialization if !HAVE_SYS_AUXV_H.
	* configure.ac (AC_CHECK_HEADERS): Add sys/auxv.h.
	* config.in, configure: Rebuild.

From-SVN: r276134
2019-09-25 15:51:55 -07:00
Richard Henderson 88a51d68c4 aarch64: Fix store-exclusive in load-operate LSE helpers
PR target/91834
	* config/aarch64/lse.S (LDNM): Ensure STXR output does not
	overlap the inputs.

From-SVN: r276133
2019-09-25 14:48:41 -07:00
Shaokun Zhang 761e6bb9f7 [AARCH64] Add support for new control bits CTR_EL0.DIC and CTR_EL0.IDC
The DCache clean & ICache invalidation requirements for instructions
to be data coherence are discoverable through new fields in CTR_EL0.
Let's support the two bits if they are enabled, the CPU core will
not execute the unnecessary DCache clean or Icache Invalidation
instructions.

2019-09-25  Shaokun Zhang  <zhangshaokun@hisilicon.com>

	* config/aarch64/sync-cache.c (__aarch64_sync_cache_range): Add support for
	CTR_EL0.IDC and CTR_EL0.DIC.

From-SVN: r276122
2019-09-25 12:38:59 +00:00