Commit graph

1746 commits

Author SHA1 Message Date
Patrick O'Neill
dcd7b2f5f7 RISC-V: Enforce Libatomic LR/SC SEQ_CST
Replace LR.aq/SC.rl pairs with the SEQ_CST LR.aqrl/SC.rl pairs
recommended by table A.6 of the ISA manual.

2023-04-27 Patrick O'Neill <patrick@rivosinc.com>

libgcc/ChangeLog:

	* config/riscv/atomic.c: Change LR.aq/SC.rl pairs into
	sequentially consistent LR.aqrl/SC.rl pairs.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
2023-05-02 13:08:03 -07:00
GCC Administrator
1fc8da95d9 Daily bump. 2023-05-02 00:17:10 +00:00
Dimitar Dimitrov
1ee457a5fe libgcc pru: Define TARGET_HAS_NO_HW_DIVIDE
This patch aligns the configuration to the actual PRU capabilities. It
also reduces the size of the affected libgcc functions.

For a real-world project using integer arithmetics the savings
are significant:

  Before:
     text    data     bss     dec     hex filename
     3688     865     544    5097    13e9 hc-sr04-range-sensor.elf

  With TARGET_HAS_NO_HW_DIVIDE defined:
     text    data     bss     dec     hex filename
     2824     865     544    4233    1089 hc-sr04-range-sensor.elf

Execution speed also appears to have improved. The moddi3 function is
now executed in half the CPU cycles.

libgcc/ChangeLog:

	* config/pru/t-pru (HOST_LIBGCC2_CFLAGS): Add
	-DTARGET_HAS_NO_HW_DIVIDE.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2023-05-01 11:08:51 +03:00
GCC Administrator
4a3dbcbdb3 Daily bump. 2023-04-27 00:16:44 +00:00
Hans-Peter Nilsson
d7f0bc0594 libgcc CRIS: Define TARGET_HAS_NO_HW_DIVIDE
With this, execution time for e.g. __moddi3 go from 59 to 40 cycles in
the "fast" case or from 290 to 200 cycles in the "slow" case (when the
!TARGET_HAS_NO_HW_DIVIDE variant calls division and modulus functions
for 32-bit SImode), as exposed by gcc.c-torture/execute/arith-rand-ll.c
compiled for -march=v10.

Unfortunately, it just puts a performance improvement "dent" of 0.07%
in a arith-rand-ll.c-based performance test - where all loops are also
reduced to 1/10.

The size of every affected libgcc function is reduced to less than
half and they are all now leaf functions.

	* config/cris/t-cris (HOST_LIBGCC2_CFLAGS): Add
	-DTARGET_HAS_NO_HW_DIVIDE.
2023-04-27 02:00:33 +02:00
Patrick O'Neill
f797260ada RISCV: Inline subword atomic ops
RISC-V has no support for subword atomic operations; code currently
generates libatomic library calls.

This patch changes the default behavior to inline subword atomic calls
(using the same logic as the existing library call).
Behavior can be specified using the -minline-atomics and
-mno-inline-atomics command line flags.

gcc/libgcc/config/riscv/atomic.c has the same logic implemented in asm.
This will need to stay for backwards compatibility and the
-mno-inline-atomics flag.

2023-04-18 Patrick O'Neill <patrick@rivosinc.com>

gcc/ChangeLog:
	PR target/104338
	* config/riscv/riscv-protos.h: Add helper function stubs.
	* config/riscv/riscv.cc: Add helper functions for subword masking.
	* config/riscv/riscv.opt: Add command-line flag.
	* config/riscv/sync.md: Add masking logic and inline asm for fetch_and_op,
	fetch_and_nand, CAS, and exchange ops.
	* doc/invoke.texi: Add blurb regarding command-line flag.

libgcc/ChangeLog:
	PR target/104338
	* config/riscv/atomic.c: Add reference to duplicate logic.

