diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2022-05-18 20:03:26 +0200 |
---|---|---|
committer | Uros Bizjak <ubizjak@gmail.com> | 2022-05-18 20:10:24 +0200 |
commit | c86b726c048eddc1be320c0bf64a897658bee13d (patch) | |
tree | 921ab388e44b00021d9d26c90ce560acca572bd8 | |
parent | 4a9be8d51182076222d707d9d68f6eda78e8ee2c (diff) | |
download | gcc-c86b726c048eddc1be320c0bf64a897658bee13d.zip gcc-c86b726c048eddc1be320c0bf64a897658bee13d.tar.gz gcc-c86b726c048eddc1be320c0bf64a897658bee13d.tar.bz2 |
x86: Fix -fsplit-stack feature detection via TARGET_CAN_SPLIT_STACK
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.
-rw-r--r-- | gcc/config/i386/gnu-user-common.h | 5 | ||||
-rw-r--r-- | 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 23b54c5..cab9be2 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 (DEFAULT_LIBC == LIBC_GLIBC) && HAVE_GAS_CFI_PERSONALITY_DIRECTIVE #define TARGET_CAN_SPLIT_STACK #endif diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h index 401e60c..fb8d69a 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 (DEFAULT_LIBC == LIBC_GLIBC) && HAVE_GAS_CFI_PERSONALITY_DIRECTIVE #define TARGET_CAN_SPLIT_STACK #endif /* We steal the last transactional memory word. */ |