Commit Graph

905 Commits

Author SHA1 Message Date
Jeff Law
fc259b522c Remove long deprecated tilegx and tilepro ports
/
	* MAINTAINERS: Remove tilegx and tilepro entries.
	* configure.ac: Remove tilegx and tilepro stanzas.
	* configure: Rebuilt.

contrib/
	* config-list.mk: Remove tilegx and tilepro entries.
	* gcc_update: Remove tilegx and tilepro entries.

gcc/
	* common/config/tilegx/tilegx-common.cc: Removed.
	* common/config/tilepro/tilepro-common.cc: Removed.
	* config.gcc: Remove tilegx and tilepro entries.
	* config/tilegx/constraints.md: Removed.
	* config/tilegx/feedback.h: Removed.
	* config/tilegx/linux.h: Removed.
	* config/tilegx/mul-tables.cc: Removed.
	* config/tilegx/predicates.md: Removed.
	* config/tilegx/sync.md: Removed.
	* config/tilegx/t-tilegx: Removed.
	* config/tilegx/tilegx-builtins.h: Removed.
	* config/tilegx/tilegx-c.cc: Removed.
	* config/tilegx/tilegx-generic.md: Removed.
	* config/tilegx/tilegx-modes.def: Removed.
	* config/tilegx/tilegx-multiply.h: Removed.
	* config/tilegx/tilegx-opts.h: Removed.
	* config/tilegx/tilegx-protos.h: Removed.
	* config/tilegx/tilegx.cc: Removed.
	* config/tilegx/tilegx.h: Removed.
	* config/tilegx/tilegx.md: Removed.
	* config/tilegx/tilegx.opt: Removed.
	* config/tilepro/constraints.md: Removed.
	* config/tilepro/feedback.h: Removed.
	* config/tilepro/gen-mul-tables.cc: Removed.
	* config/tilepro/linux.h: Removed.
	* config/tilepro/mul-tables.cc: Removed.
	* config/tilepro/predicates.md: Removed.
	* config/tilepro/t-tilepro: Removed.
	* config/tilepro/tilepro-builtins.h: Removed.
	* config/tilepro/tilepro-c.cc: Removed.
	* config/tilepro/tilepro-generic.md: Removed.
	* config/tilepro/tilepro-modes.def: Removed.
	* config/tilepro/tilepro-multiply.h: Removed.
	* config/tilepro/tilepro-protos.h: Removed.
	* config/tilepro/tilepro.cc: Removed.
	* config/tilepro/tilepro.h: Removed.
	* config/tilepro/tilepro.md: Removed.
	* config/tilepro/tilepro.opt: Removed.
	* configure.ac: Remove tilegx and tilepro entries.
	* configure: Rebuilt.
	* doc/extend.texi: Remove tilegx and tilepro entries.
	* doc/install.texi: Remove tilegx and tilepro entries.
	* doc/invoke.texi: Remove tilegx and tilepro entries.
	* doc/md.texi: Remove tilegx and tilepro entries.

gcc/testsuite/
	* gcc.dg/lower-subreg-1.c: Remove tilegx and tilepro entries.
	* gcc.misc-tests/linkage.exp: Remove tilegx and
	tilepro entries.

libgcc/
	* config.host: Removed tilegx and tilepro entries.
	* config/tilegx/sfp-machine.h: Removed.
	* config/tilegx/sfp-machine32.h: Removed.
	* config/tilegx/sfp-machine64.h: Removed.
	* config/tilegx/t-crtstuff: Removed.
	* config/tilegx/t-softfp: Removed.
	* config/tilegx/t-tilegx: Removed.
	* config/tilepro/atomic.c: Removed.
	* config/tilepro/atomic.h: Removed.
	* config/tilepro/linux-unwind.h: Removed.
	* config/tilepro/sfp-machine.h: Removed.
	* config/tilepro/softdivide.c: Removed.
	* config/tilepro/softmpy.S: Removed.
	* config/tilepro/t-crtstuff: Removed.
	* config/tilepro/t-tilepro: Removed.
2022-06-25 13:55:21 -04:00
Takayuki 'January June' Suwa
29dc90a580 xtensa: Add clrsbsi2 insn pattern
> (clrsb:m x)
> Represents the number of redundant leading sign bits in x, represented
> as an integer of mode m, starting at the most significant bit position.

This explanation is just what the NSA instruction (not ever emitted before)
calculates in Xtensa ISA.

gcc/ChangeLog:

	* config/xtensa/xtensa.md (clrsbsi2): New insn pattern.

libgcc/ChangeLog:

	* config/xtensa/lib1funcs.S (__clrsbsi2): New function.
	* config/xtensa/t-xtensa (LIB1ASMFUNCS): Add _clrsbsi2.
2022-06-09 15:07:59 -07:00
Wilco Dijkstra
75c4e4909a AArch64: Prioritise init_have_lse_atomics constructor [PR 105708]
Increase the priority of the init_have_lse_atomics constructor so it runs
before other constructors. This improves chances that rr works when LSE
atomics are supported.

libgcc/
	PR libgcc/105708
	* config/aarch64/lse-init.c: Increase constructor priority.
2022-05-25 15:53:30 +01:00
Szabolcs Nagy
0d344b5576 aarch64: Fix pac-ret with unusual dwarf in libgcc unwinder [PR104689]
The RA_SIGN_STATE dwarf pseudo-register is normally only set using the
DW_CFA_AARCH64_negate_ra_state (== DW_CFA_window_save) operation which
toggles the return address signedness state (the default state is 0).
(It may be set by remember/restore_state CFI too, those save/restore
the state of all registers.)

However RA_SIGN_STATE can be set directly via DW_CFA_val_expression too.
GCC does not generate such CFI but some other compilers reportedly do.

Note: the toggle operation must not be mixed with other dwarf register
rule CFI within the same CIE and FDE.