gcc/testsuite/ChangeLog:
	PR target/104338
	* gcc.target/riscv/inline-atomics-1.c: New test.
	* gcc.target/riscv/inline-atomics-2.c: New test.
	* gcc.target/riscv/inline-atomics-3.c: New test.
	* gcc.target/riscv/inline-atomics-4.c: New test.
	* gcc.target/riscv/inline-atomics-5.c: New test.
	* gcc.target/riscv/inline-atomics-6.c: New test.
	* gcc.target/riscv/inline-atomics-7.c: New test.
	* gcc.target/riscv/inline-atomics-8.c: New test.

Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-04-26 09:53:12 -07:00
GCC Administrator
0f04ebb494 Daily bump. 2023-04-09 00:16:37 +00:00
Tetsuma Hoshino
79fb2de020 PR target/109402: v850 (not v850e) variant of __muldi3() moves sp in reversed direction [PR109402]
muldi3 will deallocate stack space after the call to __save_r26_r31,
then re-allocate the space a short while later.  If an interrupt
occurs in that window, it can clobber items on the stack.

	PR target/109402

libgcc/
	* config/v850/lib1funcs.S (___muldi3): Remove unnecessary
	stack manipulations.
2023-04-08 08:26:00 -06:00
GCC Administrator
5229788da7 Daily bump. 2023-04-06 00:16:43 +00:00
John David Anglin
ddb0f66e6c Add assember CFI directives to millicode division and remainder routines.
The millicode division and remainder routines trap division by zero.
The unwinder needs these directives to unwind divide by zero traps.

2023-04-05  John David Anglin  <danglin@gcc.gnu.org>

libgcc/ChangeLog:

	PR target/109374
	* config/pa/milli64.S (RETURN_COLUMN): Define.
	($$divI): Add CFI directives.
	($$divU): Likewise.
	($$remI): Likewise.
	($$remU): Likewise.
2023-04-05 14:44:54 +00:00
GCC Administrator
09abeb73b8 Daily bump. 2023-03-20 00:17:08 +00:00
Stafford Horne
33fb162599 or1k: Do not clear existing FPU exceptions before updating
We should always carry the exceptions forward.  This bug was found when
working on testing glibc math tests, many tests were failing with
Overflow and Underflow flags not set.  This was traced to here.

libgcc/ChangeLog:

	* config/or1k/sfp-machine.h (FP_HANDLE_EXCEPTIONS): Remove
	statement clearing existing exceptions.
2023-03-19 15:41:22 +09:00
GCC Administrator
a9835599fd Daily bump. 2023-03-14 00:17:05 +00:00
Max Filippov
6360bf9a2d xtensa: add .note.GNU-stack section on linux
gcc/
	* config/xtensa/linux.h (TARGET_ASM_FILE_END): New macro.

libgcc/
	* config/xtensa/crti.S: Add .note.GNU-stack section on linux.
	* config/xtensa/crtn.S: Likewise.
	* config/xtensa/lib1funcs.S: Likewise.
	* config/xtensa/lib2funcs.S: Likewise.
2023-03-13 13:42:18 -07:00
GCC Administrator
44ea73185a Daily bump. 2023-03-13 00:16:51 +00:00
Jakub Jelinek
13071c3c7d aarch64: Add bfloat16_t support for aarch64
x86_64/i686 has for a few months working std::bfloat16_t support, __bf16
there is no longer a storage only type, but can be used for arithmetics
and is supported in libgcc and libstdc++.

The following patch adds similar support for AArch64.

Unlike the x86 changes, this one keeps the old __bf16 mangling of
u6__bf16 rather than DF16b (so an exception from Itanium ABI), but
otherwise __bf16 and decltype (0.0bf16) are the same type and both
in C++ act as extended floating-point type.

2023-03-13  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* config/aarch64/aarch64.h (aarch64_bf16_type_node): Remove.
	(aarch64_bf16_ptr_type_node): Adjust comment.
	* config/aarch64/aarch64.cc (aarch64_gimplify_va_arg_expr): Use
	bfloat16_type_node rather than aarch64_bf16_type_node.
	(aarch64_libgcc_floating_mode_supported_p,
	aarch64_scalar_mode_supported_p): Also support BFmode.
	(aarch64_invalid_conversion, aarch64_invalid_unary_op): Remove.
	(aarch64_invalid_binary_op): Remove BFmode related rejections.
	(TARGET_INVALID_CONVERSION, TARGET_INVALID_UNARY_OP): Don't redefine.
	* config/aarch64/aarch64-builtins.cc (aarch64_bf16_type_node): Remove.
	(aarch64_int_or_fp_type): Use bfloat16_type_node rather than
	aarch64_bf16_type_node.
	(aarch64_init_simd_builtin_types): Likewise.
	(aarch64_init_bf16_types): Likewise.  Don't create bfloat16_type_node,
	which is created in tree.cc already.
	* config/aarch64/aarch64-sve-builtins.def (svbfloat16_t): Likewise.
