Commit Graph

1582 Commits

Author SHA1 Message Date
GCC Administrator 3dff965cae Daily bump. 2022-05-26 00:16:30 +00: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 012310aafb libgcc: enable DFP for AArch64
DFP support on AArch64 relies on libgcc, so enable its DFP routines
for all AArch64 targets.

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

	libgcc/
	* config.host: Add t-dfprules to AArch64 targets.
2022-05-20 09:33:52 +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
Christophe Lyon afd82c104b aarch64: Enable DFP (Decimal Floating-point) (BID format)
This patch enables DFP support on aarch64, by updating config/dfp.m4
and regenerating the involved configure scripts.
We enable the BID format.

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

	config/
	* dfp.m4: Add aarch64 support.
	gcc/
	* configure: Regenerate.
	libdecnumber/
	* configure: Regenerate.
	libgcc/
	* configure: Regenerate.
2022-05-20 09:31:15 +02:00
GCC Administrator 9df4ffe493 Daily bump. 2022-05-14 00:17:19 +00: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
GCC Administrator e877898911 Daily bump. 2022-05-11 00:16:40 +00:00
Martin Liska 1bac97ad04 libgcov: use proper type for n_functions
gcov_info::n_functions type is initialized by generated
code in build_info_type:

/* n_functions */
field = build_decl (BUILTINS_LOCATION, FIELD_DECL, NULL_TREE,
		    get_gcov_unsigned_t ());

It uses gcov_unsigned_t, but the struct definition in libgcov.h uses
unsigned type. That brings troubled on 16-bit targets.

	PR gcov-profile/105535

libgcc/ChangeLog:

	* libgcov.h (struct gcov_info): Use gcov_unsigned_t for
	n_functions.

Co-Authored-By: Hans-Peter Helfert <peter-helfert@t-online.de>
2022-05-10 12:47:10 +02:00
GCC Administrator 6259d8aa73 Daily bump. 2022-05-03 00:16:25 +00:00
Martin Liska 28cfea987e libgcov: add ATTRIBUTE_UNUSED for dump_string
Mitigates the following clang warning:
libgcc/libgcov-driver.c:416:1: warning: unused function 'dump_string' [-Wunused-function]

libgcc/ChangeLog:

	* libgcov-driver.c: Add ATTRIBUTE_UNUSED.
2022-05-02 06:46:05 +02:00
GCC Administrator 6b6f53d8af Daily bump. 2022-04-29 00:16:26 +00:00
Sebastian Huber 92475ea84f gcov: Use xstrerror()
libgcc/

	* libgcov-util.c (ftw_read_file): Improve notice using xstrerror().
	(gcov_profile_merge_stream): Likewise.
2022-04-28 20:46:50 +02:00
Sebastian Huber 210e32b60b gcov-tool: Add merge-stream subcommand
gcc/

	* doc/gcov-tool.texi: Document merge-stream subcommand.
	* doc/invoke.texi (fprofile-info-section): Mention merge-stream
	subcommand of gcov-tool.
	* gcov-tool.cc (gcov_profile_merge_stream): Declare.
	(print_merge_stream_usage_message): New.
	(merge_stream_usage): Likewise.
	(do_merge_stream): Likewise.
	(print_usage): Call print_merge_stream_usage_message().
	(main): Call do_merge_stream() to execute merge-stream subcommand.

libgcc/

	* libgcov-util.c (consume_stream): New.
	(get_target_profiles_for_merge): Likewise.
	(gcov_profile_merge_stream): Likewise.
2022-04-28 20:46:50 +02:00
Sebastian Huber 1ff8d194cb gcov: Fix integer types in ftw_read_file()
libgcc/

	* libgcov-util.c (ftw_read_file): Use size_t for strlen() variables.
2022-04-28 20:46:49 +02:00
Sebastian Huber c190b0e65f gcov: Move gcov_open() to caller of read_gcda_file()
This allows to reuse read_gcda_file() to read multiple objects from a single
file.

libgcc/

	* libgcov-util.c (read_gcda_file): Do not open file.
	(ftw_read_file): Open file here.
