aboutsummaryrefslogtreecommitdiff
path: root/libgcc/config
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-09-13 10:37:49 -0700
committerIan Lance Taylor <iant@golang.org>2021-09-13 10:37:49 -0700
commite252b51ccde010cbd2a146485d8045103cd99533 (patch)
treee060f101cdc32bf5e520de8e5275db9d4236b74c /libgcc/config
parentf10c7c4596dda99d2ee872c995ae4aeda65adbdf (diff)
parent104c05c5284b7822d770ee51a7d91946c7e56d50 (diff)
downloadgcc-e252b51ccde010cbd2a146485d8045103cd99533.zip
gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.gz
gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.bz2
Merge from trunk revision 104c05c5284b7822d770ee51a7d91946c7e56d50.
Diffstat (limited to 'libgcc/config')
-rw-r--r--libgcc/config/aarch64/value-unwind.h4
-rw-r--r--libgcc/config/arm/cmse_nonsecure_call.S9
-rw-r--r--libgcc/config/arm/t-arm5
-rw-r--r--libgcc/config/frv/frv-abi.h4
-rw-r--r--libgcc/config/gcn/lib2-bswapti2.c47
-rw-r--r--libgcc/config/gcn/lib2-divmod-di.c35
-rw-r--r--libgcc/config/gcn/lib2-divmod.c8
-rw-r--r--libgcc/config/gcn/lib2-gcn.h12
-rw-r--r--libgcc/config/gcn/t-amdgcn2
-rw-r--r--libgcc/config/i386/32/sfp-machine.h1
-rw-r--r--libgcc/config/i386/64/sfp-machine.h1
-rw-r--r--libgcc/config/i386/64/t-softfp6
-rw-r--r--libgcc/config/i386/_divhc3.c4
-rw-r--r--libgcc/config/i386/_mulhc3.c4
-rw-r--r--libgcc/config/i386/cygming-crtend.c6
-rw-r--r--libgcc/config/i386/libgcc-glibc.ver20
-rw-r--r--libgcc/config/i386/sfp-machine.h21
-rw-r--r--libgcc/config/i386/t-softfp24
-rw-r--r--libgcc/config/i386/value-unwind.h4
-rw-r--r--libgcc/config/m32r/libgcc-glibc.ver48
-rw-r--r--libgcc/config/m32r/t-linux5
-rw-r--r--libgcc/config/or1k/t-crtstuff2
-rw-r--r--libgcc/config/pa/pa64-hpux-lib.h9
-rw-r--r--libgcc/config/pru/mpyll.S2
-rw-r--r--libgcc/config/riscv/sfp-machine.h4
-rw-r--r--libgcc/config/rs6000/_divkc3.c109
-rw-r--r--libgcc/config/rs6000/_sprintfkf.c58
-rw-r--r--libgcc/config/rs6000/_sprintfkf.h27
-rw-r--r--libgcc/config/rs6000/_strtokf.c53
-rw-r--r--libgcc/config/rs6000/_strtokf.h27
-rw-r--r--libgcc/config/rs6000/fixkfti-sw.c (renamed from libgcc/config/rs6000/fixkfti.c)4
-rw-r--r--libgcc/config/rs6000/fixunskfti-sw.c (renamed from libgcc/config/rs6000/fixunskfti.c)4
-rw-r--r--libgcc/config/rs6000/float128-ifunc.c51
-rw-r--r--libgcc/config/rs6000/float128-p10.c71
-rw-r--r--libgcc/config/rs6000/float128-sed4
-rw-r--r--libgcc/config/rs6000/float128-sed-hw4
-rw-r--r--libgcc/config/rs6000/floattikf-sw.c (renamed from libgcc/config/rs6000/floattikf.c)4
-rw-r--r--libgcc/config/rs6000/floatuntikf-sw.c (renamed from libgcc/config/rs6000/floatuntikf.c)4
-rw-r--r--libgcc/config/rs6000/ibm-ldouble.c14
-rw-r--r--libgcc/config/rs6000/morestack.S41
-rw-r--r--libgcc/config/rs6000/quad-float128.h29
-rw-r--r--libgcc/config/rs6000/t-float12830
-rw-r--r--libgcc/config/rs6000/t-float128-p10-hw24
-rw-r--r--libgcc/config/rs6000/t-linux10
-rw-r--r--libgcc/config/rs6000/tramp.S6
-rw-r--r--libgcc/config/t-slibgcc2
-rw-r--r--libgcc/config/t-slibgcc-darwin2
-rw-r--r--libgcc/config/t-slibgcc-fuchsia25
-rw-r--r--libgcc/config/t-slibgcc-vms2
49 files changed, 575 insertions, 317 deletions
diff --git a/libgcc/config/aarch64/value-unwind.h b/libgcc/config/aarch64/value-unwind.h
index 1f50a47..041ca13 100644
--- a/libgcc/config/aarch64/value-unwind.h
+++ b/libgcc/config/aarch64/value-unwind.h
@@ -13,6 +13,10 @@
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
diff --git a/libgcc/config/arm/cmse_nonsecure_call.S b/libgcc/config/arm/cmse_nonsecure_call.S
index 146f3ed..c8e0fbb 100644
--- a/libgcc/config/arm/cmse_nonsecure_call.S
+++ b/libgcc/config/arm/cmse_nonsecure_call.S
@@ -25,7 +25,7 @@
.syntax unified
#ifdef __ARM_PCS_VFP
-# if __ARM_FP & 0x8
+# if (__ARM_FP & 0x8) || (__ARM_FEATURE_MVE & 1)
.fpu fpv5-d16
# else
.fpu fpv4-sp-d16
@@ -59,7 +59,7 @@ vmov s24, s25, r5, r5
vmov s26, s27, r5, r5
vmov s28, s29, r5, r5
vmov s30, s31, r5, r5
-#elif __ARM_FP & 0x08
+#elif (__ARM_FP & 0x8) || (__ARM_FEATURE_MVE & 1)
vmov.f64 d9, d8
vmov.f64 d10, d8
vmov.f64 d11, d8
@@ -102,6 +102,11 @@ blxns r4
#ifdef __ARM_PCS_VFP
vpop.f64 {d8-d15}
#else
+/* VLLDM erratum mitigation sequence. */
+mrs r5, control
+tst r5, #8 /* CONTROL_S.SFPA */
+it ne
+.inst.w 0xeeb00a40 /* vmovne s0, s0 */
vlldm sp /* Lazy restore of d0-d16 and FPSCR. */
add sp, sp, #0x88 /* Free space used to save floating point registers. */
#endif /* __ARM_PCS_VFP */
diff --git a/libgcc/config/arm/t-arm b/libgcc/config/arm/t-arm
index 3625a25..c1553d4 100644
--- a/libgcc/config/arm/t-arm
+++ b/libgcc/config/arm/t-arm
@@ -3,18 +3,17 @@ LIB1ASMFUNCS = _thumb1_case_sqi _thumb1_case_uqi _thumb1_case_shi \
_thumb1_case_uhi _thumb1_case_si _speculation_barrier
HAVE_CMSE:=$(findstring __ARM_FEATURE_CMSE,$(shell $(gcc_compile_bare) -dM -E - </dev/null))
-HAVE_V81M:=$(findstring armv8.1-m.main,$(gcc_compile_bare))
ifeq ($(shell $(gcc_compile_bare) -E -mcmse - </dev/null >/dev/null 2>/dev/null; echo $$?),0)
CMSE_OPTS:=-mcmse
endif
ifdef HAVE_CMSE
-ifndef HAVE_V81M
+
libgcc-objects += cmse.o cmse_nonsecure_call.o
cmse.o: $(srcdir)/config/arm/cmse.c
$(gcc_compile) -c $(CMSE_OPTS) $<
+
cmse_nonsecure_call.o: $(srcdir)/config/arm/cmse_nonsecure_call.S
$(gcc_compile) -c $<
endif
-endif
diff --git a/libgcc/config/frv/frv-abi.h b/libgcc/config/frv/frv-abi.h
index 9af4ea4..0f7ed83 100644
--- a/libgcc/config/frv/frv-abi.h
+++ b/libgcc/config/frv/frv-abi.h
@@ -14,6 +14,10 @@
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
diff --git a/libgcc/config/gcn/lib2-bswapti2.c b/libgcc/config/gcn/lib2-bswapti2.c
new file mode 100644
index 0000000..c19b70b
--- /dev/null
+++ b/libgcc/config/gcn/lib2-bswapti2.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "lib2-gcn.h"
+
+UTItype
+__bswapti2 (UTItype x)
+{
+ UDItype lo, hi, outlo, outhi;
+ lo = (UDItype) x;
+ hi = (UDItype) (x >> 64);
+ outhi = (lo >> 56) & 0xff;
+ outhi |= ((lo >> 48) & 0xff) << 8;
+ outhi |= ((lo >> 40) & 0xff) << 16;
+ outhi |= ((lo >> 32) & 0xff) << 24;
+ outhi |= ((lo >> 24) & 0xff) << 32;
+ outhi |= ((lo >> 16) & 0xff) << 40;
+ outhi |= ((lo >> 8) & 0xff) << 48;
+ outhi |= (lo & 0xff) << 56;
+ outlo = (hi >> 56) & 0xff;
+ outlo |= ((hi >> 48) & 0xff) << 8;
+ outlo |= ((hi >> 40) & 0xff) << 16;
+ outlo |= ((hi >> 32) & 0xff) << 24;
+ outlo |= ((hi >> 24) & 0xff) << 32;
+ outlo |= ((hi >> 16) & 0xff) << 40;
+ outlo |= ((hi >> 8) & 0xff) << 48;
+ outlo |= (hi & 0xff) << 56;
+ return ((UTItype) outhi << 64) | outlo;
+}
diff --git a/libgcc/config/gcn/lib2-divmod-di.c b/libgcc/config/gcn/lib2-divmod-di.c
new file mode 100644
index 0000000..ceb3962
--- /dev/null
+++ b/libgcc/config/gcn/lib2-divmod-di.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+ Contributed by Mentor Graphics, Inc.
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3, or (at your option) any
+later version.
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#include "lib2-gcn.h"
+
+/* We really want DImode here: override LIBGCC2_UNITS_PER_WORD. */
+#define LIBGCC2_UNITS_PER_WORD 4
+#define TARGET_HAS_NO_HW_DIVIDE
+
+#define L_divmoddi4
+#define L_divdi3
+#define L_moddi3
+#define L_udivdi3
+#define L_umoddi3
+
+#include "libgcc2.c"
diff --git a/libgcc/config/gcn/lib2-divmod.c b/libgcc/config/gcn/lib2-divmod.c
index 0d6ca44..7c72e24 100644
--- a/libgcc/config/gcn/lib2-divmod.c
+++ b/libgcc/config/gcn/lib2-divmod.c
@@ -102,15 +102,15 @@ __modsi3 (SItype a, SItype b)
}
-SItype
-__udivsi3 (SItype a, SItype b)
+USItype
+__udivsi3 (USItype a, USItype b)
{
return udivmodsi4 (a, b, 0);
}
-SItype
-__umodsi3 (SItype a, SItype b)
+USItype
+__umodsi3 (USItype a, USItype b)
{
return udivmodsi4 (a, b, 1);
}
diff --git a/libgcc/config/gcn/lib2-gcn.h b/libgcc/config/gcn/lib2-gcn.h
index 11476c4..155cf7c 100644
--- a/libgcc/config/gcn/lib2-gcn.h
+++ b/libgcc/config/gcn/lib2-gcn.h
@@ -33,13 +33,21 @@ typedef short HItype __attribute__ ((mode (HI)));
typedef unsigned short UHItype __attribute__ ((mode (HI)));
typedef int SItype __attribute__ ((mode (SI)));
typedef unsigned int USItype __attribute__ ((mode (SI)));
+typedef int DItype __attribute__ ((mode (DI)));
+typedef unsigned int UDItype __attribute__ ((mode (DI)));
+typedef int TItype __attribute__ ((mode (TI)));
+typedef unsigned int UTItype __attribute__ ((mode (TI)));
typedef int word_type __attribute__ ((mode (__word__)));
/* Exported functions. */
+extern DItype __divdi3 (DItype, DItype);
+extern DItype __moddi3 (DItype, DItype);
+extern UDItype __udivdi3 (UDItype, UDItype);
+extern UDItype __umoddi3 (UDItype, UDItype);
extern SItype __divsi3 (SItype, SItype);
extern SItype __modsi3 (SItype, SItype);
-extern SItype __udivsi3 (SItype, SItype);
-extern SItype __umodsi3 (SItype, SItype);
+extern USItype __udivsi3 (USItype, USItype);
+extern USItype __umodsi3 (USItype, USItype);
extern HItype __divhi3 (HItype, HItype);
extern HItype __modhi3 (HItype, HItype);
extern UHItype __udivhi3 (UHItype, UHItype);
diff --git a/libgcc/config/gcn/t-amdgcn b/libgcc/config/gcn/t-amdgcn
index fe7b5fa..38bde54 100644
--- a/libgcc/config/gcn/t-amdgcn
+++ b/libgcc/config/gcn/t-amdgcn
@@ -1,6 +1,8 @@
LIB2ADD += $(srcdir)/config/gcn/atomic.c \
$(srcdir)/config/gcn/lib2-divmod.c \
$(srcdir)/config/gcn/lib2-divmod-hi.c \
+ $(srcdir)/config/gcn/lib2-divmod-di.c \
+ $(srcdir)/config/gcn/lib2-bswapti2.c \
$(srcdir)/config/gcn/unwind-gcn.c
LIB2ADDEH=
diff --git a/libgcc/config/i386/32/sfp-machine.h b/libgcc/config/i386/32/sfp-machine.h
index 1fa282d..e24cbc8 100644
--- a/libgcc/config/i386/32/sfp-machine.h
+++ b/libgcc/config/i386/32/sfp-machine.h
@@ -86,6 +86,7 @@
#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
+#define _FP_NANFRAC_H _FP_QNANBIT_H
#define _FP_NANFRAC_S _FP_QNANBIT_S
#define _FP_NANFRAC_D _FP_QNANBIT_D, 0
/* Even if XFmode is 12byte, we have to pad it to
diff --git a/libgcc/config/i386/64/sfp-machine.h b/libgcc/config/i386/64/sfp-machine.h
index 1ff94c2..e1c6166 100644
--- a/libgcc/config/i386/64/sfp-machine.h
+++ b/libgcc/config/i386/64/sfp-machine.h
@@ -13,6 +13,7 @@ typedef unsigned int UTItype __attribute__ ((mode (TI)));
#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y)
+#define _FP_NANFRAC_H _FP_QNANBIT_H
#define _FP_NANFRAC_S _FP_QNANBIT_S
#define _FP_NANFRAC_D _FP_QNANBIT_D
#define _FP_NANFRAC_E _FP_QNANBIT_E, 0
diff --git a/libgcc/config/i386/64/t-softfp b/libgcc/config/i386/64/t-softfp
new file mode 100644
index 0000000..3bec464
--- /dev/null
+++ b/libgcc/config/i386/64/t-softfp
@@ -0,0 +1,6 @@
+softfp_extras := fixhfti fixunshfti floattihf floatuntihf
+
+CFLAGS-fixhfti.c += -msse2
+CFLAGS-fixunshfti.c += -msse2
+CFLAGS-floattihf.c += -msse2
+CFLAGS-floatunstihf.c += -msse2
diff --git a/libgcc/config/i386/_divhc3.c b/libgcc/config/i386/_divhc3.c
new file mode 100644
index 0000000..4cf92aa
--- /dev/null
+++ b/libgcc/config/i386/_divhc3.c
@@ -0,0 +1,4 @@
+#ifdef __SSE2__
+#define L_divhc3
+#include "libgcc2.c"
+#endif
diff --git a/libgcc/config/i386/_mulhc3.c b/libgcc/config/i386/_mulhc3.c
new file mode 100644
index 0000000..85a8a2f
--- /dev/null
+++ b/libgcc/config/i386/_mulhc3.c
@@ -0,0 +1,4 @@
+#ifdef __SSE2__
+#define L_mulhc3
+#include "libgcc2.c"
+#endif
diff --git a/libgcc/config/i386/cygming-crtend.c b/libgcc/config/i386/cygming-crtend.c
index c7ba109..4ab6342 100644
--- a/libgcc/config/i386/cygming-crtend.c
+++ b/libgcc/config/i386/cygming-crtend.c
@@ -56,7 +56,10 @@ static EH_FRAME_SECTION_CONST int __FRAME_END__[]
extern void __gcc_register_frame (void);
extern void __gcc_deregister_frame (void);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
static void register_frame_ctor (void) __attribute__ ((constructor (0)));
+#pragma GCC diagnostic pop
static void
register_frame_ctor (void)
@@ -65,7 +68,10 @@ register_frame_ctor (void)
}
#if !DEFAULT_USE_CXA_ATEXIT
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
static void deregister_frame_dtor (void) __attribute__ ((destructor (0)));
+#pragma GCC diagnostic pop
static void
deregister_frame_dtor (void)
diff --git a/libgcc/config/i386/libgcc-glibc.ver b/libgcc/config/i386/libgcc-glibc.ver
index 06e5d37..5bed104 100644
--- a/libgcc/config/i386/libgcc-glibc.ver
+++ b/libgcc/config/i386/libgcc-glibc.ver
@@ -194,3 +194,23 @@ GCC_4.8.0 {
__cpu_indicator_init
}
%endif
+
+%inherit GCC_12.0.0 GCC_7.0.0
+GCC_12.0.0 {
+ __divhc3
+ __mulhc3
+ __eqhf2
+ __nehf2
+ __extendhfdf2
+ __extendhfsf2
+ __extendhftf2
+ __extendhfxf2
+ __fixhfti
+ __fixunshfti
+ __floattihf
+ __floatuntihf
+ __truncdfhf2
+ __truncsfhf2
+ __trunctfhf2
+ __truncxfhf2
+}
diff --git a/libgcc/config/i386/sfp-machine.h b/libgcc/config/i386/sfp-machine.h
index 8319f05..172ebc7 100644
--- a/libgcc/config/i386/sfp-machine.h
+++ b/libgcc/config/i386/sfp-machine.h
@@ -17,6 +17,7 @@ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
#define _FP_KEEPNANFRACP 1
#define _FP_QNANNEGATEDP 0
+#define _FP_NANSIGN_H 1
#define _FP_NANSIGN_S 1
#define _FP_NANSIGN_D 1
#define _FP_NANSIGN_E 1
@@ -74,10 +75,24 @@ void __sfp_handle_exceptions (int);
/* Define ALIASNAME as a strong alias for NAME. */
#if defined __MACH__
-/* Mach-O doesn't support aliasing. If these functions ever return
- anything but CMPtype we need to revisit this... */
+/* Mach-O doesn't support aliasing, so we build a secondary function for
+ the alias - we need to do a bit of a dance to find out what the type of
+ the arguments is and then apply that to the secondary function.
+ If these functions ever return anything but CMPtype we need to revisit
+ this... */
+typedef float alias_HFtype __attribute__ ((mode (HF)));
+typedef float alias_SFtype __attribute__ ((mode (SF)));
+typedef float alias_DFtype __attribute__ ((mode (DF)));
+typedef float alias_TFtype __attribute__ ((mode (TF)));
+#define ALIAS_SELECTOR \
+ CMPtype (*) (alias_HFtype, alias_HFtype): (alias_HFtype) 0, \
+ CMPtype (*) (alias_SFtype, alias_SFtype): (alias_SFtype) 0, \
+ CMPtype (*) (alias_DFtype, alias_DFtype): (alias_DFtype) 0, \
+ CMPtype (*) (alias_TFtype, alias_TFtype): (alias_TFtype) 0
#define strong_alias(name, aliasname) \
- CMPtype aliasname (TFtype a, TFtype b) { return name(a, b); }
+ CMPtype aliasname (__typeof (_Generic (name, ALIAS_SELECTOR)) a, \
+ __typeof (_Generic (name, ALIAS_SELECTOR)) b) \
+ { return name (a, b); }
#else
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
# define _strong_alias(name, aliasname) \
diff --git a/libgcc/config/i386/t-softfp b/libgcc/config/i386/t-softfp
index 685d9cf..7620cc0 100644
--- a/libgcc/config/i386/t-softfp
+++ b/libgcc/config/i386/t-softfp
@@ -1 +1,25 @@
LIB2ADD += $(srcdir)/config/i386/sfp-exceptions.c
+
+# Replace _divhc3 and _mulhc3.
+libgcc2-hf-functions = _divhc3 _mulhc3
+libgcc2-hf-extras = $(addsuffix .c, $(libgcc2-hf-functions))
+LIB2ADD += $(addprefix $(srcdir)/config/i386/, $(libgcc2-hf-extras))
+
+softfp_extensions := hfsf hfdf hftf hfxf sfdf sftf dftf xftf
+softfp_truncations := tfhf xfhf dfhf sfhf tfsf dfsf tfdf tfxf
+
+softfp_extras += eqhf2
+
+CFLAGS-extendhfsf2.c += -msse2
+CFLAGS-extendhfdf2.c += -msse2
+CFLAGS-extendhftf2.c += -msse2
+CFLAGS-extendhfxf2.c += -msse2
+
+CFLAGS-truncsfhf2.c += -msse2
+CFLAGS-truncdfhf2.c += -msse2
+CFLAGS-truncxfhf2.c += -msse2
+CFLAGS-trunctfhf2.c += -msse2
+
+CFLAGS-eqhf2.c += -msse2
+CFLAGS-_divhc3.c += -msse2
+CFLAGS-_mulhc3.c += -msse2
diff --git a/libgcc/config/i386/value-unwind.h b/libgcc/config/i386/value-unwind.h
index 66f76bb..80267ee 100644
--- a/libgcc/config/i386/value-unwind.h
+++ b/libgcc/config/i386/value-unwind.h
@@ -13,6 +13,10 @@
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
diff --git a/libgcc/config/m32r/libgcc-glibc.ver b/libgcc/config/m32r/libgcc-glibc.ver
deleted file mode 100644
index cb52aa1..0000000
--- a/libgcc/config/m32r/libgcc-glibc.ver
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (C) 2004-2021 Free Software Foundation, Inc.
-#
-# This file is part of GCC.
-#
-# GCC is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GCC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3. If not see
-# <http://www.gnu.org/licenses/>.
-
-# In order to work around the very problems that force us to now generally
-# create a libgcc.so, glibc reexported a number of routines from libgcc.a.
-# By now choosing the same version tags for these specific routines, we
-# maintain enough binary compatibility to allow future versions of glibc
-# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
-
-# Note that we cannot use the default libgcc-glibc.ver file on sh,
-# because GLIBC_2.0 does not exist on this architecture, as the first
-# ever glibc release on the platform was GLIBC_2.3.
-
-%exclude {
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
-
-%inherit GCC_3.0 GLIBC_2.3
-GLIBC_2.3 {
- __register_frame
- __register_frame_table
- __deregister_frame
- __register_frame_info
- __deregister_frame_info
- __frame_state_for
- __register_frame_info_table
-}
diff --git a/libgcc/config/m32r/t-linux b/libgcc/config/m32r/t-linux
deleted file mode 100644
index 5223b73..0000000
--- a/libgcc/config/m32r/t-linux
+++ /dev/null
@@ -1,5 +0,0 @@
-# Turn off the SDA while compiling libgcc2. There are no headers for it
-# and we want maximal upward compatibility here.
-HOST_LIBGCC2_CFLAGS += -G 0
-
-SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/m32r/libgcc-glibc.ver
diff --git a/libgcc/config/or1k/t-crtstuff b/libgcc/config/or1k/t-crtstuff
new file mode 100644
index 0000000..dcae7f3
--- /dev/null
+++ b/libgcc/config/or1k/t-crtstuff
@@ -0,0 +1,2 @@
+# Compile crtbeginS.o and crtendS.o with -mcmodel=large
+CRTSTUFF_T_CFLAGS_S += -mcmodel=large
diff --git a/libgcc/config/pa/pa64-hpux-lib.h b/libgcc/config/pa/pa64-hpux-lib.h
index 85d5826..eeab98f 100644
--- a/libgcc/config/pa/pa64-hpux-lib.h
+++ b/libgcc/config/pa/pa64-hpux-lib.h
@@ -14,8 +14,13 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3. If not see
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* We use DTOR_LIST_BEGIN to carry a bunch of hacks to allow us to use
diff --git a/libgcc/config/pru/mpyll.S b/libgcc/config/pru/mpyll.S
index 1aa12a6..cd093bb 100644
--- a/libgcc/config/pru/mpyll.S
+++ b/libgcc/config/pru/mpyll.S
@@ -29,6 +29,8 @@
#include "pru-asm.h"
+ .section .text.__pruabi_mpyll, "ax"
+
.global SYM(__pruabi_mpyll)
FUNC(__pruabi_mpyll)
SYM(__pruabi_mpyll):
diff --git a/libgcc/config/riscv/sfp-machine.h b/libgcc/config/riscv/sfp-machine.h
index db26971..8adbf4b 100644
--- a/libgcc/config/riscv/sfp-machine.h
+++ b/libgcc/config/riscv/sfp-machine.h
@@ -128,7 +128,11 @@ do { \
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
+#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
/* Define ALIASNAME as a strong alias for NAME. */
diff --git a/libgcc/config/rs6000/_divkc3.c b/libgcc/config/rs6000/_divkc3.c
index d261f40..a1d29d2 100644
--- a/libgcc/config/rs6000/_divkc3.c
+++ b/libgcc/config/rs6000/_divkc3.c
@@ -37,29 +37,122 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define __divkc3 __divkc3_sw
#endif
+#ifndef __LONG_DOUBLE_IEEE128__
+#define RBIG (__LIBGCC_KF_MAX__ / 2)
+#define RMIN (__LIBGCC_KF_MIN__)
+#define RMIN2 (__LIBGCC_KF_EPSILON__)
+#define RMINSCAL (1 / __LIBGCC_KF_EPSILON__)
+#define RMAX2 (RBIG * RMIN2)
+#else
+#define RBIG (__LIBGCC_TF_MAX__ / 2)
+#define RMIN (__LIBGCC_TF_MIN__)
+#define RMIN2 (__LIBGCC_TF_EPSILON__)
+#define RMINSCAL (1 / __LIBGCC_TF_EPSILON__)
+#define RMAX2 (RBIG * RMIN2)
+#endif
+
TCtype
__divkc3 (TFtype a, TFtype b, TFtype c, TFtype d)
{
TFtype denom, ratio, x, y;
TCtype res;
- /* ??? We can get better behavior from logarithmic scaling instead of
- the division. But that would mean starting to link libgcc against
- libm. We could implement something akin to ldexp/frexp as gcc builtins
- fairly easily... */
+ /* long double has significant potential underflow/overflow errors that
+ can be greatly reduced with a limited number of tests and adjustments.
+ */
+
+ /* Scale by max(c,d) to reduce chances of denominator overflowing. */
if (FABS (c) < FABS (d))
{
+ /* Prevent underflow when denominator is near max representable. */
+ if (FABS (d) >= RBIG)
+ {
+ a = a / 2;
+ b = b / 2;
+ c = c / 2;
+ d = d / 2;
+ }
+ /* Avoid overflow/underflow issues when c and d are small.
+ Scaling up helps avoid some underflows.
+ No new overflow possible since c&d < RMIN2. */
+ if (FABS (d) < RMIN2)
+ {
+ a = a * RMINSCAL;
+ b = b * RMINSCAL;
+ c = c * RMINSCAL;
+ d = d * RMINSCAL;
+ }
+ else
+ {
+ if (((FABS (a) < RMIN) && (FABS (b) < RMAX2) && (FABS (d) < RMAX2))
+ || ((FABS (b) < RMIN) && (FABS (a) < RMAX2)
+ && (FABS (d) < RMAX2)))
+ {
+ a = a * RMINSCAL;
+ b = b * RMINSCAL;
+ c = c * RMINSCAL;
+ d = d * RMINSCAL;
+ }
+ }
ratio = c / d;
denom = (c * ratio) + d;
- x = ((a * ratio) + b) / denom;
- y = ((b * ratio) - a) / denom;
+ /* Choose alternate order of computation if ratio is subnormal. */
+ if (FABS (ratio) > RMIN)
+ {
+ x = ((a * ratio) + b) / denom;
+ y = ((b * ratio) - a) / denom;
+ }
+ else
+ {
+ x = ((c * (a / d)) + b) / denom;
+ y = ((c * (b / d)) - a) / denom;
+ }
}
else
{
+ /* Prevent underflow when denominator is near max representable. */
+ if (FABS (c) >= RBIG)
+ {
+ a = a / 2;
+ b = b / 2;
+ c = c / 2;
+ d = d / 2;
+ }
+ /* Avoid overflow/underflow issues when both c and d are small.
+ Scaling up helps avoid some underflows.
+ No new overflow possible since both c&d are less than RMIN2. */
+ if (FABS (c) < RMIN2)
+ {
+ a = a * RMINSCAL;
+ b = b * RMINSCAL;
+ c = c * RMINSCAL;
+ d = d * RMINSCAL;
+ }
+ else
+ {
+ if (((FABS (a) < RMIN) && (FABS (b) < RMAX2) && (FABS (c) < RMAX2))
+ || ((FABS (b) < RMIN) && (FABS (a) < RMAX2)
+ && (FABS (c) < RMAX2)))
+ {
+ a = a * RMINSCAL;
+ b = b * RMINSCAL;
+ c = c * RMINSCAL;
+ d = d * RMINSCAL;
+ }
+ }
ratio = d / c;
denom = (d * ratio) + c;
- x = ((b * ratio) + a) / denom;
- y = (b - (a * ratio)) / denom;
+ /* Choose alternate order of computation if ratio is subnormal. */
+ if (FABS (ratio) > RMIN)
+ {
+ x = ((b * ratio) + a) / denom;
+ y = (b - (a * ratio)) / denom;
+ }
+ else
+ {
+ x = (a + (d * (b / c))) / denom;
+ y = (b - (d * (a / c))) / denom;
+ }
}
/* Recover infinities and zeros that computed as NaN+iNaN; the only cases
diff --git a/libgcc/config/rs6000/_sprintfkf.c b/libgcc/config/rs6000/_sprintfkf.c
deleted file mode 100644
index 2d624f1..0000000
--- a/libgcc/config/rs6000/_sprintfkf.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 3, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-/* Conversion to IEEE 128-bit floating point from string using snprintf. */
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <soft-fp.h>
-#include <quad-float128.h>
-#include <stdio.h>
-#include <_sprintfkf.h>
-
-/* This function must be built with IBM 128-bit as long double, so that we can
- access the strfroml function if do not have an IEEE 128-bit version, and if
- that is not available, use sprintf. */
-#if !defined(__LONG_DOUBLE_128__) || !defined(__LONG_DOUBLE_IBM128__)
-#error "Long double is not IBM 128-bit"
-#endif
-
-/* If the user is using GLIBC 2.32, we can use the __snprintfieee128 function.
-
- If we are linked against an earlier library, we will have fake it by
- converting the value to long double, and using sprintf to do the conversion.
- This isn't ideal, as IEEE 128-bit has more exponent range than IBM
- 128-bit. */
-
-extern int __sprintfieee128 (char *restrict, const char *restrict, ...)
- __attribute__ ((__weak__));
-
-int __sprintfkf (char *restrict string,
- const char *restrict format,
- _Float128 number)
-{
- if (__sprintfieee128)
- return __sprintfieee128 (string, format, number);
-
- return sprintf (string, format, (long double) number);
-}
diff --git a/libgcc/config/rs6000/_sprintfkf.h b/libgcc/config/rs6000/_sprintfkf.h
deleted file mode 100644
index de9d713..0000000
--- a/libgcc/config/rs6000/_sprintfkf.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 3, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-/* Declaration of the conversion function to IEEE 128-bit floating point from
- string using snprintf. */
-
-extern int __sprintfkf (char *restrict, const char *restrict, _Float128);
diff --git a/libgcc/config/rs6000/_strtokf.c b/libgcc/config/rs6000/_strtokf.c
deleted file mode 100644
index dc13534..0000000
--- a/libgcc/config/rs6000/_strtokf.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 3, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-/* Conversion to IEEE 128-bit floating point from string. */
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <soft-fp.h>
-#include <quad-float128.h>
-
-/* This function must be built with IBM 128-bit as long double, so that we can
- access the strtold function if do not have an IEEE 128-bit version. */
-#if !defined(__LONG_DOUBLE_128__) || !defined(__LONG_DOUBLE_IBM128__)
-#error "Long double is not IBM 128-bit"
-#endif
-
-/* If the user is using GLIBC 2.32, we can use the __strtoieee128 function.
-
- If we are linked against an earlier library, we will have fake it by
- converting the string to IBM 128-bit long double, and then converting that to
- __float128. This isn't ideal, as IEEE 128-bit has more exponent range than
- IBM 128-bit. */
-
-extern _Float128 __strtoieee128 (const char *, char **) __attribute__ ((__weak__));
-
-_Float128
-__strtokf (const char *string, char **endptr)
-{
- if (__strtoieee128)
- return __strtoieee128 (string, endptr);
-
- return strtold (string, endptr);
-}
diff --git a/libgcc/config/rs6000/_strtokf.h b/libgcc/config/rs6000/_strtokf.h
deleted file mode 100644
index a7ca8e0..0000000
--- a/libgcc/config/rs6000/_strtokf.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 3, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-/* Declaration of the conversion function to IEEE 128-bit floating point from
- string. */
-
-extern _Float128 __strtokf (const char *, char **);
diff --git a/libgcc/config/rs6000/fixkfti.c b/libgcc/config/rs6000/fixkfti-sw.c
index 0d965bc..cc000fc 100644
--- a/libgcc/config/rs6000/fixkfti.c
+++ b/libgcc/config/rs6000/fixkfti-sw.c
@@ -5,7 +5,7 @@
This file is part of the GNU C Library.
Contributed by Steven Munroe (munroesj@linux.vnet.ibm.com)
Code is based on the main soft-fp library written by:
- Uros Bizjak (ubizjak@gmail.com).
+ Uros Bizjak (ubizjak@gmail.com).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -35,7 +35,7 @@
#include "quad-float128.h"
TItype
-__fixkfti (TFtype a)
+__fixkfti_sw (TFtype a)
{
FP_DECL_EX;
FP_DECL_Q (A);
diff --git a/libgcc/config/rs6000/fixunskfti.c b/libgcc/config/rs6000/fixunskfti-sw.c
index f285b4e..7a04d1a 100644
--- a/libgcc/config/rs6000/fixunskfti.c
+++ b/libgcc/config/rs6000/fixunskfti-sw.c
@@ -5,7 +5,7 @@
This file is part of the GNU C Library.
Contributed by Steven Munroe (munroesj@linux.vnet.ibm.com)
Code is based on the main soft-fp library written by:
- Uros Bizjak (ubizjak@gmail.com).
+ Uros Bizjak (ubizjak@gmail.com).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -35,7 +35,7 @@
#include "quad-float128.h"
UTItype
-__fixunskfti (TFtype a)
+__fixunskfti_sw (TFtype a)
{
FP_DECL_EX;
FP_DECL_Q (A);
diff --git a/libgcc/config/rs6000/float128-ifunc.c b/libgcc/config/rs6000/float128-ifunc.c
index 8538047..ef7f731 100644
--- a/libgcc/config/rs6000/float128-ifunc.c
+++ b/libgcc/config/rs6000/float128-ifunc.c
@@ -46,14 +46,11 @@
#endif
#define SW_OR_HW(SW, HW) (__builtin_cpu_supports ("ieee128") ? HW : SW)
+#ifdef FLOAT128_HW_INSNS_ISA3_1
+#define SW_OR_HW_ISA3_1(SW, HW) (__builtin_cpu_supports ("arch_3_1") ? HW : SW)
+#endif
/* Resolvers. */
-
-/* We do not provide ifunc resolvers for __fixkfti, __fixunskfti, __floattikf,
- and __floatuntikf. There is no ISA 3.0 instruction that converts between
- 128-bit integer types and 128-bit IEEE floating point, or vice versa. So
- use the emulator functions for these conversions. */
-
static __typeof__ (__addkf3_sw) *
__addkf3_resolve (void)
{
@@ -102,6 +99,20 @@ __floatdikf_resolve (void)
return SW_OR_HW (__floatdikf_sw, __floatdikf_hw);
}
+#ifdef FLOAT128_HW_INSNS_ISA3_1
+static __typeof__ (__floattikf_sw) *
+__floattikf_resolve (void)
+{
+ return SW_OR_HW_ISA3_1 (__floattikf_sw, __floattikf_hw);
+}
+
+static __typeof__ (__floatuntikf_sw) *
+__floatuntikf_resolve (void)
+{
+ return SW_OR_HW_ISA3_1 (__floatuntikf_sw, __floatuntikf_hw);
+}
+#endif
+
static __typeof__ (__floatunsikf_sw) *
__floatunsikf_resolve (void)
{
@@ -114,6 +125,20 @@ __floatundikf_resolve (void)
return SW_OR_HW (__floatundikf_sw, __floatundikf_hw);
}
+#ifdef FLOAT128_HW_INSNS_ISA3_1
+static __typeof__ (__fixkfti_sw) *
+__fixkfti_resolve (void)
+{
+ return SW_OR_HW_ISA3_1 (__fixkfti_sw, __fixkfti_hw);
+}
+
+static __typeof__ (__fixunskfti_sw) *
+__fixunskfti_resolve (void)
+{
+ return SW_OR_HW_ISA3_1 (__fixunskfti_sw, __fixunskfti_hw);
+}
+#endif
+
static __typeof__ (__fixkfsi_sw) *
__fixkfsi_resolve (void)
{
@@ -303,6 +328,20 @@ TFtype __floatsikf (SItype_ppc)
TFtype __floatdikf (DItype_ppc)
__attribute__ ((__ifunc__ ("__floatdikf_resolve")));
+#ifdef FLOAT128_HW_INSNS_ISA3_1
+TFtype __floattikf (TItype_ppc)
+ __attribute__ ((__ifunc__ ("__floattikf_resolve")));
+
+TFtype __floatuntikf (UTItype_ppc)
+ __attribute__ ((__ifunc__ ("__floatuntikf_resolve")));
+
+TItype_ppc __fixkfti (TFtype)
+ __attribute__ ((__ifunc__ ("__fixkfti_resolve")));
+
+UTItype_ppc __fixunskfti (TFtype)
+ __attribute__ ((__ifunc__ ("__fixunskfti_resolve")));
+#endif
+
TFtype __floatunsikf (USItype_ppc)
__attribute__ ((__ifunc__ ("__floatunsikf_resolve")));
diff --git a/libgcc/config/rs6000/float128-p10.c b/libgcc/config/rs6000/float128-p10.c
new file mode 100644
index 0000000..7f5d317
--- /dev/null
+++ b/libgcc/config/rs6000/float128-p10.c
@@ -0,0 +1,71 @@
+/* Automatic switching between software and hardware IEEE 128-bit
+ ISA 3.1 floating-point emulation for PowerPC.
+
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Carl Love (cel@us.ibm.com)
+ Code is based on the main soft-fp library written by:
+ Richard Henderson (rth@cygnus.com) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ In addition to the permissions in the GNU Lesser General Public
+ License, the Free Software Foundation gives you unlimited
+ permission to link the compiled version of this file into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Note, the hardware conversion instructions for 128-bit integers are
+ supported for ISA 3.1 and later. Only compile this file with -mcpu=power10
+ or newer support. */
+
+#include <soft-fp.h>
+#include <quad-float128.h>
+
+#ifndef __FLOAT128_HARDWARE__
+#error "This module must be compiled with IEEE 128-bit hardware support"
+#endif
+
+#ifndef _ARCH_PWR10
+#error "This module must be compiled for Power 10 support"
+#endif
+
+TFtype
+__floattikf_hw (TItype_ppc a)
+{
+ return (TFtype) a;
+}
+
+TFtype
+__floatuntikf_hw (UTItype_ppc a)
+{
+ return (TFtype) a;
+}
+
+TItype_ppc
+__fixkfti_hw (TFtype a)
+{
+ return (TItype_ppc) a;
+}
+
+UTItype_ppc
+__fixunskfti_hw (TFtype a)
+{
+ return (UTItype_ppc) a;
+}
diff --git a/libgcc/config/rs6000/float128-sed b/libgcc/config/rs6000/float128-sed
index d9a089f..c0fcddb 100644
--- a/libgcc/config/rs6000/float128-sed
+++ b/libgcc/config/rs6000/float128-sed
@@ -8,6 +8,10 @@ s/__fixtfsi/__fixkfsi/g
s/__fixunstfdi/__fixunskfdi/g
s/__fixunstfsi/__fixunskfsi/g
s/__floatditf/__floatdikf/g
+s/__floattitf/__floattikf/g
+s/__floatuntitf/__floatuntikf/g
+s/__fixtfti/__fixkfti/g
+s/__fixunstfti/__fixunskfti/g
s/__floatsitf/__floatsikf/g
s/__floatunditf/__floatundikf/g
s/__floatunsitf/__floatunsikf/g
diff --git a/libgcc/config/rs6000/float128-sed-hw b/libgcc/config/rs6000/float128-sed-hw
index acf36b0..3d2bf55 100644
--- a/libgcc/config/rs6000/float128-sed-hw
+++ b/libgcc/config/rs6000/float128-sed-hw
@@ -8,6 +8,10 @@ s/__fixtfsi/__fixkfsi_sw/g
s/__fixunstfdi/__fixunskfdi_sw/g
s/__fixunstfsi/__fixunskfsi_sw/g
s/__floatditf/__floatdikf_sw/g
+s/__floattitf/__floattikf_sw/g
+s/__floatuntitf/__floatuntikf_sw/g
+s/__fixtfti/__fixkfti_sw/g
+s/__fixunstfti/__fixunskfti_sw/g
s/__floatsitf/__floatsikf_sw/g
s/__floatunditf/__floatundikf_sw/g
s/__floatunsitf/__floatunsikf_sw/g
diff --git a/libgcc/config/rs6000/floattikf.c b/libgcc/config/rs6000/floattikf-sw.c
index cc5c7ca..4e1786c 100644
--- a/libgcc/config/rs6000/floattikf.c
+++ b/libgcc/config/rs6000/floattikf-sw.c
@@ -5,7 +5,7 @@
This file is part of the GNU C Library.
Contributed by Steven Munroe (munroesj@linux.vnet.ibm.com)
Code is based on the main soft-fp library written by:
- Uros Bizjak (ubizjak@gmail.com).
+ Uros Bizjak (ubizjak@gmail.com).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -35,7 +35,7 @@
#include "quad-float128.h"
TFtype
-__floattikf (TItype i)
+__floattikf_sw (TItype i)
{
FP_DECL_EX;
FP_DECL_Q (A);
diff --git a/libgcc/config/rs6000/floatuntikf.c b/libgcc/config/rs6000/floatuntikf-sw.c
index 96f2d3b..c4b814d 100644
--- a/libgcc/config/rs6000/floatuntikf.c
+++ b/libgcc/config/rs6000/floatuntikf-sw.c
@@ -5,7 +5,7 @@
This file is part of the GNU C Library.
Contributed by Steven Munroe (munroesj@linux.vnet.ibm.com)
Code is based on the main soft-fp library written by:
- Uros Bizjak (ubizjak@gmail.com).
+ Uros Bizjak (ubizjak@gmail.com).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -35,7 +35,7 @@
#include "quad-float128.h"
TFtype
-__floatuntikf (UTItype i)
+__floatuntikf_sw (UTItype i)
{
FP_DECL_EX;
FP_DECL_Q (A);
diff --git a/libgcc/config/rs6000/ibm-ldouble.c b/libgcc/config/rs6000/ibm-ldouble.c
index 4c13453..0b385aa 100644
--- a/libgcc/config/rs6000/ibm-ldouble.c
+++ b/libgcc/config/rs6000/ibm-ldouble.c
@@ -118,8 +118,8 @@ pack_ldouble (double dh, double dl)
}
/* Add two 'IBM128_TYPE' values and return the result. */
-IBM128_TYPE
-__gcc_qadd (double a, double aa, double c, double cc)
+static inline IBM128_TYPE
+ldouble_qadd_internal (double a, double aa, double c, double cc)
{
double xh, xl, z, q, zz;
@@ -158,9 +158,15 @@ __gcc_qadd (double a, double aa, double c, double cc)
}
IBM128_TYPE
-__gcc_qsub (double a, double b, double c, double d)
+__gcc_qadd (double a, double aa, double c, double cc)
+{
+ return ldouble_qadd_internal (a, aa, c, cc);
+}
+
+IBM128_TYPE
+__gcc_qsub (double a, double aa, double c, double cc)
{
- return __gcc_qadd (a, b, -c, -d);
+ return ldouble_qadd_internal (a, aa, -c, -cc);
}
#ifdef __NO_FPRS__
diff --git a/libgcc/config/rs6000/morestack.S b/libgcc/config/rs6000/morestack.S
index 4a07de9..a2e255e 100644
--- a/libgcc/config/rs6000/morestack.S
+++ b/libgcc/config/rs6000/morestack.S
@@ -31,6 +31,7 @@
#define PARAMS 48
#endif
#define MORESTACK_FRAMESIZE (PARAMS+96)
+#define R2_SAVE -MORESTACK_FRAMESIZE+PARAMS-8
#define PARAMREG_SAVE -MORESTACK_FRAMESIZE+PARAMS+0
#define STATIC_CHAIN_SAVE -MORESTACK_FRAMESIZE+PARAMS+64
#define R29_SAVE -MORESTACK_FRAMESIZE+PARAMS+72
@@ -143,6 +144,17 @@ ENTRY0(__morestack_non_split)
# cr7 must also be preserved.
ENTRY0(__morestack)
+
+#if _CALL_ELF == 2
+# Functions with localentry bits of zero cannot make calls if those
+# calls might change r2. This is true generally, and also true for
+# __morestack with its special calling convention. When __morestack's
+# caller is non-pcrel but libgcc is pcrel, the functions called here
+# might modify r2. r2 must be preserved on exit, and also restored
+# for the call back to our caller.
+ std %r2,R2_SAVE(%r1)
+#endif
+
# Save parameter passing registers, our arguments, lr, r29
# and use r29 as a frame pointer.
std %r3,PARAMREG_SAVE+0(%r1)
@@ -161,10 +173,24 @@ ENTRY0(__morestack)
std %r12,LINKREG_SAVE(%r1)
std %r3,NEWSTACKSIZE_SAVE(%r1) # new stack size
mr %r29,%r1
+#if _CALL_ELF == 2
+ .cfi_offset %r2,R2_SAVE
+#endif
.cfi_offset %r29,R29_SAVE
.cfi_def_cfa_register %r29
stdu %r1,-MORESTACK_FRAMESIZE(%r1)
+#if _CALL_ELF == 2 && !defined __PCREL__
+# If this isn't a pcrel libgcc then the functions we call here will
+# require r2 to be valid. If __morestack is called from pcrel code r2
+# won't be valid. Set it up.
+ bcl 20,31,1f
+1:
+ mflr %r12
+ addis %r2,%r12,.TOC.-1b@ha
+ addi %r2,%r2,.TOC.-1b@l
+#endif
+
# void __morestack_block_signals (void)
bl JUMP_TARGET(__morestack_block_signals)
@@ -199,6 +225,9 @@ ENTRY0(__morestack)
# instructions after __morestack's return address.
#
ld %r12,LINKREG_SAVE(%r29)
+#if _CALL_ELF == 2
+ ld %r2,R2_SAVE(%r29)
+#endif
ld %r3,PARAMREG_SAVE+0(%r29) # restore arg regs
ld %r4,PARAMREG_SAVE+8(%r29)
ld %r5,PARAMREG_SAVE+16(%r29)
@@ -228,6 +257,15 @@ ENTRY0(__morestack)
std %r10,PARAMREG_SAVE+56(%r29)
#endif
+#if _CALL_ELF == 2 && !defined __PCREL__
+# r2 was restored for calling back into our caller. Set it up again.
+ bcl 20,31,1f
+1:
+ mflr %r12
+ addis %r2,%r12,.TOC.-1b@ha
+ addi %r2,%r2,.TOC.-1b@l
+#endif
+
bl JUMP_TARGET(__morestack_block_signals)
# void *__generic_releasestack (size_t *pavailable)
@@ -249,6 +287,9 @@ ENTRY0(__morestack)
# Restore return value regs, and return.
ld %r0,LINKREG_SAVE(%r29)
mtlr %r0
+#if _CALL_ELF == 2
+ ld %r2,R2_SAVE(%r29)
+#endif
ld %r3,PARAMREG_SAVE+0(%r29)
ld %r4,PARAMREG_SAVE+8(%r29)
ld %r5,PARAMREG_SAVE+16(%r29)
diff --git a/libgcc/config/rs6000/quad-float128.h b/libgcc/config/rs6000/quad-float128.h
index 5beb153..c7f2b77 100644
--- a/libgcc/config/rs6000/quad-float128.h
+++ b/libgcc/config/rs6000/quad-float128.h
@@ -88,19 +88,22 @@ extern USItype_ppc __fixunskfsi_sw (TFtype);
extern UDItype_ppc __fixunskfdi_sw (TFtype);
extern TFtype __floatsikf_sw (SItype_ppc);
extern TFtype __floatdikf_sw (DItype_ppc);
+#ifdef _ARCH_PPC64
+extern TFtype __floattikf_sw (TItype_ppc);
+#endif
extern TFtype __floatunsikf_sw (USItype_ppc);
extern TFtype __floatundikf_sw (UDItype_ppc);
+#ifdef _ARCH_PPC64
+extern TFtype __floatuntikf_sw (UTItype_ppc);
+extern TItype_ppc __fixkfti_sw (TFtype);
+extern UTItype_ppc __fixunskfti_sw (TFtype);
+#endif
extern IBM128_TYPE __extendkftf2_sw (TFtype);
extern TFtype __trunctfkf2_sw (IBM128_TYPE);
extern TCtype __mulkc3_sw (TFtype, TFtype, TFtype, TFtype);
extern TCtype __divkc3_sw (TFtype, TFtype, TFtype, TFtype);
#ifdef _ARCH_PPC64
-/* We do not provide ifunc resolvers for __fixkfti, __fixunskfti, __floattikf,
- and __floatuntikf. There is no ISA 3.0 instruction that converts between
- 128-bit integer types and 128-bit IEEE floating point, or vice versa. So
- use the emulator functions for these conversions. */
-
extern TItype_ppc __fixkfti (TFtype);
extern UTItype_ppc __fixunskfti (TFtype);
extern TFtype __floattikf (TItype_ppc);
@@ -131,8 +134,16 @@ extern USItype_ppc __fixunskfsi_hw (TFtype);
extern UDItype_ppc __fixunskfdi_hw (TFtype);
extern TFtype __floatsikf_hw (SItype_ppc);
extern TFtype __floatdikf_hw (DItype_ppc);
+#ifdef _ARCH_PPC64
+extern TFtype __floattikf_hw (TItype_ppc);
+#endif
extern TFtype __floatunsikf_hw (USItype_ppc);
extern TFtype __floatundikf_hw (UDItype_ppc);
+#ifdef _ARCH_PPC64
+extern TFtype __floatuntikf_hw (UTItype_ppc);
+extern TItype_ppc __fixkfti_hw (TFtype);
+extern UTItype_ppc __fixunskfti_hw (TFtype);
+#endif
extern IBM128_TYPE __extendkftf2_hw (TFtype);
extern TFtype __trunctfkf2_hw (IBM128_TYPE);
extern TCtype __mulkc3_hw (TFtype, TFtype, TFtype, TFtype);
@@ -163,8 +174,16 @@ extern USItype_ppc __fixunskfsi (TFtype);
extern UDItype_ppc __fixunskfdi (TFtype);
extern TFtype __floatsikf (SItype_ppc);
extern TFtype __floatdikf (DItype_ppc);
+#ifdef _ARCH_PPC64
+extern TFtype __floattikf (TItype_ppc);
+#endif
extern TFtype __floatunsikf (USItype_ppc);
extern TFtype __floatundikf (UDItype_ppc);
+#ifdef _ARCH_PPC64
+extern TFtype __floatuntikf (UTItype_ppc);
+extern TItype_ppc __fixkfti (TFtype);
+extern UTItype_ppc __fixunskfti (TFtype);
+#endif
extern IBM128_TYPE __extendkftf2 (TFtype);
extern TFtype __trunctfkf2 (IBM128_TYPE);
diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128
index 6fb1a3d..b09b566 100644
--- a/libgcc/config/rs6000/t-float128
+++ b/libgcc/config/rs6000/t-float128
@@ -26,19 +26,19 @@ fp128_softfp_obj = $(fp128_softfp_static_obj) $(fp128_softfp_shared_obj)
fp128_dec_funcs = _kf_to_sd _kf_to_dd _kf_to_td \
_sd_to_kf _dd_to_kf _td_to_kf
-# _Float128 to/from string conversions that must be compiled with IBM 128-bit
-# long double.
-fp128_decstr_funcs = _strtokf _sprintfkf
-
# Decimal <-> __ibm128 conversions
ibm128_dec_funcs = _tf_to_sd _tf_to_dd _tf_to_td \
_sd_to_tf _dd_to_tf _td_to_tf
# New functions for software emulation
-fp128_ppc_funcs = floattikf floatuntikf fixkfti fixunskfti \
+fp128_ppc_funcs = floattikf-sw floatuntikf-sw \
+ fixkfti-sw fixunskfti-sw \
extendkftf2-sw trunctfkf2-sw \
- sfp-exceptions _mulkc3 _divkc3 _powikf2 \
- $(fp128_dec_funcs) $(fp128_decstr_funcs)
+ sfp-exceptions _mulkc3 _divkc3 _powikf2
+
+ifeq ($(decimal_float),yes)
+fp128_ppc_funcs += $(fp128_dec_funcs)
+endif
fp128_ppc_src = $(addprefix $(srcdir)/config/rs6000/,$(addsuffix \
.c,$(fp128_ppc_funcs)))
@@ -48,13 +48,16 @@ fp128_ppc_obj = $(fp128_ppc_static_obj) $(fp128_ppc_shared_obj)
# All functions
fp128_funcs = $(fp128_softfp_funcs) $(fp128_ppc_funcs) \
- $(fp128_hw_funcs) $(fp128_ifunc_funcs)
+ $(fp128_hw_funcs) $(fp128_ifunc_funcs) \
+ $(fp128_3_1_hw_funcs)
fp128_src = $(fp128_softfp_src) $(fp128_ppc_src) \
- $(fp128_hw_src) $(fp128_ifunc_src)
+ $(fp128_hw_src) $(fp128_ifunc_src) \
+ $(fp128_3_1_hw_src)
fp128_obj = $(fp128_softfp_obj) $(fp128_ppc_obj) \
- $(fp128_hw_obj) $(fp128_ifunc_obj)
+ $(fp128_hw_obj) $(fp128_ifunc_obj) \
+ $(fp128_3_1_hw_obj)
fp128_sed = $(srcdir)/config/rs6000/float128-sed$(fp128_sed_hw)
fp128_dep = $(fp128_sed) $(srcdir)/config/rs6000/t-float128
@@ -88,9 +91,6 @@ $(fp128_obj) : $(srcdir)/config/rs6000/quad-float128.h
fp128_dec_objs = $(addsuffix $(objext),$(fp128_dec_funcs)) \
$(addsuffix _s$(objext),$(fp128_dec_funcs))
-fp128_decstr_objs = $(addsuffix $(objext),$(fp128_decstr_funcs)) \
- $(addsuffix _s$(objext),$(fp128_decstr_funcs))
-
ibm128_dec_objs = $(addsuffix $(objext),$(ibm128_dec_funcs)) \
$(addsuffix _s$(objext),$(ibm128_dec_funcs))
@@ -98,12 +98,8 @@ FP128_CFLAGS_DECIMAL = -mno-gnu-attribute -Wno-psabi -mabi=ieeelongdouble
IBM128_CFLAGS_DECIMAL = -mno-gnu-attribute -Wno-psabi -mabi=ibmlongdouble
$(fp128_dec_objs) : INTERNAL_CFLAGS += $(FP128_CFLAGS_DECIMAL)
-$(fp128_decstr_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL)
$(ibm128_dec_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL)
-$(fp128_decstr_objs) : $(srcdir)/config/rs6000/_strtokf.h \
- $(srcdir)/config/rs6000/_sprintfkf.h \
-
$(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep)
@src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \
echo "Create $@"; \
diff --git a/libgcc/config/rs6000/t-float128-p10-hw b/libgcc/config/rs6000/t-float128-p10-hw
new file mode 100644
index 0000000..edaaee0
--- /dev/null
+++ b/libgcc/config/rs6000/t-float128-p10-hw
@@ -0,0 +1,24 @@
+# Support for adding __float128 hardware support to the powerpc.
+# Tell the float128 functions that the ISA 3.1 hardware support can
+# be compiled it to be selected via IFUNC functions.
+
+FLOAT128_HW_INSNS += -DFLOAT128_HW_INSNS_ISA3_1
+
+# New functions for hardware support
+
+fp128_3_1_hw_funcs = float128-p10
+fp128_3_1_hw_src = $(srcdir)/config/rs6000/float128-p10.c
+fp128_3_1_hw_static_obj = $(addsuffix $(objext),$(fp128_3_1_hw_funcs))
+fp128_3_1_hw_shared_obj = $(addsuffix _s$(objext),$(fp128_3_1_hw_funcs))
+fp128_3_1_hw_obj = $(fp128_3_1_hw_static_obj) $(fp128_3_1_hw_shared_obj)
+
+# Build the hardware support functions with appropriate hardware support
+FP128_3_1_CFLAGS_HW = -Wno-type-limits -mvsx -mfloat128 \
+ -mcpu=power10 \
+ -mfloat128-hardware -mno-gnu-attribute \
+ -I$(srcdir)/soft-fp \
+ -I$(srcdir)/config/rs6000 \
+ $(FLOAT128_HW_INSNS)
+
+$(fp128_3_1_hw_obj) : INTERNAL_CFLAGS += $(FP128_3_1_CFLAGS_HW)
+$(fp128_3_1_hw_obj) : $(srcdir)/config/rs6000/t-float128-p10-hw
diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
index 72e9c27..500210d 100644
--- a/libgcc/config/rs6000/t-linux
+++ b/libgcc/config/rs6000/t-linux
@@ -11,10 +11,12 @@ HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
# the IBM extended double format. Also turn off gnu attributes on the static
# modules.
IBM128_STATIC_OBJS = ibm-ldouble$(objext) _powitf2$(objext) \
- ppc64-fp$(objext) _divtc3$(object) _multc3$(object) \
- _fixtfdi$(object) _fixunstfdi$(object) \
- _floatditf$(objext) _floatunsditf$(objext)
-IBM128_SHARED_OBJS = $(IBM128_STATIC_OBJS:$(objext):_s$(objext))
+ ppc64-fp$(objext) _divtc3$(objext) _multc3$(objext) \
+ _fixtfdi$(objext) _fixunstfdi$(objext) \
+ _floatditf$(objext) _floatunditf$(objext) \
+ _fixtfti$(objext) _fixunstfti$(objext) \
+ _floattitf$(objext) _floatuntitf$(objext)
+IBM128_SHARED_OBJS = $(IBM128_STATIC_OBJS:$(objext)=_s$(objext))
IBM128_OBJS = $(IBM128_STATIC_OBJS) $(IBM128_SHARED_OBJS)
IBM128_CFLAGS = -Wno-psabi -mabi=ibmlongdouble -mno-gnu-attribute
diff --git a/libgcc/config/rs6000/tramp.S b/libgcc/config/rs6000/tramp.S
index 4236a82..68baf16 100644
--- a/libgcc/config/rs6000/tramp.S
+++ b/libgcc/config/rs6000/tramp.S
@@ -64,8 +64,7 @@ FUNC_START(__trampoline_setup)
mflr r11
addi r7,r11,trampoline_initial-4-.LCF0 /* trampoline address -4 */
- li r8,trampoline_size /* verify that the trampoline is big enough */
- cmpw cr1,r8,r4
+ cmpwi cr1,r4,trampoline_size /* verify that the trampoline is big enough */
srwi r4,r4,2 /* # words to move */
addi r9,r3,-4 /* adjust pointer for lwzu */
mtctr r4
@@ -156,8 +155,7 @@ FUNC_START(__trampoline_setup)
ld 7,.LC0@toc@l(7) /* trampoline address -8 */
#endif
- li r8,trampoline_size /* verify that the trampoline is big enough */
- cmpw cr1,r8,r4
+ cmpwi cr1,r4,trampoline_size /* verify that the trampoline is big enough */
srwi r4,r4,3 /* # doublewords to move */
addi r9,r3,-8 /* adjust pointer for stdu */
mtctr r4
diff --git a/libgcc/config/t-slibgcc b/libgcc/config/t-slibgcc
index c59b43b..50f13c2 100644
--- a/libgcc/config/t-slibgcc
+++ b/libgcc/config/t-slibgcc
@@ -32,7 +32,7 @@ SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
$(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
- $(SHLIB_LDFLAGS) \
+ $(SHLIB_LDFLAGS) $(LDFLAGS) \
-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
$(SHLIB_OBJS) $(SHLIB_LC) && \
rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
diff --git a/libgcc/config/t-slibgcc-darwin b/libgcc/config/t-slibgcc-darwin
index 9970d00..a6ada45 100644
--- a/libgcc/config/t-slibgcc-darwin
+++ b/libgcc/config/t-slibgcc-darwin
@@ -15,7 +15,7 @@ SHLIB_LC = -lc
# Note that this version is used for the loader, not the linker; the linker
# uses the stub versions named by the versioned members of $(INSTALL_FILES).
-SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -dynamiclib -nodefaultlibs \
+SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
-install_name @shlib_slibdir@/$(SHLIB_INSTALL_NAME) \
-single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \
-Wl,-exported_symbols_list,$(SHLIB_MAP) \
diff --git a/libgcc/config/t-slibgcc-fuchsia b/libgcc/config/t-slibgcc-fuchsia
index ed56473..97f1803 100644
--- a/libgcc/config/t-slibgcc-fuchsia
+++ b/libgcc/config/t-slibgcc-fuchsia
@@ -18,27 +18,4 @@
# Fuchsia-specific shared library overrides.
-SHLIB_LDFLAGS = -Wl,--soname=$(SHLIB_SONAME) \
- $(LDFLAGS)
-# Copyright (C) 2017-2021 Free Software Foundation, Inc.
-#
-# This file is part of GCC.
-#
-# GCC is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GCC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3. If not see
-# <http://www.gnu.org/licenses/>.
-
-# Fuchsia-specific shared library overrides.
-
-SHLIB_LDFLAGS = -Wl,--soname=$(SHLIB_SONAME) \
- $(LDFLAGS)
+SHLIB_LDFLAGS = -Wl,--soname=$(SHLIB_SONAME)
diff --git a/libgcc/config/t-slibgcc-vms b/libgcc/config/t-slibgcc-vms
index d01c343..c305975 100644
--- a/libgcc/config/t-slibgcc-vms
+++ b/libgcc/config/t-slibgcc-vms
@@ -22,7 +22,7 @@ SHLIB_LINK = \
objdump --syms $(SHLIB_OBJS) | \
$(SHLIB_SYMVEC) >> SYMVEC_$$$$.opt ; \
echo "case_sensitive=NO" >> SYMVEC_$$$$.opt; \
- $(CC) $(LIBGCC2_CFLAGS) -nodefaultlibs \
+ $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -nodefaultlibs \
-shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \
--for-linker=SYMVEC_$$$$.opt \
--for-linker=gsmatch=equal,$(shlib_version)