gcc/testsuite/
	* gcc.target/aarch64/sve/acle/general-c/ternary_bfloat16_opt_n_1.c:
	Don't expect one __bf16 related error.
	* gcc.target/aarch64/bfloat16_vector_typecheck_1.c: Adjust or remove
	dg-error directives for __bf16 being an extended arithmetic type.
	* gcc.target/aarch64/bfloat16_vector_typecheck_2.c: Likewise.
	* gcc.target/aarch64/bfloat16_scalar_typecheck.c: Likewise.
	* g++.target/aarch64/bfloat_cpp_typecheck.C: Don't expect two __bf16
	related errors.
libgcc/
	* config/aarch64/t-softfp (softfp_extensions): Add bfsf.
	(softfp_truncations): Add tfbf dfbf sfbf hfbf.
	(softfp_extras): Add floatdibf floatundibf floattibf floatuntibf.
	* config/aarch64/libgcc-softfp.ver (GCC_13.0.0): Export
	__extendbfsf2 and __trunc{s,d,t,h}fbf2.
	* config/aarch64/sfp-machine.h (_FP_NANFRAC_B, _FP_NANSIGN_B): Define.
	* soft-fp/floatundibf.c: New file.
	* soft-fp/floatdibf.c: New file.
libstdc++-v3/
	* config/abi/pre/gnu.ver (CXXABI_1.3.14): Also export __bf16 tinfos
	if it isn't mangled as DF16b but u6__bf16.
2023-03-13 00:16:45 +01:00
GCC Administrator
c80654412b Daily bump. 2023-03-11 00:16:36 +00:00
Jakub Jelinek
246127ab23 libgcc, i386: Add __fix{,uns}bfti and __float{,un}tibf [PR107703]
While DI <-> BF conversions can be handled (and are) through
DI <-> XF <-> BF and for narrower integral modes even sometimes
through DF or SF, because XFmode has 64-bit mantissa and so all
the DImode values are exactly representable in XFmode.
That is not the case for TImode, and while e.g. the HF -> TI
conversions are IMHO useless in libgcc, because HFmode has
-65504.0f16, 65504.0f16 range, all the integers will be already
representable in SImode (or even HImode for unsigned) and so
I think HF -> DI -> TI conversions are faster and valid,
BFmode has roughly the same range as SFmode and so we absolutely need
the TI -> BF conversions to avoid double rounding.

As for BF -> TI conversions, they can be either also implemented
in libgcc, or they can be implemented (as done in this commit)
as BF -> SF -> TI conversions with the same code generation used
elsewhere, just doing the 16-bit left shift of the bits - I think
we don't need to handle sNaNs during the BF -> SF part because
SF -> TI (which is already a libcall too) will handle that too.

The BF -> SF -> TI path avoids wasting
    32: 0000000000015e10   321 FUNC    GLOBAL DEFAULT   13 __fixbfti@@GCC_13.0.0
    89: 0000000000015f60   299 FUNC    GLOBAL DEFAULT   13 __fixunsbfti@@GCC_13.0.0

2023-03-10  Jakub Jelinek  <jakub@redhat.com>

	PR target/107703
	* optabs.cc (expand_fix): For conversions from BFmode to integral,
	use shifts to convert it to SFmode first and then convert SFmode
	to integral.

	* soft-fp/floattibf.c: New file.
	* soft-fp/floatuntibf.c: New file.
	* config/i386/libgcc-glibc.ver: Export __float{,un}tibf @ GCC_13.0.0.
	* config/i386/64/t-softfp (softfp_extras): Add floattibf and
	floatuntibf.
	(CFLAGS-floattibf.c, CFLAGS-floatunstibf.c): Add -msse2.
2023-03-10 20:39:54 +01:00
GCC Administrator
6a87fdd3ed Daily bump. 2023-03-09 00:17:00 +00:00
Kewen Lin
15b83b69ca libgcc, rs6000: Fix bump size for powerpc64 elfv1 ABI [PR108727]
As PR108727 shows, when cleanup code called by the stack
unwinder calls function _Unwind_Resume, it goes via plt
stub like:

   function 00000000.plt_call._Unwind_Resume:

