public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] x86: Fix -fsplit-stack feature detection via TARGET_CAN_SPLIT_STACK
@ 2022-02-21  7:51 soeren
  2022-02-21 22:04 ` [PATCH v2] " soeren
  0 siblings, 1 reply; 7+ messages in thread
From: soeren @ 2022-02-21  7:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: hjl.tools, jakub

From: Sören Tempel <soeren@soeren-tempel.net>

Since commit c163647ffbc9a20c8feb6e079dbecccfe016c82e -fsplit-stack
is only supported on glibc targets. However, this original commit
required some fixups. As part of the fixup, the changes to the
gnu-user-common.h and gnu.h where partially reverted in commit
60953a23d57b13a672f751bec0c6eefc059eb1ab thus causing TARGET_CAN_SPLIT_STACK
to be defined for non-glibc targets even though -fsplit-stack is
actually not supported and attempting to use it causes a runtime error.

This causes gcc internal code, such as ./gcc/go/gospec.cc to not
correctly detect that -fsplit-stack is not supported and thus causes
gccgo to fail compilation on non-glibc targets.

This commit ensures that TARGET_CAN_SPLIT_STACK is set based on the
changes performed in 2c31a8be4a5db11a0a0e97c366dded6362421086, i.e.
the new OPTION_GLIBC_P macro is now used to detect if -fsplit-stack is
supported in the x86 header files.

The proposed changes have been tested on x86_64 Alpine Linux (which uses
musl libc) and fix compilation of gccgo for this target.

Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>

gcc/ChangeLog:

	* config/i386/gnu-user-common.h (defined): Only define
        TARGET_CAN_SPLIT_STACK for glibc targets.
	* config/i386/gnu.h (defined): Ditto.
---
I hope this is the last fixup commit needed for the original -fsplit-stack
change. Apologizes that the integration was a bit messy, I am simply not
deeply familiar with the gcc code base. The change works fine on Alpine
and fixes gccgo compilation but please review it carefully and make sure
the macro guards for TARGET_CAN_SPLIT_STACK are aligned with the
ix86_supports_split_stack implementation.

Should we also check if TARGET_THREAD_SPLIT_STACK_OFFSET is defined?

 gcc/config/i386/gnu-user-common.h | 5 +++--
 gcc/config/i386/gnu.h             | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gcc/config/i386/gnu-user-common.h b/gcc/config/i386/gnu-user-common.h
index 23b54c5be52..bb745c2edaa 100644
--- a/gcc/config/i386/gnu-user-common.h
+++ b/gcc/config/i386/gnu-user-common.h
@@ -66,7 +66,8 @@ along with GCC; see the file COPYING3.  If not see
 #define STACK_CHECK_STATIC_BUILTIN 1
 
 /* We only build the -fsplit-stack support in libgcc if the
-   assembler has full support for the CFI directives.  */
-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+   assembler has full support for the CFI directives.  Also
+   we only support -fsplit-stack on glibc targets.  */
+#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && defined(OPTION_GLIBC_P)
 #define TARGET_CAN_SPLIT_STACK
 #endif
diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h
index 401e60c9a02..92a29149b2e 100644
--- a/gcc/config/i386/gnu.h
+++ b/gcc/config/i386/gnu.h
@@ -41,8 +41,9 @@ along with GCC.  If not, see <http://www.gnu.org/licenses/>.
 #define TARGET_THREAD_SSP_OFFSET        0x14
 
 /* We only build the -fsplit-stack support in libgcc if the
-   assembler has full support for the CFI directives.  */
-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+   assembler has full support for the CFI directives.  Also
+   we only support -fsplit-stack on glibc targets.  */
+#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && defined(OPTION_GLIBC_P)
 #define TARGET_CAN_SPLIT_STACK
 #endif
 /* We steal the last transactional memory word.  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] x86: Fix -fsplit-stack feature detection via TARGET_CAN_SPLIT_STACK
  2022-02-21  7:51 [PATCH] x86: Fix -fsplit-stack feature detection via TARGET_CAN_SPLIT_STACK soeren
@ 2022-02-21 22:04 ` soeren
  2022-03-14 19:07   ` PING: " Sören Tempel
  0 siblings, 1 reply; 7+ messages in thread
From: soeren @ 2022-02-21 22:04 UTC (permalink / raw)
  To: gcc-patches

From: Sören Tempel <soeren@soeren-tempel.net>

Since commit c163647ffbc9a20c8feb6e079dbecccfe016c82e -fsplit-stack
is only supported on glibc targets. However, this original commit
required some fixups. As part of the fixup, the changes to the
gnu-user-common.h and gnu.h were partially reverted in commit
60953a23d57b13a672f751bec0c6eefc059eb1ab thus causing TARGET_CAN_SPLIT_STACK
to be defined for non-glibc targets even though -fsplit-stack is
actually not supported and attempting to use it causes a runtime error.

This causes gcc internal code, such as ./gcc/go/gospec.c to not
correctly detect that -fsplit-stack is not supported and thus causes
gccgo to fail compilation on non-glibc targets.

This commit ensures that TARGET_CAN_SPLIT_STACK is only set if the
default libc is glibc. It is presently unclear to me if there is a
better way to detect glibc at pre-processor time.

The proposed changes have been tested on x86 and x86_64 Alpine Linux
(which uses musl libc) and fix compilation of gccgo for this target.

Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>

gcc/ChangeLog:

	* config/i386/gnu-user-common.h (defined): Only define
        TARGET_CAN_SPLIT_STACK for glibc targets.
	* config/i386/gnu.h (defined): Ditto.
---
Changes since v1: Use (DEFAULT_LIBC == LIBC_GLIBC) instead of
OPTION_GLIBC_P to detect use of glibc in a pre-processor context.

Is there a better way to detect use of glibc in the config header?

 gcc/config/i386/gnu-user-common.h | 5 +++--
 gcc/config/i386/gnu.h             | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gcc/config/i386/gnu-user-common.h b/gcc/config/i386/gnu-user-common.h
index 00226f5a455..e126c3fa9fa 100644
--- a/gcc/config/i386/gnu-user-common.h
+++ b/gcc/config/i386/gnu-user-common.h
@@ -66,7 +66,8 @@ along with GCC; see the file COPYING3.  If not see
 #define STACK_CHECK_STATIC_BUILTIN 1
 
 /* We only build the -fsplit-stack support in libgcc if the
-   assembler has full support for the CFI directives.  */
-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+   assembler has full support for the CFI directives.  Also
+   we only support -fsplit-stack on glibc targets.  */
+#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && (DEFAULT_LIBC == LIBC_GLIBC)
 #define TARGET_CAN_SPLIT_STACK
 #endif
diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h
index 25fbc07f58c..17494333bb9 100644
--- a/gcc/config/i386/gnu.h
+++ b/gcc/config/i386/gnu.h
@@ -41,8 +41,9 @@ along with GCC.  If not, see <http://www.gnu.org/licenses/>.
 #define TARGET_THREAD_SSP_OFFSET        0x14
 
 /* We only build the -fsplit-stack support in libgcc if the
-   assembler has full support for the CFI directives.  */
-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+   assembler has full support for the CFI directives.  Also
+   we only support -fsplit-stack on glibc targets.  */
+#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && (DEFAULT_LIBC == LIBC_GLIBC)
 #define TARGET_CAN_SPLIT_STACK
 #endif
 /* We steal the last transactional memory word.  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* PING: [PATCH v2] x86: Fix -fsplit-stack feature detection via TARGET_CAN_SPLIT_STACK
  2022-02-21 22:04 ` [PATCH v2] " soeren
