Patch below fixes bootstrap,

OK if it passes testing on x86_64 darwin/linux?
(if !OK .. then suggestions welcome)

thanks
Iain

> On 2 Sep 2021, at 16:18, Hongtao Liu <crazy...@gmail.com> wrote:
> 
> 
> 
> On Thursday, September 2, 2021, Iain Sandoe <idsan...@googlemail.com> wrote:
> Hi Hongtao.
> 
> > On 2 Sep 2021, at 07:06, Hongtao Liu via Gcc-patches 
> > <gcc-patches@gcc.gnu.org> wrote:
> > 
> > I'm going to check in the first 3 patches which are already approved.
> > 
> >  Update hf soft-fp from glibc.
> >  [i386] Enable _Float16 type for TARGET_SSE2 and above.
> >  [i386] libgcc: Enable hfmode soft-sf/df/xf/tf extensions and
> >    truncations.
> 
> Bootstrap on Darwin x86_64 is broken on at least AVX512 and i5 cpus at 
> revision
> r12-3311-g1e6267b33526.
> 
> "fp-machine.h:81:22: error: unknown type name 'TFtype'; did you mean 
> 'HFtype’?”
> 
> any immediate ideas on what might be the issue?
> thanks
>  
> Seems to be related to the belowpart which is not changed by my patch, and 
> TFtype is defined in quad.h
> 
>  76 /* Define ALIASNAME as a strong alias for NAME.  */
>   77 #if defined __MACH__
>   78 /* Mach-O doesn't support aliasing.  If these functions ever return
>   79    anything but CMPtype we need to revisit this... */
>   80 #define strong_alias(name, aliasname) \
>   81   CMPtype aliasname (TFtype a, TFtype b) { return name(a, b); }
>   82 #else
> 
> Would you try to add
> typedef float TFtype __attribute__ ((mode (TF))); 
> Here to see if it fixes the issue.

I don’t think it’s  quite as simple as that - this is what I’m testing:

[PATCH] libgcc, soft-float: Fix strong_alias macro use for Darwin.

Darwin does not support strong symbol aliases and a work-
around is provided in sfp-machine.h where a second function
is created that simply calls the original.  However this
needs the arguments to the synthesized function to track
the mode of the original function.

So the fix here is to adjust the macro to allow the mode to
be provided and then to set it as needed before the header
is included.

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

libgcc/ChangeLog:

        * config/i386/sfp-exceptions.c (DarwinMode): Set
        arbitrarily to DF mode (the strong_alias macros is
        not used here).
        * config/i386/sfp-machine.h: Adjust strong_alias macro
        so that the type can be provided per case.
        * soft-fp/eqdf2.c (DarwinMode): Set to DF mode.
        * soft-fp/eqhf2.c (DarwinMode): Set to HF mode.
        * soft-fp/eqsf2.c (DarwinMode): Set to SF mode.
        * soft-fp/eqtf2.c (DarwinMode): Set to TF mode.
        * soft-fp/gedf2.c (DarwinMode): Set to DF mode.
        * soft-fp/gesf2.c (DarwinMode): Set to SF mode.
        * soft-fp/getf2.c (DarwinMode): Set to TF mode.
        * soft-fp/ledf2.c (DarwinMode): Set to DF mode.
        * soft-fp/lesf2.c (DarwinMode): Set to SF mode.
        * soft-fp/letf2.c (DarwinMode): Set to TF mode.
---
 libgcc/config/i386/sfp-exceptions.c | 1 +
 libgcc/config/i386/sfp-machine.h    | 9 ++++++---
 libgcc/soft-fp/eqdf2.c              | 1 +
 libgcc/soft-fp/eqhf2.c              | 1 +
 libgcc/soft-fp/eqsf2.c              | 1 +
 libgcc/soft-fp/eqtf2.c              | 1 +
 libgcc/soft-fp/gedf2.c              | 1 +
 libgcc/soft-fp/gesf2.c              | 1 +
 libgcc/soft-fp/getf2.c              | 1 +
 libgcc/soft-fp/ledf2.c              | 1 +
 libgcc/soft-fp/lesf2.c              | 1 +
 libgcc/soft-fp/letf2.c              | 1 +
 12 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/libgcc/config/i386/sfp-exceptions.c 
b/libgcc/config/i386/sfp-exceptions.c
index edb6a57bb35..7431cf93e33 100644
--- a/libgcc/config/i386/sfp-exceptions.c
+++ b/libgcc/config/i386/sfp-exceptions.c
@@ -22,6 +22,7 @@
  */
 
 #ifndef _SOFT_FLOAT
+#define DarwinMode DF
 #include "sfp-machine.h"
 
 struct fenv