=> 0x0000000010003580 <+0>:     std     r2,40(r1)
   0x0000000010003584 <+4>:     ld      r12,-31760(r2)
   0x0000000010003588 <+8>:     mtctr   r12
   0x000000001000358c <+12>:    ld      r2,-31752(r2)
   0x0000000010003590 <+16>:    cmpldi  r2,0
   0x0000000010003594 <+20>:    bnectr+
   0x0000000010003598 <+24>:    b       0x100031a4
                                        <_Unwind_Resume@plt>

It wants to save TOC base (r2) to r1 + 40, but we only
bump the stack segment by 32 bytes as follows:

   stdu %r29,-32(%r3)

It means the access is out of the stack segment allocated
by __generic_morestack, once the touch area isn't writable
like this failure shows, it would cause segment fault.

So fix the bump size with one reasonable value PARAMS.

	PR libgcc/108727

libgcc/ChangeLog:

	* config/rs6000/morestack.S (__morestack): Use PARAMS for new stack
	bump size.
2023-03-08 00:57:21 -06:00
GCC Administrator
3dd4ada437 Daily bump. 2023-03-07 00:16:44 +00:00
Michael Meissner
306c7b1ac3 PR target/107299: Fix build issue when long double is IEEE 128-bit
This patch updates the IEEE 128-bit types used in libgcc.

At the moment, we cannot build GCC when the target uses IEEE 128-bit long
doubles, such as building the compiler for a native Fedora 36 system.  The
build dies when it is trying to build the _mulkc3.c and _divkc3 modules.

This patch changes libgcc to use long double for the IEEE 128-bit base type if
long double is IEEE 128-bit, and it uses _Float128 otherwise.  The built-in
functions are adjusted to be the correct version based on the IEEE 128-bit base
type used.

While it is desirable to ultimately have __float128 and _Float128 use the same
internal type and mode within GCC, at present if you use the option
-mabi=ieeelongdouble, the __float128 type will use the long double type and not
the _Float128 type.  We get an internal compiler error if we combine the
signbitf128 built-in with a long double type.

I've gone through several iterations of trying to fix this within GCC, and
there are various problems that have come up.  I developed this alternative
patch that changes libgcc so that it does not tickle the issue.  I hope we can
fix the compiler at some point, but right now, this is preventing people on
Fedora 36 systems from building compilers where the default long double is IEEE
128-bit.

2023-03-06   Michael Meissner  <meissner@linux.ibm.com>

libgcc/

	PR target/107299
	* config/rs6000/_divkc3.c (COPYSIGN): Use the correct built-in based on
	whether long double is IBM or IEEE.
	(INFINITY): Likewise.
	(FABS): Likewise.
	* config/rs6000/_mulkc3.c (COPYSIGN): Likewise.
	(INFINITY): Likewise.
	* config/rs6000/quad-float128.h (TF): Remove definition.
	(TFtype): Define to be long double or _Float128.
	(TCtype): Define to be _Complex long double or _Complex _Float128.
	* libgcc2.h (TFtype): Allow machine config files to override this.
	(TCtype): Likewise.
	* soft-fp/quad.h (TFtype): Likewise.
2023-03-06 17:38:33 -05:00
GCC Administrator
ae7197818d Daily bump. 2023-02-14 00:17:33 +00:00
Kito Cheng
89367e7946 RISC-V: Handle vlenb correctly in unwinding
gcc/ChangeLog:

	* config/riscv/riscv.h (RISCV_DWARF_VLENB): New.
	(DWARF_FRAME_REGISTERS): New.
	(DWARF_REG_TO_UNWIND_COLUMN): New.

libgcc/ChangeLog:

	* config.host (riscv*-*-*): Add config/riscv/value-unwind.h.
	* config/riscv/value-unwind.h: New.
2023-02-13 10:40:46 +08:00
GCC Administrator
49e52115b0 Daily bump. 2023-02-04 00:16:24 +00:00
Christophe Lyon
3dba5b2cf2 arm: Fix warning in libgcc/config/arm/pr-support.c
I have noticed some warnings when building GCC for arm-eabi:
pr-support.c:110:7: warning: variable ‘set_pac_sp’ set but not used [-Wunused-but-set-variable]
pr-support.c:109:7: warning: variable ‘set_pac’ set but not used [-Wunused-but-set-variable]