In libgcc we assume REG_UNSAVED means the RA_STATE is set using toggle
operations, otherwise we assume its value is set by other CFI.

libgcc/ChangeLog:

	PR target/104689
	* config/aarch64/aarch64-unwind.h (aarch64_frob_update_context):
	Handle the !REG_UNSAVED case.
	* unwind-dw2.c (execute_cfa_program): Fail toggle if !REG_UNSAVED.

gcc/testsuite/ChangeLog:

	PR target/104689
	* gcc.target/aarch64/pr104689.c: New test.
2022-05-25 09:17:06 +01:00
GCC Administrator
57f2ce6a87 Daily bump. 2022-05-21 00:16:32 +00:00
Christophe Lyon
5143faee0d libgcc: use __builtin_clz and __builtin_ctz in libbid
This patch replaces libbid's implementations of clz and ctz for 32 and
64 bits inputs which used several masks, and switches to the
corresponding builtins. This will provide a better implementation,
especially on targets with clz/ctz instructions.

2022-05-06  Christophe Lyon  <christophe.lyon@arm.com>

libgcc/config/libbid/ChangeLog:

	* bid_binarydecimal.c (CLZ32_MASK16): Delete.
	(CLZ32_MASK8): Delete.
	(CLZ32_MASK4): Delete.
	(CLZ32_MASK2): Delete.
	(CLZ32_MASK1): Delete.
	(clz32_nz): Use __builtin_clz.
	(ctz32_1bit): Delete.
	(ctz32): Use __builtin_ctz.
	(CLZ64_MASK32): Delete.
	(CLZ64_MASK16): Delete.
	(CLZ64_MASK8): Delete.
	(CLZ64_MASK4): Delete.
	(CLZ64_MASK2): Delete.
	(CLZ64_MASK1): Delete.
	(clz64_nz): Use __builtin_clzl.
	(ctz64_1bit): Delete.
	(ctz64): Use __builtin_ctzl.
2022-05-20 09:36:08 +02:00
Christophe Lyon
308a0af4f9 libgcc: Add support for HF mode (aka _Float16) in libbid
This patch adds support for trunc and extend operations between HF
mode (_Float16) and Decimal Floating Point formats (_Decimal32,
_Decimal64 and _Decimal128).

For simplicity we rely on the implicit conversions inserted by the
compiler between HF and SD/DF/TF modes.  The existing bid*_to_binary*
and binary*_to_bid* functions are non-trivial and at this stage it is
not clear if there is a performance-critical use case involving _Float16
and _Decimal* formats.

The patch also adds two executable tests, to make sure the right
functions are called, available (link phase) and functional.

Tested on aarch64 and x86_64. The number of symbol matches in the
testcases includes the .global XXX to avoid having to match different
call instructions for different targets.

2022-05-04  Christophe Lyon  <christophe.lyon@arm.com>

libgcc/ChangeLog:

	* Makefile.in (D32PBIT_FUNCS): Add _hf_to_sd and _sd_to_hf.
	(D64PBIT_FUNCS): Add _hf_to_dd and _dd_to_hf.
	(D128PBIT_FUNCS): Add _hf_to_td _td_to_hf.

libgcc/config/libbid/ChangeLog:

	* bid_gcc_intrinsics.h (LIBGCC2_HAS_HF_MODE): Define according to
	__LIBGCC_HAS_HF_MODE__.
	(BID_HAS_HF_MODE): Define.
	(HFtype): Define.
	(__bid_extendhfsd): New prototype.
	(__bid_extendhfdd): Likewise.
	(__bid_extendhftd): Likewise.
	(__bid_truncsdhf): Likewise.
	(__bid_truncddhf): Likewise.
	(__bid_trunctdhf): Likewise.
	* _dd_to_hf.c: New file.
	* _hf_to_dd.c: New file.
	* _hf_to_sd.c: New file.
	* _hf_to_td.c: New file.
	* _sd_to_hf.c: New file.
	* _td_to_hf.c: New file.

gcc/testsuite/ChangeLog:

	* gcc.dg/torture/convert-dfp-2.c: New test.
	* gcc.dg/torture/convert-dfp.c: New test.
2022-05-20 09:35:54 +02:00
Christophe Lyon
43ccb7e445 libgcc: Enable XF mode conversions to/from DFP modes only if supported
Some targets do not support XF mode (eg AArch64), so don't build the
corresponding to/from DFP modes convertion routines if
__LIBGCC_HAS_XF_MODE__ is not defined.

2022-03-31  Christophe Lyon  <christophe.lyon@arm.com>

	libgcc/config/libbid/
	* _dd_to_xf.c: Check __LIBGCC_HAS_XF_MODE__.
	* _sd_to_xf.c: Likewise.
	* _td_to_xf.c: Likewise.
	* _xf_to_dd.c: Likewise.
	* _xf_to_sd.c: Likewise.
	* _xf_to_td.c: Likewise.
2022-05-20 09:33:04 +02:00
Sebastian Pop
bc25483c05 [AArch64] add barriers to ool __sync builtins
2022-05-13  Sebastian Pop  <spop@amazon.com>

gcc/
	PR target/105162
	* config/aarch64/aarch64-protos.h (atomic_ool_names): Increase dimension
	of str array.
	* config/aarch64/aarch64.cc (aarch64_atomic_ool_func): Call
	memmodel_from_int and handle MEMMODEL_SYNC_*.
	(DEF0): Add __aarch64_*_sync functions.

gcc/testsuite/
	PR target/105162
	* gcc.target/aarch64/sync-comp-swap-ool.c: New.
	* gcc.target/aarch64/sync-op-acquire-ool.c: New.
	* gcc.target/aarch64/sync-op-full-ool.c: New.
	* gcc.target/aarch64/target_attr_20.c: Update check.
	* gcc.target/aarch64/target_attr_21.c: Same.