diff --git a/libgcc/config/i386/sfp-machine.h b/libgcc/config/i386/sfp-machine.h
index f15d29d3755..2cb6119b8f8 100644
--- a/libgcc/config/i386/sfp-machine.h
+++ b/libgcc/config/i386/sfp-machine.h
@@ -75,10 +75,13 @@ 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 - this needs the type of the arguments to be provided as
+   DarwinFtype.  If these functions ever return anything but CMPtype
+   we need to revisit this... */
 #define strong_alias(name, aliasname) \
-  CMPtype aliasname (TFtype a, TFtype b) { return name(a, b); }
+  typedef float DarwinFtype __attribute__((mode (DarwinMode))); \
+  CMPtype aliasname (DarwinFtype a, DarwinFtype b) { return name(a, b); }
 #else
 # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
 # define _strong_alias(name, aliasname) \
diff --git a/libgcc/soft-fp/eqdf2.c b/libgcc/soft-fp/eqdf2.c
index 2a44ee377ce..a3bb664f5f1 100644
--- a/libgcc/soft-fp/eqdf2.c
+++ b/libgcc/soft-fp/eqdf2.c
@@ -28,6 +28,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define DarwinMode DF
 #include "soft-fp.h"
 #include "double.h"
 
diff --git a/libgcc/soft-fp/eqhf2.c b/libgcc/soft-fp/eqhf2.c
index 6d6634e5c54..73a3b0a13d8 100644
--- a/libgcc/soft-fp/eqhf2.c
+++ b/libgcc/soft-fp/eqhf2.c
@@ -26,6 +26,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define DarwinMode HF
 #include "soft-fp.h"
 #include "half.h"
 
diff --git a/libgcc/soft-fp/eqsf2.c b/libgcc/soft-fp/eqsf2.c
index c515044d7bf..84f3ba63958 100644
--- a/libgcc/soft-fp/eqsf2.c
+++ b/libgcc/soft-fp/eqsf2.c
@@ -28,6 +28,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define DarwinMode SF
 #include "soft-fp.h"
 #include "single.h"
 
diff --git a/libgcc/soft-fp/eqtf2.c b/libgcc/soft-fp/eqtf2.c
index 5feac41a0de..3a44e006943 100644
--- a/libgcc/soft-fp/eqtf2.c
+++ b/libgcc/soft-fp/eqtf2.c
@@ -28,6 +28,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define DarwinMode TF
 #include "soft-fp.h"
 #include "quad.h"
 
diff --git a/libgcc/soft-fp/gedf2.c b/libgcc/soft-fp/gedf2.c
index bcefb61aa80..551356a0ea4 100644
--- a/libgcc/soft-fp/gedf2.c
+++ b/libgcc/soft-fp/gedf2.c
@@ -28,6 +28,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define DarwinMode DF
 #include "soft-fp.h"
 #include "double.h"
 
diff --git a/libgcc/soft-fp/gesf2.c b/libgcc/soft-fp/gesf2.c
index 22f0b6a24be..57cae4c3fd7 100644
--- a/libgcc/soft-fp/gesf2.c
+++ b/libgcc/soft-fp/gesf2.c
@@ -28,6 +28,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define DarwinMode SF
 #include "soft-fp.h"
 #include "single.h"
 
diff --git a/libgcc/soft-fp/getf2.c b/libgcc/soft-fp/getf2.c
index 6c7e38f36fc..3b23c17322e 100644
--- a/libgcc/soft-fp/getf2.c
+++ b/libgcc/soft-fp/getf2.c
@@ -28,6 +28,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define DarwinMode TF
 #include "soft-fp.h"
 #include "quad.h"
 
diff --git a/libgcc/soft-fp/ledf2.c b/libgcc/soft-fp/ledf2.c
index c36148e2f12..ecf05ce1554 100644
--- a/libgcc/soft-fp/ledf2.c
+++ b/libgcc/soft-fp/ledf2.c
@@ -28,6 +28,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define DarwinMode DF
 #include "soft-fp.h"
 #include "double.h"
 
diff --git a/libgcc/soft-fp/lesf2.c b/libgcc/soft-fp/lesf2.c
index e3233535c8f..e0105600592 100644
--- a/libgcc/soft-fp/lesf2.c
+++ b/libgcc/soft-fp/lesf2.c
@@ -28,6 +28,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define DarwinMode SF
 #include "soft-fp.h"
 #include "single.h"
 
diff --git a/libgcc/soft-fp/letf2.c b/libgcc/soft-fp/letf2.c
index 43d9f77bca9..80bfa085e70 100644
--- a/libgcc/soft-fp/letf2.c
+++ b/libgcc/soft-fp/letf2.c
@@ -28,6 +28,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define DarwinMode TF
 #include "soft-fp.h"
 #include "quad.h"
 
-- 

Reply via email to