This small patch avoids them by defining these two variables undef
TARGET_HAVE_PACBTI, like the code which actually uses them.

	libgcc/
	* config/arm/pr-support.c (__gnu_unwind_execute): Use
	TARGET_HAVE_PACBTI to define set_pac and set_pac_sp.
2023-02-03 16:40:42 +01:00
GCC Administrator
897a050205 Daily bump. 2023-01-31 00:18:44 +00:00
Flavio Cruz
5f8950b403 Add support for x86_64-*-gnu-* targets to build x86_64 gnumach/hurd
Tested by building a toolchain and compiling gnumach for x86_64 [1].
This is the basic version without unwind support which I think is only
required to implement exceptions.

[1]
https://github.com/flavioc/cross-hurd/blob/master/bootstrap-kernel.sh.

gcc/ChangeLog:
	* config.gcc: Recognize x86_64-*-gnu* targets and include
	i386/gnu64.h.
	* config/i386/gnu64.h: Define configuration for new target
	including ld.so location.

libgcc/ChangeLog:
	* config.host: Recognize x86_64-*-gnu* targets.
	* config/i386/gnu-unwind.h: Update to handle __x86_64__ with a
	TODO for now.

Signed-off-by: Flavio Cruz <flaviocruz@gmail.com>
2023-01-30 16:34:48 +01:00
GCC Administrator
607f278a35 Daily bump. 2023-01-24 00:17:23 +00:00
Srinath Parvathaneni
55a2d8096a arm: Add support for new frame unwinding instruction "0xb5".
This patch adds support for Arm frame unwinding instruction "0xb5" [1]. When
an exception is taken and "0xb5" instruction is encounter during runtime
stack-unwinding, we use effective vsp as modifier in pointer authentication.
On completion of stack unwinding if "0xb5" instruction is not encountered
then CFA will be used as modifier in pointer authentication.

[1] https://github.com/ARM-software/abi-aa/releases/download/2022Q3/ehabi32.pdf

libgcc/ChangeLog:

2022-11-09  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

	* config/arm/pr-support.c (__gnu_unwind_execute): Decode opcode
	"0xb5".
2023-01-23 11:16:26 +00:00
Andrea Corallo
7161afc778 [PATCH 6/15] arm: Add pointer authentication for stack-unwinding runtime
This patch adds authentication for when the stack is unwound when an
exception is taken.  All the changes here are done to the runtime code
in libgcc's unwinder code for Arm target. All the changes are guarded
under defined (__ARM_FEATURE_PAC_DEFAULT) and activated only if the
+pacbti feature is switched on for the architecture. This means that
switching on the target feature via -march or -mcpu is sufficient and
-mbranch-protection need not be enabled. This ensures that the
unwinder is authenticated only if the PACBTI instructions are
available in the non-NOP space as it uses AUTG.  Just generating
PAC/AUT instructions using -mbranch-protection will not enable
authentication on the unwinder.

Pre-approved with the requested changes here
<https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586555.html>.

gcc/ChangeLog:

	* ginclude/unwind-arm-common.h (_Unwind_VRS_RegClass): Introduce
	new pseudo register class _UVRSC_PAC.

libgcc/ChangeLog:
	* config/arm/pr-support.c (__gnu_unwind_execute): Decode
	exception opcode (0xb4) for saving RA_AUTH_CODE and authenticate
	with AUTG if found.
	* config/arm/unwind-arm.c (struct pseudo_regs): New.
	(phase1_vrs): Introduce new field to store pseudo-reg state.
	(phase2_vrs): Likewise.
	(_Unwind_VRS_Get): Load pseudo register state from virtual reg set.
	(_Unwind_VRS_Set): Store pseudo register state to virtual reg set.
	(_Unwind_VRS_Pop): Load pseudo register value from stack into VRS.

Co-Authored-By: Tejas Belagod  <tbelagod@arm.com>
Co-Authored-By: Srinath Parvathaneni <srinath.parvathaneni@arm.com>
2023-01-23 11:28:11 +01:00
GCC Administrator
9f98cfa51b Daily bump. 2023-01-19 00:17:35 +00:00
Wilco Dijkstra
c98cd1df22 libgcc: Fix uninitialized RA signing on AArch64 [PR107678]
A recent change only initializes the regs.how[] during Dwarf unwinding
which resulted in an uninitialized offset used in return address signing
and random failures during unwinding.  The fix is to encode the return
address signing state in REG_UNSAVED and a new state REG_UNSAVED_ARCHEXT.