@ 2022-03-14 19:07   ` Sören Tempel
  2022-05-01 14:20     ` Sören Tempel
  0 siblings, 1 reply; 7+ messages in thread
From: Sören Tempel @ 2022-03-14 19:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: hjl.tools, jakub

Ping.

Summary: Currently, the macro guards for TARGET_CAN_SPLIT_STACK are not
aligned with the implementation of ix86_supports_split_stack on x86.
That is, on musl systems TARGET_CAN_SPLIT_STACK is defined even though
-fsplit-stack is not supported (via ix86_supports_split_stack). This
prevents gccgo (which uses TARGET_CAN_SPLIT_STACK) from compiling on
musl systems. The proposed patch attempts to align the behavior of
ix86_supports_split_stack and TARGET_CAN_SPLIT_STACK.

See: https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590688.html

Greetings,
Sören

Sören Tempel <soeren@soeren-tempel.net> wrote:
> Since commit c163647ffbc9a20c8feb6e079dbecccfe016c82e -fsplit-stack
> is only supported on glibc targets. However, this original commit
> required some fixups. As part of the fixup, the changes to the
> gnu-user-common.h and gnu.h were partially reverted in commit
> 60953a23d57b13a672f751bec0c6eefc059eb1ab thus causing TARGET_CAN_SPLIT_STACK
> to be defined for non-glibc targets even though -fsplit-stack is
> actually not supported and attempting to use it causes a runtime error.
> 
> This causes gcc internal code, such as ./gcc/go/gospec.c to not
> correctly detect that -fsplit-stack is not supported and thus causes
> gccgo to fail compilation on non-glibc targets.
> 
> This commit ensures that TARGET_CAN_SPLIT_STACK is only set if the
> default libc is glibc. It is presently unclear to me if there is a
> better way to detect glibc at pre-processor time.
> 
> The proposed changes have been tested on x86 and x86_64 Alpine Linux
> (which uses musl libc) and fix compilation of gccgo for this target.
> 
> Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>
> 
> gcc/ChangeLog:
> 
> 	* config/i386/gnu-user-common.h (defined): Only define
>         TARGET_CAN_SPLIT_STACK for glibc targets.
> 	* config/i386/gnu.h (defined): Ditto.
> ---
> Changes since v1: Use (DEFAULT_LIBC == LIBC_GLIBC) instead of
> OPTION_GLIBC_P to detect use of glibc in a pre-processor context.
> 
> Is there a better way to detect use of glibc in the config header?
> 
>  gcc/config/i386/gnu-user-common.h | 5 +++--
>  gcc/config/i386/gnu.h             | 5 +++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/gcc/config/i386/gnu-user-common.h b/gcc/config/i386/gnu-user-common.h
> index 00226f5a455..e126c3fa9fa 100644
> --- a/gcc/config/i386/gnu-user-common.h
> +++ b/gcc/config/i386/gnu-user-common.h
> @@ -66,7 +66,8 @@ along with GCC; see the file COPYING3.  If not see
>  #define STACK_CHECK_STATIC_BUILTIN 1
>  
>  /* We only build the -fsplit-stack support in libgcc if the
> -   assembler has full support for the CFI directives.  */
> -#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
> +   assembler has full support for the CFI directives.  Also
> +   we only support -fsplit-stack on glibc targets.  */
> +#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && (DEFAULT_LIBC == LIBC_GLIBC)
>  #define TARGET_CAN_SPLIT_STACK
>  #endif
> diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h
> index 25fbc07f58c..17494333bb9 100644
> --- a/gcc/config/i386/gnu.h
> +++ b/gcc/config/i386/gnu.h
> @@ -41,8 +41,9 @@ along with GCC.  If not, see <http://www.gnu.org/licenses/>.
>  #define TARGET_THREAD_SSP_OFFSET        0x14
>  
>  /* We only build the -fsplit-stack support in libgcc if the
> -   assembler has full support for the CFI directives.  */
> -#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
> +   assembler has full support for the CFI directives.  Also
> +   we only support -fsplit-stack on glibc targets.  */
> +#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && (DEFAULT_LIBC == LIBC_GLIBC)
>  #define TARGET_CAN_SPLIT_STACK
>  #endif
>  /* We steal the last transactional memory word.  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PING: [PATCH v2] x86: Fix -fsplit-stack feature detection via TARGET_CAN_SPLIT_STACK
  2022-03-14 19:07   ` PING: " Sören Tempel
@ 2022-05-01 14:20     ` Sören Tempel
  2022-05-03  7:28       ` Uros Bizjak
  0 siblings, 1 reply; 7+ messages in thread
From: Sören Tempel @ 2022-05-01 14:20 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka, ubizjak, hjl.tools, jakub

Pinging this again. This time with i386 port maintainers in CC.

Summary: The macro guards for TARGET_CAN_SPLIT_STACK on i386 are not
aligned with the implementation of ix86_supports_split_stack. That is,
on systems using musl libc ix86_supports_split_stack errors-out (since
-fsplit-stack is not supported in conjunction with musl) but the feature
test macro TARGET_CAN_SPLIT_STACK is still defined on these systems.
This prevents gccgo from compiling on musl-based systems. On other
architectures which support -fsplit-stack TARGET_CAN_SPLIT_STACK
seems to be defined correctly.

See: https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590688.html

Greetings,
Sören Tempel

Sören Tempel <soeren@soeren-tempel.net> wrote:
> Ping.
> 
> Summary: Currently, the macro guards for TARGET_CAN_SPLIT_STACK are not
> aligned with the implementation of ix86_supports_split_stack on x86.
> That is, on musl systems TARGET_CAN_SPLIT_STACK is defined even though
> -fsplit-stack is not supported (via ix86_supports_split_stack). This
> prevents gccgo (which uses TARGET_CAN_SPLIT_STACK) from compiling on
> musl systems. The proposed patch attempts to align the behavior of
> ix86_supports_split_stack and TARGET_CAN_SPLIT_STACK.
> 
> See: https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590688.html
> 
> Greetings,
> Sören
> 
> Sören Tempel <soeren@soeren-tempel.net> wrote:
> > Since commit c163647ffbc9a20c8feb6e079dbecccfe016c82e -fsplit-stack
> > is only supported on glibc targets. However, this original commit
> > required some fixups. As part of the fixup, the changes to the
> > gnu-user-common.h and gnu.h were partially reverted in commit
> > 60953a23d57b13a672f751bec0c6eefc059eb1ab thus causing TARGET_CAN_SPLIT_STACK
> > to be defined for non-glibc targets even though -fsplit-stack is
> > actually not supported and attempting to use it causes a runtime error.
> > 
> > This causes gcc internal code, such as ./gcc/go/gospec.c to not
> > correctly detect that -fsplit-stack is not supported and thus causes
> > gccgo to fail compilation on non-glibc targets.
> > 
> > This commit ensures that TARGET_CAN_SPLIT_STACK is only set if the
> > default libc is glibc. It is presently unclear to me if there is a
> > better way to detect glibc at pre-processor time.
> > 
> > The proposed changes have been tested on x86 and x86_64 Alpine Linux
> > (which uses musl libc) and fix compilation of gccgo for this target.
> > 
> > Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>
> > 
> > gcc/ChangeLog:
> > 
> > 	* config/i386/gnu-user-common.h (defined): Only define
> >         TARGET_CAN_SPLIT_STACK for glibc targets.
> > 	* config/i386/gnu.h (defined): Ditto.
> > ---
> > Changes since v1: Use (DEFAULT_LIBC == LIBC_GLIBC) instead of
> > OPTION_GLIBC_P to detect use of glibc in a pre-processor context.
> > 
> > Is there a better way to detect use of glibc in the config header?
> > 
> >  gcc/config/i386/gnu-user-common.h | 5 +++--
> >  gcc/config/i386/gnu.h             | 5 +++--
> >  2 files changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/gcc/config/i386/gnu-user-common.h b/gcc/config/i386/gnu-user-common.h
> > index 00226f5a455..e126c3fa9fa 100644
> > --- a/gcc/config/i386/gnu-user-common.h
> > +++ b/gcc/config/i386/gnu-user-common.h
> > @@ -66,7 +66,8 @@ along with GCC; see the file COPYING3.  If not see
> >  #define STACK_CHECK_STATIC_BUILTIN 1
> >  
> >  /* We only build the -fsplit-stack support in libgcc if the
> > -   assembler has full support for the CFI directives.  */
> > -#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
> > +   assembler has full support for the CFI directives.  Also
> > +   we only support -fsplit-stack on glibc targets.  */
> > +#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && (DEFAULT_LIBC == LIBC_GLIBC)
> >  #define TARGET_CAN_SPLIT_STACK
> >  #endif
> > diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h
> > index 25fbc07f58c..17494333bb9 100644
> > --- a/gcc/config/i386/gnu.h
> > +++ b/gcc/config/i386/gnu.h
> > @@ -41,8 +41,9 @@ along with GCC.  If not, see <http://www.gnu.org/licenses/>.
> >  #define TARGET_THREAD_SSP_OFFSET        0x14
> >  
> >  /* We only build the -fsplit-stack support in libgcc if the
> > -   assembler has full support for the CFI directives.  */
> > -#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
> > +   assembler has full support for the CFI directives.  Also
> > +   we only support -fsplit-stack on glibc targets.  */
> > +#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && (DEFAULT_LIBC == LIBC_GLIBC)
> >  #define TARGET_CAN_SPLIT_STACK
> >  #endif
> >  /* We steal the last transactional memory word.  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PING: [PATCH v2] x86: Fix -fsplit-stack feature detection via TARGET_CAN_SPLIT_STACK
  2022-05-01 14:20     ` Sören Tempel
@ 2022-05-03  7:28       ` Uros Bizjak
  2022-05-18  7:34         ` Sören Tempel
  0 siblings, 1 reply; 7+ messages in thread
From: Uros Bizjak @ 2022-05-03  7:28 UTC (permalink / raw)
  To: Sören Tempel; +Cc: gcc-patches, Jan Hubicka, H. J. Lu, Jakub Jelinek

On Sun, May 1, 2022 at 4:20 PM Sören Tempel <soeren@soeren-tempel.net> wrote:
>
> Pinging this again. This time with i386 port maintainers in CC.
>
> Summary: The macro guards for TARGET_CAN_SPLIT_STACK on i386 are not
> aligned with the implementation of ix86_supports_split_stack. That is,
> on systems using musl libc ix86_supports_split_stack errors-out (since
> -fsplit-stack is not supported in conjunction with musl) but the feature
> test macro TARGET_CAN_SPLIT_STACK is still defined on these systems.
> This prevents gccgo from compiling on musl-based systems. On other
> architectures which support -fsplit-stack TARGET_CAN_SPLIT_STACK
> seems to be defined correctly.
>
> See: https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590688.html
>
> Greetings,
> Sören Tempel
>
> Sören Tempel <soeren@soeren-tempel.net> wrote:
> > Ping.
> >
> > Summary: Currently, the macro guards for TARGET_CAN_SPLIT_STACK are not
> > aligned with the implementation of ix86_supports_split_stack on x86.
> > That is, on musl systems TARGET_CAN_SPLIT_STACK is defined even though
> > -fsplit-stack is not supported (via ix86_supports_split_stack). This
> > prevents gccgo (which uses TARGET_CAN_SPLIT_STACK) from compiling on
> > musl systems. The proposed patch attempts to align the behavior of
> > ix86_supports_split_stack and TARGET_CAN_SPLIT_STACK.
> >
> > See: https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590688.html
> >
> > Greetings,
> > Sören
> >
> > Sören Tempel <soeren@soeren-tempel.net> wrote:
> > > Since commit c163647ffbc9a20c8feb6e079dbecccfe016c82e -fsplit-stack
> > > is only supported on glibc targets. However, this original commit
> > > required some fixups. As part of the fixup, the changes to the
> > > gnu-user-common.h and gnu.h were partially reverted in commit
> > > 60953a23d57b13a672f751bec0c6eefc059eb1ab thus causing TARGET_CAN_SPLIT_STACK
> > > to be defined for non-glibc targets even though -fsplit-stack is
> > > actually not supported and attempting to use it causes a runtime error.
> > >
> > > This causes gcc internal code, such as ./gcc/go/gospec.c to not
> > > correctly detect that -fsplit-stack is not supported and thus causes
> > > gccgo to fail compilation on non-glibc targets.
> > >
> > > This commit ensures that TARGET_CAN_SPLIT_STACK is only set if the
> > > default libc is glibc. It is presently unclear to me if there is a
> > > better way to detect glibc at pre-processor time.
> > >
> > > The proposed changes have been tested on x86 and x86_64 Alpine Linux
> > > (which uses musl libc) and fix compilation of gccgo for this target.
> > >
> > > Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>
> > >
> > > gcc/ChangeLog:
> > >
> > >     * config/i386/gnu-user-common.h (defined): Only define
> > >         TARGET_CAN_SPLIT_STACK for glibc targets.
> > >     * config/i386/gnu.h (defined): Ditto.

This looks good to me, so OK.

Thanks,
Uros.

> > > ---
> > > Changes since v1: Use (DEFAULT_LIBC == LIBC_GLIBC) instead of
> > > OPTION_GLIBC_P to detect use of glibc in a pre-processor context.
> > >
> > > Is there a better way to detect use of glibc in the config header?
> > >
> > >  gcc/config/i386/gnu-user-common.h | 5 +++--
> > >  gcc/config/i386/gnu.h             | 5 +++--
> > >  2 files changed, 6 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/gcc/config/i386/gnu-user-common.h b/gcc/config/i386/gnu-user-common.h
> > > index 00226f5a455..e126c3fa9fa 100644
> > > --- a/gcc/config/i386/gnu-user-common.h
> > > +++ b/gcc/config/i386/gnu-user-common.h
> > > @@ -66,7 +66,8 @@ along with GCC; see the file COPYING3.  If not see
> > >  #define STACK_CHECK_STATIC_BUILTIN 1
> > >
> > >  /* We only build the -fsplit-stack support in libgcc if the
> > > -   assembler has full support for the CFI directives.  */
> > > -#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
> > > +   assembler has full support for the CFI directives.  Also
> > > +   we only support -fsplit-stack on glibc targets.  */
> > > +#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && (DEFAULT_LIBC == LIBC_GLIBC)
> > >  #define TARGET_CAN_SPLIT_STACK
> > >  #endif
> > > diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h
> > > index 25fbc07f58c..17494333bb9 100644
> > > --- a/gcc/config/i386/gnu.h
> > > +++ b/gcc/config/i386/gnu.h
> > > @@ -41,8 +41,9 @@ along with GCC.  If not, see <http://www.gnu.org/licenses/>.
> > >  #define TARGET_THREAD_SSP_OFFSET        0x14
> > >
> > >  /* We only build the -fsplit-stack support in libgcc if the
> > > -   assembler has full support for the CFI directives.  */
> > > -#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
> > > +   assembler has full support for the CFI directives.  Also
> > > +   we only support -fsplit-stack on glibc targets.  */
> > > +#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && (DEFAULT_LIBC == LIBC_GLIBC)
> > >  #define TARGET_CAN_SPLIT_STACK
> > >  #endif
> > >  /* We steal the last transactional memory word.  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PING: [PATCH v2] x86: Fix -fsplit-stack feature detection via TARGET_CAN_SPLIT_STACK
  2022-05-03  7:28       ` Uros Bizjak
@ 2022-05-18  7:34         ` Sören Tempel
  2022-05-18  9:19           ` Uros Bizjak
  0 siblings, 1 reply; 7+ messages in thread
From: Sören Tempel @ 2022-05-18  7:34 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches, Jan Hubicka, H. J. Lu, Jakub Jelinek

Hi,

Uros Bizjak <ubizjak@gmail.com> wrote:
> > > > gcc/ChangeLog:
> > > >
> > > >     * config/i386/gnu-user-common.h (defined): Only define
> > > >         TARGET_CAN_SPLIT_STACK for glibc targets.
> > > >     * config/i386/gnu.h (defined): Ditto.
> 
> This looks good to me, so OK.
> 
> Thanks,
> Uros.

I am not deeply familiar with the GCC development process but since it
seems that this hasn't been merged yet: Is there anything else that I
need to do or what is the process for getting this patch upstreamed? (:

Thank you,
Sören

> > > > ---
> > > > Changes since v1: Use (DEFAULT_LIBC == LIBC_GLIBC) instead of
> > > > OPTION_GLIBC_P to detect use of glibc in a pre-processor context.
> > > >
> > > > Is there a better way to detect use of glibc in the config header?
> > > >
> > > >  gcc/config/i386/gnu-user-common.h | 5 +++--
> > > >  gcc/config/i386/gnu.h             | 5 +++--
> > > >  2 files changed, 6 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/gcc/config/i386/gnu-user-common.h b/gcc/config/i386/gnu-user-common.h
> > > > index 00226f5a455..e126c3fa9fa 100644
> > > > --- a/gcc/config/i386/gnu-user-common.h
> > > > +++ b/gcc/config/i386/gnu-user-common.h
> > > > @@ -66,7 +66,8 @@ along with GCC; see the file COPYING3.  If not see
> > > >  #define STACK_CHECK_STATIC_BUILTIN 1
> > > >
> > > >  /* We only build the -fsplit-stack support in libgcc if the
> > > > -   assembler has full support for the CFI directives.  */
> > > > -#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
> > > > +   assembler has full support for the CFI directives.  Also
> > > > +   we only support -fsplit-stack on glibc targets.  */
> > > > +#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && (DEFAULT_LIBC == LIBC_GLIBC)
> > > >  #define TARGET_CAN_SPLIT_STACK
> > > >  #endif
> > > > diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h
> > > > index 25fbc07f58c..17494333bb9 100644
> > > > --- a/gcc/config/i386/gnu.h
> > > > +++ b/gcc/config/i386/gnu.h
> > > > @@ -41,8 +41,9 @@ along with GCC.  If not, see <http://www.gnu.org/licenses/>.
> > > >  #define TARGET_THREAD_SSP_OFFSET        0x14
> > > >
> > > >  /* We only build the -fsplit-stack support in libgcc if the
> > > > -   assembler has full support for the CFI directives.  */
> > > > -#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
> > > > +   assembler has full support for the CFI directives.  Also
> > > > +   we only support -fsplit-stack on glibc targets.  */
> > > > +#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE && (DEFAULT_LIBC == LIBC_GLIBC)
> > > >  #define TARGET_CAN_SPLIT_STACK
> > > >  #endif
> > > >  /* We steal the last transactional memory word.  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PING: [PATCH v2] x86: Fix -fsplit-stack feature detection via TARGET_CAN_SPLIT_STACK
  2022-05-18  7:34         ` Sören Tempel
@ 2022-05-18  9:19           ` Uros Bizjak
  0 siblings, 0 replies; 7+ messages in thread
From: Uros Bizjak @ 2022-05-18  9:19 UTC (permalink / raw)
  To: Sören Tempel; +Cc: gcc-patches, Jan Hubicka, H. J. Lu, Jakub Jelinek

On Wed, May 18, 2022 at 9:34 AM Sören Tempel <soeren@soeren-tempel.net> wrote:
>
> Hi,
>
> Uros Bizjak <ubizjak@gmail.com> wrote:
> > > > > gcc/ChangeLog:
> > > > >
> > > > >     * config/i386/gnu-user-common.h (defined): Only define
> > > > >         TARGET_CAN_SPLIT_STACK for glibc targets.
> > > > >     * config/i386/gnu.h (defined): Ditto.
> >
> > This looks good to me, so OK.
> >
> > Thanks,
> > Uros.
>
> I am not deeply familiar with the GCC development process but since it
> seems that this hasn't been merged yet: Is there anything else that I
> need to do or what is the process for getting this patch upstreamed? (:

You should state in your patch submission that you don't have commit rights.

Anyway, please send me (privately) the updated patch, I'll commit it
in your name later today.

Uros.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-18  9:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21  7:51 [PATCH] x86: Fix -fsplit-stack feature detection via TARGET_CAN_SPLIT_STACK soeren
2022-02-21 22:04 ` [PATCH v2] " soeren
2022-03-14 19:07   ` PING: " Sören Tempel
2022-05-01 14:20     ` Sören Tempel
2022-05-03  7:28       ` Uros Bizjak
2022-05-18  7:34         ` Sören Tempel
2022-05-18  9:19           ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).