libgcc/
	PR target/105162
	* config/aarch64/lse.S: Define BARRIER and handle memory MODEL 5.
	* config/aarch64/t-lse: Add a 5th memory model for _sync functions.
2022-05-13 17:09:43 +00:00
Sergei Trofimovich
cef0372823 libgcc: IA64: don't compile glibc-based unwinder without libc headers
In --without-headers mode gcc fails to bootstrap on libgcc as:

    /build/build/./gcc/xgcc -B/build/build/./gcc/ ... -Dinhibit_libc -c fde-glibc.c
    ../../../gcc-12-20220403/libgcc/config/ia64/fde-glibc.c:33:10:
        fatal error: stdlib.h: No such file or directory

Most other linux targets are able to build the --without-headers
compiler without additional effort. This change adds IA64 to the fold.

The change drops part of the code that relies on DYNAMIC glibc
section traversal for backtraces.

Tested bootstrap of ia64-unknown-linux-gnu with and without libc
headers present.

libgcc/
	* config/ia64/fde-glibc.c: Make a no-op in inhibit_libc mode.
2022-04-08 08:01:06 +01:00
chenglulu
bf291a4330 LoongArch Port: libgcc
2022-03-29  Chenghua Xu  <xuchenghua@loongson.cn>
	    Lulu Cheng  <chenglulu@loongson.cn>

libgcc/ChangeLog:

	* config/loongarch/crtfastmath.c: New file.
	* config/loongarch/linux-unwind.h: Like wise.
	* config/loongarch/sfp-machine.h: Like wise.
	* config/loongarch/t-crtstuff: Like wise.
	* config/loongarch/t-loongarch: Like wise.
	* config/loongarch/t-loongarch64: Like wise.
	* config/loongarch/t-softfp-tf: Like wise.
	* config.host: Add LoongArch tuples.
	* configure.ac: Add LoongArch support.
2022-03-29 17:43:35 +08:00
Sergei Trofimovich
638e630142 libgcc: m68k: avoid TEXTRELs in shared library (PR 86224)
libgcc/
	PR libgcc/86224
	* config/m68k/lb1sf68.S (__mulsi3_internal): Internal, hidden alias
	for __mulsi3.
	(__udivsi3_internal, __divsi3_internal): Similarly.
	(__umodsi3, __modsi3): Use the internal function names.