libgcc/
	PR target/107678
	* unwind-dw2.h (REG_UNSAVED_ARCHEXT): Add new enum.
	* unwind-dw2.c (uw_update_context_1): Add REG_UNSAVED_ARCHEXT case.
	* unwind-dw2-execute_cfa.h: Use REG_UNSAVED_ARCHEXT/REG_UNSAVED to
	encode the return address signing state.
	* config/aarch64/aarch64-unwind.h (aarch64_demangle_return_addr)
	Check current return address signing state.
	(aarch64_frob_update_contex): Remove.
2023-01-18 12:20:35 +00:00
Jakub Jelinek
83ffe9cde7 Update copyright years. 2023-01-16 11:52:17 +01:00
GCC Administrator
5013c3bb3e Daily bump. 2023-01-15 00:17:49 +00:00
John David Anglin
cf467fb93b Fix support for atomic loads and stores on hppa.
This change updates the atomic libcall support to fix the following
issues:

1) A internal compiler error with -fno-sync-libcalls.
2) When sync libcalls are disabled, we don't generate libcalls for
   libatomic.
3) There is no sync libcall support for targets other than linux.
   As a result, non-atomic stores are silently emitted for types
   smaller or equal to the word size.  There are now a few atomic
   libcalls in the libgcc code, so we need sync support on all
   targets.

2023-01-13  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

	* config/pa/pa-linux.h (TARGET_SYNC_LIBCALL): Delete define.
	* config/pa/pa.cc (pa_init_libfuncs): Use MAX_SYNC_LIBFUNC_SIZE
	define.
	* config/pa/pa.h (TARGET_SYNC_LIBCALLS): Use flag_sync_libcalls.
	(MAX_SYNC_LIBFUNC_SIZE): Define.
	(TARGET_CPU_CPP_BUILTINS): Define __SOFTFP__ when soft float is
	enabled.
	* config/pa/pa.md (atomic_storeqi): Emit __atomic_exchange_1
	libcall when sync libcalls are disabled.
	(atomic_storehi, atomic_storesi, atomic_storedi): Likewise.
	(atomic_loaddi): Emit __atomic_load_8 libcall when sync libcalls
	are disabled on 32-bit target.
	* config/pa/pa.opt (matomic-libcalls): New option.
	* doc/invoke.texi (HPPA Options): Update.

libgcc/ChangeLog:

	* config.host (hppa*64*-*-linux*): Adjust tmake_file to use
	pa/t-pa64-linux.
	(hppa*64*-*-hpux11*): Adjust tmake_file to use pa/t-pa64-hpux
	instead of pa/t-hpux and pa/t-pa64.
	* config/pa/linux-atomic.c: Define u32 type.
	(ATOMIC_LOAD): Define new macro to implement atomic_load_1,
	atomic_load_2, atomic_load_4 and atomic_load_8.  Update sync
	defines to use atomic_load calls for type.
	(SYNC_LOCK_LOAD_2): New macro to implement __sync_lock_load_8.
	* config/pa/sync-libfuncs.c: New file.
	* config/pa/t-netbsd (LIB2ADD_ST): Define.
	* config/pa/t-openbsd (LIB2ADD_ST): Define.
	* config/pa/t-pa64-hpux: New file.
	* config/pa/t-pa64-linux: New file.
2023-01-13 19:24:15 +00:00
Jonathan Wakely
e2fc12a5da libstdc++: Fix unintended layout change to std::basic_filebuf [PR108331]
GCC 13 has a new implementation of gthr-win32.h which supports C++11
mutexes, threads etc. but this causes an unintended ABI break. The
__gthread_mutex_t type is always used in std::basic_filebuf even in
C++98, so independent of whether C++11 sync primitives work or not.
Because that type changed for the win32 thread model, we have a layout
change in std::basic_filebuf. The member is completely unused, it just
gets passed to the std::__basic_file constructor and ignored. So we
don't need that mutex to actually work, we just need its layout to not
change.

