On Sat, Jan 22, 2022 at 10:32:21AM +0100, Martin Liška wrote:
> I've just noticed the patch broke a few cross compilers:
> 
> s390x-ibm-tpf:
> 
> /home/marxin/buildworker/zen2-cross-compilers/build/gcc/common/config/s390/s390-common.cc:
>  In function ‘bool s390_supports_split_stack(bool, gcc_options*)’:
> /home/marxin/buildworker/zen2-cross-compilers/build/gcc/common/config/s390/s390-common.cc:126:13:
>  error: ‘struct gcc_options’ has no member named ‘x_linux_libc’
>   126 |   if (opts->x_linux_libc == LIBC_GLIBC)
>       |             ^~~~~~~~~~~~
> 
> i686-kopensolaris-gnu, i686-symbolics-gnu
> 
> /home/marxin/buildworker/zen2-cross-compilers/build/gcc/common/config/i386/i386-common.cc:
>  In function ‘bool ix86_supports_split_stack(bool, gcc_options*)’:
> /home/marxin/buildworker/zen2-cross-compilers/build/gcc/common/config/i386/i386-common.cc:1721:13:
>  error: ‘struct gcc_options’ has no member named ‘x_linux_libc’
>  1721 |   if (opts->x_linux_libc != LIBC_GLIBC)
>       |             ^~~~~~~~~~~~
> make[1]: *** [Makefile:2418: i386-common.o] Error 1
> 
> Can you please take a look? Btw. do you have a bugzilla account?

Actually, I suspect we either need something like following patch,
or need to change gcc/config/{linux,rs6000/linux{,64},alpha/linux}.h
so that next to those OPTION_GLIBC etc. macros it also defines versions
of those macros with opts argument.

Untested and I don't have cycles to test this right now.

2022-01-22  Jakub Jelinek  <ja...@redhat.com>

        * common/config/s390/s390-common.cc (s390_supports_split_stack): Re-add
        ATTRIBUTE_UNUSED to opts parameter.  If OPTION_GLIBC is defined and
        SINGLE_LIBC is defined too, use OPTION_GLIBC as condition, otherwise
        if OPTION_GLIBC is defined, use opts->x_linux_libc == LIBC_GLIBC as
        condition, otherwise assume if (false).
        * common/config/i386/i386-common.cc (ix86_supports_split_stack): If
        OPTION_GLIBC is defined and SINGLE_LIBC is defined too, use
        !OPTION_GLIBC as condition, otherwise if OPTION_GLIBC is defined,
        use opts->x_linux_libc != LIBC_GLIBC as condition, otherwise assume
        if (true).

--- gcc/common/config/s390/s390-common.cc.jj    2022-01-21 22:43:22.847719836 
+0100
+++ gcc/common/config/s390/s390-common.cc       2022-01-22 13:05:31.205118265 
+0100
@@ -121,10 +121,16 @@ s390_handle_option (struct gcc_options *
 
 static bool
 s390_supports_split_stack (bool report,
-                          struct gcc_options *opts)
+                          struct gcc_options *opts ATTRIBUTE_UNUSED)
 {
+#ifdef OPTION_GLIBC
+#ifdef SINGLE_LIBC
+  if (OPTION_GLIBC)
+#else
   if (opts->x_linux_libc == LIBC_GLIBC)
+#endif
     return true;
+#endif
 
   if (report)
     error ("%<-fsplit-stack%> currently only supported on GNU/Linux");
--- gcc/common/config/i386/i386-common.cc.jj    2022-01-22 12:02:24.572563780 
+0100
+++ gcc/common/config/i386/i386-common.cc       2022-01-22 13:07:12.223700957 
+0100
@@ -1717,9 +1717,13 @@ static bool
 ix86_supports_split_stack (bool report,
                           struct gcc_options *opts ATTRIBUTE_UNUSED)
 {
-#ifdef TARGET_THREAD_SPLIT_STACK_OFFSET
+#if defined(TARGET_THREAD_SPLIT_STACK_OFFSET) && defined(OPTION_GLIBC)
+#ifdef SINGLE_LIBC
+  if (!OPTION_GLIBC)
+#else
   if (opts->x_linux_libc != LIBC_GLIBC)
 #endif
+#endif
     {
       if (report)
        error ("%<-fsplit-stack%> currently only supported on GNU/Linux");

> 
> Cheers,
> Martin

        Jakub

Reply via email to