2022-03-19 15:14:21 -04:00
Tobias Burnus
450526551d GCN: Implement __atomic_compare_exchange_{1,2} in libgcc [PR102215]
libgcc/ChangeLog:

	PR target/102215
	* config/gcn/atomic.c (__sync_val_compare_and_swap_##SIZE): Move
	a line up to non-arg-dependent value first.
	(__ATOMIC_COMPARE_EXCHANGE): Define + call to generate
	__atomic_compare_exchange_{1,2}.
2022-03-09 19:34:48 +01:00
Iain Sandoe
c18ddb05b0 Darwin, libgcc: Fix build errors on powerpc-darwin8.
PowerPC Darwin8 is the last version to use an unwind frame fallback routine.
This had been omitted from the new shared EH library, along with one more
header dependency that only fires there.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config/rs6000/t-darwin-ehs: Add darwin-fallback.o.
	* config/t-darwin-ehs: Add dependency on unwind.h.
2022-03-04 16:44:54 +00:00
Jonathan Yong
dcf8fe1eea libgcc: Fix __gthr_i486_lock_cmp_xchg clobber for Windows
2022-01-14  David  <gccbugzilla@limegreensocks.com>

libgcc/
	* config/i386/gthr-win32.c (__gthr_i486_lock_cmp_xchg):
	Remove inlined version, Windows 95 is no longer relevant.
	* config/i386/gthr-win32.h
	(__GTHREAD_I486_INLINE_LOCK_PRIMITIVES): unset.
2022-01-15 13:32:05 +00:00
Claudiu Zissulescu
68a650ba57 arc: Add DWARF2 alternate CFA column.
Add DWARF 2 CFA column which tracks the return address from a signal
handler context.  This value must not correspond to a hard register
and must be out of the range of DWARF_FRAME_REGNUM().

gcc/
	* config/arc/arc.h (DWARF_FRAME_REGNUM): Update definition.
	(DWARF_FRAME_RETURN_COLUMN): Use RETURN_ADDR_REGNUM macro.
	(INCOMING_RETURN_ADDR_RTX): Likewise.
	(DWARF_ALT_FRAME_RETURN_COLUMN): Define.

gcc/testsuite/
	* gcc.target/arc/cancel-1.c: New file.

libgcc/
	* config/arc/linux-unwind.h (arc_fallback_frame_state): Use
	DWARF_ALT_FRAME_RETURN_COLUMN macro.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2022-01-14 12:24:52 +02:00
Jakub Jelinek
7adcbafe45 Update copyright years. 2022-01-03 10:42:10 +01:00
Jakub Jelinek
877e3c2abf Update Copyright in ChangeLog files
Do this separately from all other Copyright updates, as ChangeLog files
can be modified only separately.
2022-01-03 10:31:39 +01:00
John David Anglin
4620531ea9 Generate illegal instruction fault if LWS syscall returns -EFAULT.
2022-01-02  John David Anglin  <danglin@gcc.gnu.org>

libgcc/ChangeLog:

	* config/pa/linux-atomic.c (_ASM_EFAULT): Define.
	(__kernel_cmpxchg): Nullify illegal iitlbp instruction if error
	return is not equal _ASM_EFAULT.
	(__kernel_cmpxchg2): Likewise.
2022-01-02 17:12:45 +00:00
Iain Sandoe
574c09da48 libgcc, Darwin: Add missing build dependencies.
There was a race condition where the link for the new shared EH library
(only used on earlier Darwin) could fail because the new crts had not been
copied to the gcc directory.  This can cause a build failure (although
currently only seen on powerpc-darwin).

Fixed by adding specific dependency on the crts and on the multi target.
We also add the declaration header for the Darwin10 unwinder shim to the
powerpc cases, since we build that there for Rosetta use.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config.host: Add shim declaration header to powerpc*-darwin builds.
	* config/rs6000/t-darwin-ehs: Remove dependency on the powerpc end
	file.
	* config/t-darwin-ehs: Add dependencies to the shared unwinder
	objects.
	* config/t-slibgcc-darwin: Add extra_parts to the dependencies for
	the shared EH lib.  Add all-multi to the dependencies for the
	libgcc_s.1.dylib redirections.
2021-12-17 10:12:53 +00:00
Frederic Konrad
4099d6501e Tigthen libc_internal and crtstuff for VxWorks shared objects
This change tightens and documents the use of libc_internal, then
strengthens the VxWorks crtstuff objects for the support of shared
libraries. In particular:

- Define __dso_handle, which libstdc++.so requires,

- Provide _init and _fini functions to run through the init/fini arrays
  for shared libs in configurations which HAVE_INITFINI_ARRAY_SUPPORT.

The init/fini functions are provided by libc_internal.a for static links
but with slightly different names and we don't want to risk dragging other
libc_internal contents in the closure accidentally so make sure we don't
link with it.

As for the !vxworks crtstuff, the new shared libs specific bits are
conditioned by a CRTSTUFFS_O macro, for which we provide new Makefile
fragment.

The bits to actually use the fragment and the shared objects will
be added by a forthcoming change, as part of a more general configury
update for shared libs.

The change also adds guards the eh table registration code
in vxcrtstuff so the objects can be used for either init/fini
or eh tables independently.

2021-12-07  Fred Konrad  <konrad@adacore.com>
	    Olivier Hainque  <hainque@adacore.com>

gcc/
	* config/vxworks.h (VXWORKS_BASE_LIBS_RTP): Guard -lc_internal
	on !shared+!non-static and document.
	(VXWORKS_LIB_SPEC): Remove the bits intended to drag the
	init/fini functions from libc_internal in the shared lib case.
	(VX_CRTBEGIN_SPEC/VX_CRTEND_SPEC): Use vxcrtstuff objects also in
	configurations with shared lib and INITFINI_ARRAY support.

libgcc/
	* config/t-vxcrtstuffS: New Makefile fragment.
	* config/vxcrtstuff.c: Provide __dso_handle. Provide _init/_fini
	functions for INITFINI_ARRAY support in shared libs and guard
	the definition of eh table registration functions on conditions
	indicating they are needed.
2021-12-13 18:03:03 +00:00
Olivier Hainque
0ecb48d753 Preserve cpu specific CRTSTUFF_T_CFLAGS on powerpc-vxworks7
The unconditional assignment performed in t-vxworks to handle
include flags currently overrides what specific cpu ports had
for the regular (!vxworks) crtstuff objects.

This was not done on purpose and the proposed change adjusts the
configuration bits to apply the vxworks specific flags on top of
the cpu ones instead.

2021-12-07  Olivier Hainque  <hainque@adacore.com>

	* config.host (powerpc*-wrs-vxworks7*): Place t-crtstuff
	ahead of the other files in tmake_files.
	* config/t-vxworks: Add to CRTSTUFF_T_CFLAGS instead of
	overriding it.
2021-12-13 17:59:54 +00:00
Olivier Hainque
f3f923e513 Leverage sysroot for VxWorks
The build of a VxWorks toolchain relies a lot on system headers
and VxWorks has a few very specific features that require special
processing. For example, different sets of headers for the kernel
vs the rtp modes, which the compiler knows about by way of -mrtp
on the command line.

If we manage to avoid the need for fixincludes on recent versions
of VxWorks (>= 7), we still need to handle at least VxWorks 6.9 at
this stage.

We sort of get away with locating the correct headers at
run-time thanks to environment variables and various tests for
-mrtp in cpp specs, but getting fixincludes to work for old
configurations has always been tricky and getting a toolchain
to build with c++/libstdc++ support gets trickier with every
move to a more recent release.

sysroot_headers_suffix_spec is a pretty powerful device to help
address such issues, and this patch introduces changes that let
us get advantage of it.

The general idea is to leverage the assumption that compilations
occur with --sysroot=$VSB_DIR on vx7 or --sysroot=$WIND_BASE/target
prior to that.

For the toolchains we build, this is achieved with a few
configure options like:

  --with-sysroot
  --with-build-sysroot=${WIND_BASE}/target
  --with-specs=%{!sysroot=*:--sysroot=%:getenv(WIND_BASE /target)}

This also allows simplifying the libgcc compilation flags control
and we take the opportunity to merge t-vxworks7 into t-vxworks as
the two files were differing only on the libgcc2 flags part.

2021-12-09  Olivier Hainque  <hainque@adacore.com>

gcc/
	* config/t-vxworks: Clear NATIVE_SYSTEM_HEADER_DIR.
	* config/vxworks.h (SYSROOT_HEADERS_SUFFIX_SPEC): Define, for
	VxWorks 7 and earlier.
	(VXWORKS_ADDITIONAL_CPP_SPEC): Simplify accordingly.
	(STARTFILE_PREFIX_SPEC): Adjust accordingly.
	* config/rs6000/vxworks.h (STARTFILE_PREFIX_SPEC): Adjust.

libgcc/
	* config/t-vxworks (LIBGCC2_INCLUDES): Simplify and handle
	both VxWorks7 and earlier.
	* config/t-vxworks7: Remove.
	* config.host: Remove special case for vxworks7.
2021-12-13 13:54:01 +00:00
Rasmus Villemoes
365c7c6ac5 libgcc: vxcrtstuff.c: make ctor/dtor functions static
When the translation unit itself creates pointers to the ctors/dtors
in a specific section handled by the linker (whether .init_array or
.ctors.*), there's no reason for the functions to have external
linkage. That ends up polluting the symbol table in the running
kernel.

This makes vxcrtstuff.c on par with the generic crtstuff.c which also
defines e.g. frame_dummy and __do_global_dtors_aux static.

libgcc/
	* config/vxcrtstuff.c: Make constructor and destructor
	functions static when possible.
2021-12-11 14:33:29 +01:00
Rasmus Villemoes
8b2885dee5 libgcc: vxcrtstuff.c: remove ctor/dtor declarations
These declarations prevent the priority given in the
constructor/destructor attributes from taking effect, thus emitting
the function pointers in the ordinary (lowest-priority)
.init_array/.fini_array sections.

libgcc/
	* config/vxcrtstuff.c: Remove constructor/destructor
	declarations.
2021-12-11 14:33:18 +01:00
Iain Sandoe
b504917e43 libgcc, Darwin: Update darwin10 unwinder shim dependencies.
We include libgcc_tm.h to provide a prototype for this shim
so add that to the make dependencies.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config/t-darwin: Add libgcc_tm.h to the dependencies
	for darwin10-unwind-find-enc-func.
2021-12-10 23:15:15 +00:00
Rasmus Villemoes
68fd247e15 Replace t-ppccomm by t-vxworks in libgcc/config/rs6000
This removes ibm-ldouble.c and a few eabi crt files from the build
closure, which were producing objects we don't use anyway.

2021-12-07  Rasmus Villemoes  <rv@rasmusvillemoes.dk>

libgcc/
	* config/rs6000/t-vxworks: New file.
	* config.host (powerpc*-*-vxworks*): Use it instead of
	t-ppccomm.
2021-12-10 13:17:22 +00:00
Olivier Hainque
6a0f6018ba Provide vxworks alternate stdint.h during the build
This change arranges to provide the vxworks alternate stdint.h
at build time instead of at install time, so it is used instead
of the system one while building the libraries.

This is a lot more consistent and helps the build on configurations
where the system does not come with stdint.h at all.

The change uses a similar mechanism as the one previsouly introduced
for glimits.h and takes the opportunity to simplify the glimits.h
command to use an automatic variable.

This introduces an indirect dependency on the VxWorks version.h
for vxcrtstuff objects, for which we then need to apply the same
tricks as for libgcc2 regarding include paths (to select the system
header instead of the gcc one).

2021-02-12  Olivier Hainque  <hainque@adacore.com>
	    Rasmus Villemoes  <rv@rasmusvillemoes.dk>

gcc/
	* Makefile.in (T_STDINT_GCC_H): New variable, path to
	stdint-gcc.h that a target configuration may override when
	use_gcc_stdint is "provide".
	(stmp-int-hdrs): Depend on it and copy that for
	USE_GCC_INT=provide.
	* config.gcc (vxworks): Revert to use_gcc_stdint=provide.
	* config/t-vxworks (T_STDINT_GCC_H): Define, as vxw-stdint-gcc.h.
	(vxw-stdint-gcc.h): New target, produced from the original
	stdint-gcc.h.
	(vxw-glimits.h): Use an automatic variable to designate the
	first and only prerequisite.
	* config/vxworks/stdint.h: Remove.

libgcc/
	* config/t-vxworks: Set CRTSTUFF_T_CFLAGS to
	$(LIBGCC2_INCLUDES).
	* config/t-vxworks7: Likewise.
2021-12-09 15:54:50 +00:00
Iain Sandoe
7add7f7bb3 libgcc, Darwin: Build a libgcc_s.1 for backwards compatibility.
In order to reslve a long-standing issue with inter-operation
with libSystem, we have bumped the SO name for libgcc_s.

Distributions might wish to install this new version into a
structure where exisiting code is already linked with the
compiler-local libgcc_s.1 (providing symbols exported by the
now-retired libgcc_ext.10.x shims).

The replacement libgcc_s.1 forwards the symbols from the new SO.
In order to support DYLD_LIBRARY_PATH on systems (where it works)
we forward the libSystem unwinder symbols from 10.7+ and a
compiler-local version of the libgcc unwinder on earlier.

For macOS 10.4 to 10.6 this is 'bug-compatible' with existing uses.
For 10.7+ the behaviour will now actually be correct.

This should be squashed with the initial libgcc changes for PR80556
in any backport (r12-5418-gd4943ce939d)

libgcc/ChangeLog:

	* config.host (*-*-darwin*): Add logic to build a shared
	unwinder library for Darwin8-10.
	* config/i386/t-darwin: Build legacy libgcc_s.1.
	* config/rs6000/t-darwin: Likewise.
	* config/t-darwin: Reorganise the EH fragments to place
	them for inclusion in a shared EH lib.
	* config/t-slibgcc-darwin: Build a legacy libgcc_s.1 and
	the supporting pieces (all FAT libs).
	* config/t-darwin-noeh: Removed.
	* config/darwin-unwind.ver: New file.
	* config/rs6000/t-darwin-ehs: New file.
	* config/t-darwin-ehs: New file.
2021-12-08 19:53:28 +00:00
Nelson Chu
45116f3420 RISC-V: jal cannot refer to a default visibility symbol for shared object.
This is the original binutils bugzilla report,
https://sourceware.org/bugzilla/show_bug.cgi?id=28509

And this is the first version of the proposed binutils patch,
https://sourceware.org/pipermail/binutils/2021-November/118398.html

After applying the binutils patch, I get the the unexpected error when
building libgcc,

/scratch/nelsonc/riscv-gnu-toolchain/riscv-gcc/libgcc/config/riscv/div.S:42:
/scratch/nelsonc/build-upstream/rv64gc-linux/build-install/riscv64-unknown-linux-gnu/bin/ld: relocation R_RISCV_JAL against `__udivdi3' which may bind externally can not be used when making a shared object; recompile with -fPIC

Therefore, this patch add an extra hidden alias symbol for __udivdi3, and
then use HIDDEN_JUMPTARGET to target a non-preemptible symbol instead.
The solution is similar to glibc as follows,
https://sourceware.org/git/?p=glibc.git;a=commit;h=68389203832ab39dd0dbaabbc4059e7fff51c29b

libgcc/ChangeLog:

	* config/riscv/div.S: Add the hidden alias symbol for __udivdi3, and
	then use HIDDEN_JUMPTARGET to target it since it is non-preemptible.
	* config/riscv/riscv-asm.h: Added new macros HIDDEN_JUMPTARGET and
	HIDDEN_DEF.
2021-12-06 10:55:01 +08:00
Rasmus Villemoes
930e763782 libgcc: vxcrtstuff.c: add a few undefs
When vxcrtstuff.c was created, the set of #includes was copied from
crtstuff.c. But crtstuff.c also has a bunch of #undefs after the first
#include, because, as the comment says, including auto-host.h when
building objects that are meant for target is technically not
correct.

This manifests when I try do do a canadian cross, with build=linux,
host=windows and target=vxworks, in that we pick up a

  #define caddr_t char *

from auto-host.h, which then of course creates a problem when we later
include a target header that has

  typedef char * caddr_t;

I assume that the #undefs in crtstuff.c have been added for similar
reasons.

These potentially problematic #defines all seem to be guarded by
#ifndef USED_FOR_TARGET, which tconfig.h defines before including
auto-host.h. So at first, it seems that one could avoid the problem
by simply removing the initial include of auto-host.h. Unfortunately,
we do need some of the things defined in auto-host.h within such an
ifndef USED_FOR_TARGET, namely the define of
HAVE_INITFINI_ARRAY_SUPPORT, which is what later causes
initfini-array.h to define USE_INITFINI_ARRAY. So as the next best
fix, just copy the #undefs from crtstuff.c.

libgcc/
	* config/vxcrtstuff.c: Undefine caddr_t, pid_t, rlim_t,
	ssize_t and vfork after including auto-host.h.
2021-11-30 09:05:03 +01:00
John David Anglin
14dd0921fe Fix typo in t-dimode
2021-11-27  John David Anglin  <danglin@gcc.gnu.org>

libgcc/ChangeLog:

	* config/pa/t-dimode (lib2difuncs): Fix typo.
2021-11-27 21:47:47 +00:00
Iain Sandoe
d4943ce939 Darwin: Rework handling for unwinder code in libgcc_s and specs [PR80556].
This addresses a long-standing problem where a work-around for an unwinder
issue (also a regression) regresses other functionality.  The patch replaces
several work-arounds with a fix for PR80556 and a work-around for PR88590.

* The fix for PR80556 requires a bump to the SO name for libgcc_s, since we
need to remove the unwinder symbols from it.  This would trigger PR88590
hence the work-around for that.

* We weaken the symbols for emulated TLS support so that it is possible
for a DSO linked with static-libgcc to interoperate with a DSO linked with
libgcc_s.  Likewise main exes.

* We remove all the gcc-4.2.1 era stubs machinery and workarounds.

* libgcc is always now linked ahead of libc, which avoids fails where the
libc (libSystem) builtins implementations are not up to date.

* The unwinder now always comes from the system
 - for Darwin9 from /usr/lib/libgcc_s.1.dylib
 - for Darwin10 from /usr/lib/libSystem.dylib
 - for Darwin11+ from /usr/lib/system/libunwind.dylib.

 We still insert a shim on Darwin10 to fix an omitted unwind function, but
 the underlying unwinder remains the system one.

* The work-around for PR88590 has two parts (1) we always link libgcc from
its convenience lib on affected system versions (avoiding the need to find
the DSO path); (2) we add and export the emutls functions from DSOs - this
makes a relatively small (20k) addition to a DSO.  These can be backed out
when a proper fix for PR88590 is committed.

For distributions that wish to install a libgcc_s.1.dylib to satisfy linkage
from exes that linked against the stubs can use a reexported libgcc_s.1.1
(since that contains all the symbols that were previously exported via the
 stubs).

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	PR target/80556
	* config/darwin-driver.c (darwin_driver_init): Handle exported
	symbols and symbol lists (suppress automatic export of the TLS
	symbols).
	* config/darwin.c (darwin_rename_builtins): Remove workaround.
	* config/darwin.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise.
	(REAL_LIBGCC_SPEC): Handle revised library uses.
	* config/darwin.opt (nodefaultexport): New.
	* config/i386/darwin.h (PR80556_WORKAROUND): Remove.
	* config/i386/darwin32-biarch.h (PR80556_WORKAROUND): Likewise.
	* config/i386/darwin64-biarch.h (PR80556_WORKAROUND): Likewise.

libgcc/ChangeLog:

	* config.host: Add weak emutls crt to the extra_parts.
	* config/i386/darwin-lib.h (DECLARE_LIBRARY_RENAMES): Remove
	workaround.
	* config/libgcc-libsystem.ver: Add exclude list for the system-
	provided unwinder.
	* config/t-slibgcc-darwin: Bump SO version, remove stubs code.
	* config/i386/libgcc-darwin.10.4.ver: Removed.
	* config/i386/libgcc-darwin.10.5.ver: Removed.
	* config/rs6000/libgcc-darwin.10.4.ver: Removed.
	* config/rs6000/libgcc-darwin.10.5.ver: Removed.
	* config/t-darwin-noeh: New file.

gcc/testsuite/ChangeLog:

	* gcc.dg/torture/fp-int-convert-timode-3.c: Remove XFAIL.
	* gcc.dg/torture/fp-int-convert-timode-4.c: Likewise.
2021-11-19 19:58:11 +00:00
Iain Sandoe
b9873b4e2c libgcc, emutls: Allow building weak definitions of the emutls functions.
In order to better support use of the emulated TLS between objects with
DSO dependencies and static-linked libgcc, allow a target to make weak
definitions.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config/t-darwin: Build weak-defined emutls objects.
	* emutls.c (__emutls_get_address): Add optional attributes.
	(__emutls_register_common): Likewise.
	(EMUTLS_ATTR): New.
2021-11-19 19:53:39 +00:00
Raphael Moreira Zinsly
8d71d3a317 libgcc: Fix backtrace fallback on PowerPC Big-endian
At the end of the backtrace stream _Unwind_Find_FDE() may not be able
to find the frame unwind info and will later call the backtrace fallback
instead of finishing. This occurs when using an old libc on ppc64 due to
dl_iterate_phdr() not being able to set the fde in the last trace.
When this occurs the cfa of the trace will be behind of context's cfa.
Also, libgo’s probestackmaps() calls the backtrace with a null pointer
and can get to the backchain fallback with the same problem, in this case
we are only interested in find a stack map, we don't need nor can do a
backchain.
_Unwind_ForcedUnwind_Phase2() can hit the same issue as it uses
uw_frame_state_for(), so we need to treat _URC_NORMAL_STOP.

libgcc/ChangeLog:
	PR libgcc/103044
	* config/rs6000/linux-unwind.h (ppc_backchain_fallback): Check if it's
	called with a null argument or at the end of the backtrace and return.
	* unwind.inc (_Unwind_ForcedUnwind_Phase2): Treat _URC_NORMAL_STOP.
2021-11-11 15:29:25 +00:00
Jakub Jelinek
75ef0353a2 rs6000, libgcc: Fix up -Wmissing-prototypes warning on rs6000/linux-unwind.h
Jonathan reported and I've verified a
In file included from ../../../libgcc/unwind-dw2.c:412:
./md-unwind-support.h:398:6: warning: no previous prototype for ‘ppc_backchain_fallback’ [-Wmissing-prototypes]
  398 | void ppc_backchain_fallback (struct _Unwind_Context *context, void *a)
      |      ^~~~~~~~~~~~~~~~~~~~~~
warning on powerpc*-linux* libgcc build.

All the other MD_* macro functions are static, so I think the following
is the right thing rather than adding a previous prototype for
ppc_backchain_fallback.

2021-11-10  Jakub Jelinek  <jakub@redhat.com>

	* config/rs6000/linux-unwind.h (ppc_back_fallback): Make it static,
	formatting fix.
2021-11-10 10:24:49 +01:00
Iain Sandoe
7a300b413a Darwin, crts: Fix a build warning.
We have a shim crt for Darwin10 that implements functionality
missing in libSystem. Provide this with a prototype to silence the
warning about this.

libgcc/ChangeLog:

	* config/darwin10-unwind-find-enc-func.c: Include libgcc_tm.h.
	* config/i386/darwin-lib.h: Declare Darwin10 crt function.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2021-11-05 20:48:05 +00:00
John David Anglin
db89d474ad Support TI mode and soft float on PA64
This change implements TI mode on PA64.  Various new patterns are
added to pa.md.  The libgcc build needed modification to build both
DI and TI routines.  We also need various softfp routines to
convert to and from TImode.

I added full softfp for the -msoft-float option.  At the moment,
this doesn't completely eliminate all use of the floating-point
co-processor.  For this, libgcc needs to be built with -msoft-mult.
The floating-point exception support also needs a soft option.

2021-11-05  John David Anglin  <danglin@gcc.gnu.org>

	PR libgomp/96661

gcc/ChangeLog:

	* config/pa/pa-modes.def: Add OImode integer type.
	* config/pa/pa.c (pa_scalar_mode_supported_p): Allow TImode
	for TARGET_64BIT.
	* config/pa/pa.h (MIN_UNITS_PER_WORD) Define to MIN_UNITS_PER_WORD
	to UNITS_PER_WORD if IN_LIBGCC2.
	* config/pa/pa.md (addti3, addvti3, subti3, subvti3, negti2,
	negvti2, ashlti3, shrpd_internal): New patterns.
	Change some multi instruction types to multi.

libgcc/ChangeLog:

	* config.host (hppa*64*-*-linux*): Revise tmake_file.
	(hppa*64*-*-hpux11*): Likewise.
	* config/pa/sfp-exceptions.c: New.
	* config/pa/sfp-machine.h: New.
	* config/pa/t-dimode: New.
	* config/pa/t-softfp-sfdftf: New.
2021-11-05 16:07:35 +00:00
John David Anglin
a1957c9755 Fix warnings building linux-atomic.c and fptr.c on hppa64-linux
The file fptr.c is specific to 32-bit hppa-linux and should not be
included in LIB2ADD on hppa64-linux.

There is a builtin type mismatch in linux-atomic.c using the type
long long unsigned int for 64-bit atomic operations on hppa64-linux.

2021-10-27  John David Anglin  <danglin@gcc.gnu.org>

libgcc/ChangeLog:

	* config.host (hppa*64*-*-linux*): Don't add pa/t-linux to
	tmake_file.
	* config/pa/linux-atomic.c: Define u8, u16 and u64 types.
	Use them in FETCH_AND_OP_2, OP_AND_FETCH_2, COMPARE_AND_SWAP_2,
	SYNC_LOCK_TEST_AND_SET_2 and SYNC_LOCK_RELEASE_1 macros.
	* config/pa/t-linux64 (LIB1ASMSRC): New define.
	(LIB1ASMFUNCS): Revise.
	(HOST_LIBGCC2_CFLAGS): Add "-DLINUX=1".
2021-10-27 18:00:36 +00:00
Stafford Horne
aa41680e48 or1k: Update FPU to specify detect tininess before rounding
This was not defined in the spec and not consistent in the
implementation causing incosistent behavior.  After review we have
updated the CPU implementations and proposed the spec be updated to
specific that FPU tininess checks check for tininess before roudning.

Architecture change draft:

	https://openrisc.io/proposals/p18-fpu-tininess

libgcc/ChangeLog:

	* config/or1k/sfp-machine.h (_FP_TININESS_AFTER_ROUNDING):
	Change to 0.
2021-10-23 05:57:16 +09:00
Raphael Moreira Zinsly
b7561b5d24 libgcc: Add a backchain fallback to _Unwind_Backtrace() on PowerPC
Without dwarf2 unwind tables available _Unwind_Backtrace() is not
able to return the full backtrace.
This patch adds a fallback function on powerpc to get the backtrace
by doing a backchain, this code was originally at glibc.

libgcc/ChangeLog:

	* config/rs6000/linux-unwind.h (struct rt_sigframe): Move it to
	outside of get_regs() in order to use it in another function, this
	is done twice: for __powerpc64__ and for !__powerpc64__.
	(struct trace_arg): New struct.
	(struct layout): New struct.
	(ppc_backchain_fallback): New function.
	* unwind.inc (_Unwind_Backtrace): Look for _URC_NORMAL_STOP code
	state and call MD_BACKCHAIN_FALLBACK.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/unwind-backchain.c: New test.
2021-10-14 20:00:44 +00:00
Ian Lance Taylor
f49e3d28be libgcc: use .init_stack for constructors if available
* config/i386/morestack.S: Use .init_array for constructor if
	available.
	* config/rs6000/morestack.S: Likewise.
	* config/s390/morestack.S: Likewise.
2021-10-07 20:24:43 -07:00
Iain Sandoe
45f775f5f8 libgcc, X86, Darwin: Export cpu_model and indicator.
These two symbols have been emitted since 4.8, but were not added
to the Darwin exports, so we have been using the ones from libgcc.a.

Added to libgcc_s now.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config/i386/libgcc-darwin.ver: Add Symbols for
	__cpu_model, __cpu_indicator_init.
2021-09-28 20:02:48 +01:00
Iain Sandoe
578b768733 libgcc, X86: Adjust guard for Mach-O code.
Existing code in the sfp-machine header has been using __MACH__
as a guard for Mach-O, where currently symbols aliases are not
supported.

__MACH__ is not a sufficient guard for this, since the define
is also emitted for HURD, at least.

Fixed by amending the guard to use __APPLE__ instead.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config/i386/sfp-machine.h: Guard Mach-O-specific code
	using __APPLE__.
2021-09-22 07:42:21 +01:00
Iain Sandoe
32731fa5b0 libgcc, Darwin: Remove unused symlinks.
These were used on older systems to equate the FAT libgcc_s
library to single-slice equivalents.  Unused for any current
system and never emitted by GCC.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config/t-slibgcc-darwin: Delete unused code.
2021-09-19 19:47:19 +01:00
Iain Sandoe
ea4e901fa3 libgcc, X86, Darwin: Handle symbols for HF cases.
This reorganises the Darwin symbol vers files to include
the generic ones at the top level; allowing for arch ports
to override (via either exclusion or inclusion as needed).

We add an X86-specific vers file containing the new HF
symbols.  Note that although Darwin does not use ELF-style
symbol versioning - the parser that produces the map can
consume it.  Using the ELF-style description will help us
know at which rev the symbols were introduced.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config/i386/t-darwin: Add in a vers file for X86-specific
	symbols.
	* config/t-darwin: Add the generic symbol maps here...
	* config/t-slibgcc-darwin: ... removing from here.
	* config/i386/libgcc-darwin.ver: New file.
2021-09-19 19:41:31 +01:00
Iain Sandoe
1297a40fb3 libgcc, X86: Exclude rules for libgcc2 __{div,mul}hc3.
We want to override the libgcc2 generic version of these functions
for X86.  First exclude the original and the add in the replacements.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config/i386/t-softfp: Exclude libgcc2 versions of __divhc3
	and __mulhc3.
2021-09-19 19:38:04 +01:00
Iain Sandoe
8738543878 Darwin, crts: Build Darwin10 unwinder shim as a library.
We have a small unwinder shim that is only used for Darwin10
(and only then in quite specific cases).  To avoid linking
this code for every executable or DSO, we can present the crt
as a convenience library (rather than a .o file).

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* config/darwin.h (LINK_COMMAND_SPEC_A): Use Darwin10
	unwinder shim as a convenience library.

libgcc/ChangeLog:

	* config.host: Use convenience library for Darwin10
	unwinder shim.
	* config/t-darwin: Build Darwin10 unwinder shim as a
	convenience library.
2021-09-19 19:35:00 +01:00
Andrew Pinski
20f3c16820 Remove m32r{,le}-*-linux* support from GCC
m32r support never made it to glibc and the support for the Linux kernel
was removed with 4.18. It does not remove much but no reason to keep
around a port which never worked or one which the support in other
projects is gone.

OK? Checked to make sure m32r-linux and m32rle-linux were rejected
when building.

contrib/ChangeLog:

	* config-list.mk: Remove m32r-linux and m32rle-linux
	from the list.

gcc/ChangeLog:

	* config.gcc: Add m32r-*-linux* and m32rle-*-linux*
	to the Unsupported targets list.
	Remove support for m32r-*-linux* and m32rle-*-linux*.
	* config/m32r/linux.h: Removed.
	* config/m32r/t-linux: Removed.

libgcc/ChangeLog:

	* config.host: Remove m32r-*-linux* and m32rle-*-linux*.
	* config/m32r/libgcc-glibc.ver: Removed.
	* config/m32r/t-linux: Removed.
2021-09-13 15:16:56 +00:00
liuhongt
6576ad5add Compile __{mul,div}hc3 into libgcc_s.so.1.
libgcc/ChangeLog:

	* config/i386/t-softfp: Compile __{mul,div}hc3 into
	libgcc_s.so.1.
2021-09-08 19:18:15 +08:00