Introduce a new __gthr_win32_legacy_mutex_t struct in gthr-win32.h with
the old layout, and conditionally use that in std::basic_filebuf.

	PR libstdc++/108331

libgcc/ChangeLog:

	* config/i386/gthr-win32.h (__gthr_win32_legacy_mutex_t): New
	struct matching the previous __gthread_mutex_t struct.
	(__GTHREAD_LEGACY_MUTEX_T): Define.

libstdc++-v3/ChangeLog:

	* config/io/c_io_stdio.h (__c_lock): Define as a typedef for
	__GTHREAD_LEGACY_MUTEX_T if defined.
2023-01-13 13:34:20 +00:00
Seija Kijin
57d104ab0f arm: unified syntax for libgcc clear_cache
The patch to convert all thumb1 code in libgcc to unified syntax
omitted changing all swi instructions to the current name: svc.

libgcc/ChangeLog:

	* config/arm/lib1funcs.S (clear_cache): Use SVC to conform to
	unified syntax.
2023-01-13 13:04:04 +00:00
GCC Administrator
d901bf8a44 Daily bump. 2023-01-08 00:16:59 +00:00
LIU Hao
902c755930 Always define WIN32_LEAN_AND_MEAN before <windows.h>
Recently, mingw-w64 has got updated <msxml.h> from Wine which is included
indirectly by <windows.h> if `WIN32_LEAN_AND_MEAN` is not defined. The
`IXMLDOMDocument` class has a member function named `abort()`, which gets
affected by our `abort()` macro in "system.h".

`WIN32_LEAN_AND_MEAN` should, nevertheless, always be defined. This
can exclude 'APIs such as Cryptography, DDE, RPC, Shell, and Windows
Sockets' [1], and speed up compilation of these files a bit.

[1] https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers

gcc/

	PR middle-end/108300
	* config/xtensa/xtensa-dynconfig.c: Define `WIN32_LEAN_AND_MEAN`
	before <windows.h>.
	* diagnostic-color.cc: Likewise.
	* plugin.cc: Likewise.
	* prefix.cc: Likewise.

gcc/ada/

	PR middle-end/108300
	* adaint.c: Define `WIN32_LEAN_AND_MEAN` before `#include
	<windows.h>`.
	* cio.c: Likewise.
	* ctrl_c.c: Likewise.
	* expect.c: Likewise.
	* gsocket.h: Likewise.
	* mingw32.h: Likewise.
	* mkdir.c: Likewise.
	* rtfinal.c: Likewise.
	* rtinit.c: Likewise.
	* seh_init.c: Likewise.
	* sysdep.c: Likewise.
	* terminals.c: Likewise.
	* tracebak.c: Likewise.

gcc/jit/

	PR middle-end/108300
	* jit-w32.h: Define `WIN32_LEAN_AND_MEAN` before <windows.h>.

libatomic/

	PR middle-end/108300
	* config/mingw/lock.c: Define `WIN32_LEAN_AND_MEAN` before
	<windows.h>.

libffi/

	PR middle-end/108300
	* src/aarch64/ffi.c: Define `WIN32_LEAN_AND_MEAN` before
	<windows.h>.

libgcc/

	PR middle-end/108300
	* config/i386/enable-execute-stack-mingw32.c: Define
	`WIN32_LEAN_AND_MEAN` before <windows.h>.
	* libgcc2.c: Likewise.
	* unwind-generic.h: Likewise.

libgfortran/

	PR middle-end/108300
	* intrinsics/sleep.c: Define `WIN32_LEAN_AND_MEAN` before
	<windows.h>.

libgomp/

	PR middle-end/108300
	* config/mingw32/proc.c: Define `WIN32_LEAN_AND_MEAN` before
	<windows.h>.

libiberty/

	PR middle-end/108300
	* make-temp-file.c: Define `WIN32_LEAN_AND_MEAN` before <windows.h>.
	* pex-win32.c: Likewise.

libssp/

	PR middle-end/108300
	* ssp.c: Define `WIN32_LEAN_AND_MEAN` before <windows.h>.

libstdc++-v3/

	PR middle-end/108300
	* src/c++11/system_error.cc: Define `WIN32_LEAN_AND_MEAN` before
	<windows.h>.
	* src/c++11/thread.cc: Likewise.
	* src/c++17/fs_ops.cc: Likewise.
	* src/filesystem/ops.cc: Likewise.