2022-04-28 20:46:49 +02:00
Sebastian Huber 76cae6482e gcov: Move prepend to list to read_gcda_file()
This helps to reuse read_gcda_file().

libgcc/

	* libgcov-util.c (read_gcda_file): Prepend new info object to global
	list.
	(ftw_read_file): Remove list append here.
2022-04-28 20:46:49 +02:00
Sebastian Huber f9b59dd8e5 gcov: Use xstrdup()
Move duplication of filename to caller and use xstrdup() instead of custom
code.  This helps to reuse read_gcda_file() for other purposes.

libgcc/

	* libgcov-util.c (read_gcda_file): Do not duplicate filename.
	(ftw_read_file): Duplicate filename for read_gcda_file().
2022-04-28 20:46:49 +02:00
Sebastian Huber 39d80300b3 gcov: Add __gcov_filename_to_gcfn()
gcc/

	* doc/invoke.texi (fprofile-info-section): Mention
	__gcov_filename_to_gcfn().  Use "freestanding" to match with C11
	standard language.  Fix minor example code issues.
	* gcov-io.h (GCOV_FILENAME_MAGIC): Define and document.

gcc/testsuite/

	* gcc.dg/gcov-info-to-gcda.c: Test __gcov_filename_to_gcfn().

libgcc/

	* gcov.h (__gcov_info_to_gcda): Mention __gcov_filename_to_gcfn().
	(__gcov_filename_to_gcfn): Declare and document.
	* libgcov-driver.c (dump_string): New.
	(__gcov_filename_to_gcfn): Likewise.
	(__gcov_info_to_gcda): Adjust comment to match C11 standard language.
2022-04-28 20:46:49 +02:00
Sebastian Huber 68a4673fe2 gcov: Make gcov_seek() static
This function is only used by gcov_write_length() in the gcov-io.cc file.

gcc/

	* gcov-io.cc (gcov_seek): Make it static.
	* gcov-io.h (struct gcov_summary): Do not mention gcov_seek().

libgcc/

	* libgcov.h (gcov_seek): Remove define and declaration.
2022-04-28 20:46:49 +02:00
Sebastian Huber 1a6314b040 gcov: Add open mode parameter to gcov_do_dump()
gcc/

	* gcov-tool.cc (gcov_do_dump): Add mode parameter.
	(gcov_output_files): Open files for reading and writing.

libgcc/

	* libgcov-driver-system.c (gcov_exit_open_gcda_file): Add mode
	parameter.  Pass mode to gcov_open() calls.
	* libgcov-driver.c (dump_one_gcov):  Add mode parameter.  Pass mode to
	gcov_exit_open_gcda_file() call.
	(gcov_do_dump): Add mode parameter.  Pass mode to dump_one_gcov()
	calls.
	(__gcov_dump_one):  Open file for reading and writing.
2022-04-28 20:46:49 +02:00
Sebastian Huber d170ecc9fc gcov: Add mode to all gcov_open()
gcc/

	* gcov-io.cc (gcov_open): Always use the mode parameter.
	* gcov-io.h (gcov_open): Declare it unconditionally.

libgcc/

	* libgcov-driver-system.c (gcov_exit_open_gcda_file): Open file for
	reading and writing.
	* libgcov-util.c (read_gcda_file): Open file for reading.
	* libgcov.h (gcov_open): Delete declaration.
2022-04-28 20:46:49 +02:00
Sebastian Huber 336ea18ad7 gcov-tool: Allow merging of empty profile lists
The gcov_profile_merge() already had code to deal with profile information
which had no counterpart to merge with.  For profile information from files
with no associated counterpart, the profile information is simply used as is
with the weighting transformation applied.  Make sure that gcov_profile_merge()
works with an empty target profile list.  Return the merged profile list.

gcc/
	* gcov-tool.cc (gcov_profile_merge): Adjust return type.
	(profile_merge): Allow merging of directories which contain no profile
	files.

libgcc/
	* libgcov-util.c (gcov_profile_merge): Return the list of merged
	profiles.  Accept empty target and source profile lists.
