This doesn't seem to affect our actual native gcc build, since it compiles gotools just fine, which means the macro is never triggered. However, it does help our x86 crosstoolchains, as otherwise the gccgo crosscompiler seems to think that -fsplit-stack can be passed. This is because of gcc/go/gospec.c, which contains code like this: ``` supports_split_stack = 1; /* If we are linking, pass -fsplit-stack if it is supported. */ if ((library >= 0) && supports_split_stack) { generate_option (OPT_fsplit_stack, NULL, 1, CL_DRIVER, &new_decoded_options[j]); j++; } ``` Also, refactor gccgo enablement code and reenable it on i686-musl. Fixes https://github.com/void-linux/void-packages/issues/22742
43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
First part taken from Alpine.
|
|
|
|
Second part added to prevent gccgo from thinking it can -fsplit-stack on musl.
|
|
|
|
--- a/gcc/gcc.c
|
|
+++ b/gcc/gcc.c
|
|
@@ -876,9 +876,8 @@
|
|
#endif
|
|
|
|
#ifndef LINK_SSP_SPEC
|
|
#ifdef TARGET_LIBC_PROVIDES_SSP
|
|
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
|
|
- "|fstack-protector-strong|fstack-protector-explicit:}"
|
|
+#define LINK_SSP_SPEC "-lssp_nonshared"
|
|
#else
|
|
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
|
|
"|fstack-protector-strong|fstack-protector-explicit" \
|
|
--- a/gcc/config/i386/gnu-user-common.h
|
|
+++ b/gcc/config/i386/gnu-user-common.h
|
|
@@ -64,9 +64,3 @@ along with GCC; see the file COPYING3. If not see
|
|
|
|
/* Static stack checking is supported by means of probes. */
|
|
#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
|
|
-#define TARGET_CAN_SPLIT_STACK
|
|
-#endif
|
|
--- a/gcc/config/i386/gnu.h
|
|
+++ b/gcc/config/i386/gnu.h
|
|
@@ -40,11 +40,6 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>.
|
|
/* i386 glibc provides __stack_chk_guard in %gs:0x14. */
|
|
#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
|
|
-#define TARGET_CAN_SPLIT_STACK
|
|
-#endif
|
|
/* We steal the last transactional memory word. */
|
|
#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30
|
|
#endif
|