libvtv/

	PR middle-end/108300
	* vtv_malloc.cc: Define `WIN32_LEAN_AND_MEAN` before <windows.h>.
	* vtv_rts.cc: Likewise.
	* vtv_utils.cc: Likewise.
2023-01-07 06:51:06 +00:00
GCC Administrator
0f8fbb57a8 Daily bump. 2023-01-04 00:17:22 +00:00
Florian Weimer
8fdef16cd5 libgcc: Specialize execute_cfa_program in DWARF unwinder for alignments [redo]
The parameters fs->data_align and fs->code_align always have fixed
values for a particular target in GCC-generated code.  Specialize
execute_cfa_program for these values, to avoid multiplications.

gcc/c-family/

	* c-cppbuiltin.cc (c_cpp_builtins): Define
	__LIBGCC_DWARF_CIE_DATA_ALIGNMENT__.

libgcc/

	* unwind-dw2-execute_cfa.h: New file.  Extracted from
	the execute_cfa_program function in unwind-dw2.c.
	* unwind-dw2.c (execute_cfa_program_generic): New function.
	(execute_cfa_program_specialized): Likewise.
	(execute_cfa_program): Call execute_cfa_program_specialized
	or execute_cfa_program_generic, as appropriate.
2023-01-03 16:47:32 +01:00
Florian Weimer
d010efbfb8 Revert "Define __LIBGCC_DWARF_REG_SIZES_CONSTANT__ if DWARF register size is constant"
This reverts commit 97bbdb726a.
2023-01-03 16:47:31 +01:00
Florian Weimer
96127a4100 Revert "libgcc: Specialize execute_cfa_program in DWARF unwinder for alignments"
This reverts commit cb775ecd6e.
2023-01-03 16:47:31 +01:00
GCC Administrator
fee53a3194 Daily bump. 2023-01-03 00:17:09 +00:00
Florian Weimer
cb775ecd6e libgcc: Specialize execute_cfa_program in DWARF unwinder for alignments
The parameters fs->data_align and fs->code_align always have fixed
values for a particular target in GCC-generated code.  Specialize
execute_cfa_program for these values, to avoid multiplications.

gcc/c-family/

	* c-cppbuiltin.cc (c_cpp_builtins): Define
	__LIBGCC_DWARF_CIE_DATA_ALIGNMENT__.

libgcc/

	* unwind-dw2-execute_cfa.h: New file.  Extracted from
	the execute_cfa_program function in unwind-dw2.c.
	* unwind-dw2.c (execute_cfa_program_generic): New function.
	(execute_cfa_program_specialized): Likewise.
	(execute_cfa_program): Call execute_cfa_program_specialized
	or execute_cfa_program_generic, as appropriate.
2023-01-02 16:18:02 +01:00
Florian Weimer
97bbdb726a Define __LIBGCC_DWARF_REG_SIZES_CONSTANT__ if DWARF register size is constant
And use that to speed up the libgcc unwinder.

gcc/

	* debug.h (dwarf_reg_sizes_constant): Declare.
	* dwarf2cfi.cc (dwarf_reg_sizes_constant): New function.

gcc/c-family/

	* c-cppbuiltin.cc (__LIBGCC_DWARF_REG_SIZES_CONSTANT__):
	Define if constant is known.

libgcc/

	* unwind-dw2.c (dwarf_reg_size): New function.
	(_Unwind_GetGR, _Unwind_SetGR, _Unwind_SetGRPtr)
	(_Unwind_SetSpColumn, uw_install_context_1): Use it.
	(uw_init_context_1): Do not initialize dwarf_reg_size_table
	if not in use.
2023-01-02 16:18:02 +01:00
Jakub Jelinek
68127a8e87 Update Copyright year in ChangeLog files
2022 -> 2023
2023-01-02 09:23:36 +01:00
GCC Administrator
bc38aee755 Daily bump. 2022-12-26 00:16:27 +00:00
Jonathan Yong
339db340af libgcc: fix gfortran build on Windows
Broken by 9149a5b7e0.
CC_NONE is defined by wingdi.h and conflicting with gcc.
Committed as obvious.

libgcc/:

	* config/i386/gthr-win32.h: undef CC_NONE

Signed-off-by: Jonathan Yong <10walls@gmail.com>
2022-12-25 01:09:15 +00:00