2022-04-28 20:46:48 +02:00
GCC Administrator 405eda0d34 Daily bump. 2022-04-09 00:16:56 +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
GCC Administrator 9f774626c0 Daily bump. 2022-03-30 00:16:49 +00:00
chenglulu b38100eb08 LoongArch Port: Regenerate libgcc/configure.
2022-03-29  Chenghua Xu  <xuchenghua@loongson.cn>
	    Lulu Cheng  <chenglulu@loongson.cn>

libgcc/ChangeLog:

	* configure: Regenerate file.
2022-03-29 17:43:35 +08: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
GCC Administrator d7f00da1c0 Daily bump. 2022-03-20 00:16:30 +00: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
GCC Administrator 8cc4f9cd82 Daily bump. 2022-03-10 00:16:28 +00: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
GCC Administrator 8d96e14c1d Daily bump. 2022-03-05 00:16:31 +00: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
GCC Administrator 756a61851c Daily bump. 2022-02-25 00:16:20 +00:00
Xi Ruoyao 157cc4e011
libgcc: fix a warning calling find_fde_tail
The third parameter of find_fde_tail is an _Unwind_Ptr (which is an
integer type instead of a pointer), but we are passing NULL to it.  This
causes a -Wint-conversion warning.

libgcc/

	* unwind-dw2-fde-dip.c (_Unwind_Find_FDE): Call find_fde_tail
	with 0 instead of NULL.
2022-02-25 03:10:37 +08:00
Jose E. Marchesi 39be73d07b bpf: do not --enable-gcov for bpf-*-* targets
This patch changes the build machinery in order to disable the build
of GCOV (both compiler and libgcc) in bpf-*-* targets.  The reason for
this change is that BPF is (currently) too restricted in order to
support the coverage instrumentalization.

Tested in bpf-unknown-none and x86_64-linux-gnu targets.

2022-02-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

gcc/ChangeLog

	PR target/104656
	* configure.ac: --disable-gcov if targetting bpf-*.
	* configure: Regenerate.

libgcc/ChangeLog

	PR target/104656
	* configure.ac: --disable-gcov if targetting bpf-*.
	* configure: Regenerate.
2022-02-24 16:43:57 +01:00
GCC Administrator e0b8716f53 Daily bump. 2022-01-26 00:16:38 +00:00
Florian Weimer ab2a245778 libgcc: Fix _Unwind_Find_FDE for missing unwind data with glibc 2.35
_dl_find_object returns success even if no unwind information has been
found, and dlfo_eh_frame is NULL.

libgcc/ChangeLog:

	PR libgcc/104207
	* unwind-dw2-fde-dip.c (_Unwind_Find_FDE): Add NULL check.
2022-01-25 12:09:56 +01:00
GCC Administrator fc82978278 Daily bump. 2022-01-18 00:16:54 +00:00
Martin Liska cd9912b593 Manual changes for .cc renaming.
gcc/ChangeLog:

	* Makefile.in: Rename .c names to .cc.
	* config.gcc: Likewise.
	* configure: Regenerate. Likewise.
	* configure.ac: Likewise.
	* gengtype.cc (set_gc_used): Likewise.
	(source_dot_c_frul): Likewise.
	(source_dot_cc_frul): Likewise.
	(struct file_rule_st): Likewise.
	(close_output_files): Likewise.
	* config/avr/t-avr: Use CXXFLAGS_* and CXX_FOR_BUILD.

gcc/ada/ChangeLog:

	* Makefile.rtl: Rename .c names to .cc.
	* gcc-interface/Make-lang.in: Likewise.
	* gcc-interface/Makefile.in: Likewise.

libgcc/ChangeLog:

	* libgcov-driver.c: Rename .c names to .cc.

libcpp/ChangeLog:

	* Makefile.in: Rename .c names to .cc.
2022-01-17 22:12:14 +01:00
GCC Administrator 9248ee4147 Daily bump. 2022-01-16 00:16:26 +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
GCC Administrator 617db51d7e Daily bump. 2022-01-15 00:16:27 +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
GCC Administrator 7d11b64b18 Daily bump. 2022-01-05 00:16:52 +00:00