Hello, In line of porting the latest build of libgo/go with gcc-12 to GNU/Hurd, support of split-stack was found to be removed. After patching the files in libgo the build of gotools fails: go1: error: '-fsplit-stack' currently only supported on GNU/Linux go1: error: '-fsplit-stack' is not supported by this compiler configuration
The attached patch defines OPTION_GLIBC_P(opts) and OPTION_GLIBC that was lost in config/gnu.h, needed to enable split-stack support for GNU/Hurd. This problem happened with the latest commit as discussed in the mail thread starting with https://gcc.gnu.org/pipermail/gcc-patches/2022-January/588973.html . The file first doing this check is: (first error: ..) src/gcc/common/config/i386/i386-common.cc in function: static bool ix86_supports_split_stack (bool report, struct gcc_options *opts ATTRIBUTE_UNUSED) and secondly in:src/gcc/opts.cc: (second error: ...) in function: void finish_options (struct gcc_options *opts, struct gcc_options *opts_set, location_t loc) The checking logic is in function ix86_supports_split_stack(): #if defined(TARGET_THREAD_SPLIT_STACK_OFFSET) && defined(OPTION_GLIBC_P) if (!OPTION_GLIBC_P (opts)) #endif { if (report) error ("%<-fsplit-stack%> currently only supported on GNU/Linux"); return false; } bool ret = true; In case of GNU/Hurd TARGET_THREAD_SPLIT_STACK_OFFSET is defined as well as OPTION_GLIBC_P but OPTION_GLIBC_P(opts) is needed to. The attached patch to src/gcc/config/gnu.h creates that definition. For GNU/Hurd, gnu.h is included in the configure stage: Configuring stage 1 in ./gcc ... Using the following target machine macro files: ... ../../src/gcc/config/gnu.h For a longer history about this bug see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104290 Additionally, I would propose the text in gcc/common/config/i386/i386-common.cc to change from: error ("%<-fsplit-stack%> currently only supported on GNU/Linux"); to: error ("%<-fsplit-stack%> currently only supported on GLIBC-based systems"); Thanks!
--- a/src/gcc/config/gnu.h 2022-02-06 11:59:41.000000000 +0100 +++ b/src/gcc/config/gnu.h 2022-02-06 12:00:19.000000000 +0100 @@ -19,6 +19,9 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>. */ +#define OPTION_GLIBC_P(opts) (DEFAULT_LIBC == LIBC_GLIBC) +#define OPTION_GLIBC OPTION_GLIBC_P (&global_options) + #undef GNU_USER_TARGET_OS_CPP_BUILTINS #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ do { \