Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/79225?usp=email )
Change subject: crossgcc: Fix build with musl libc ......................................................................
crossgcc: Fix build with musl libc
Work around an include-order issue when building against musl. When <sched.h> is included after GCC's "system.h", the build fails because calloc() is already poisoned by accident:
sched.h:xx:y: error: attempt to use poisoned "calloc"
Change-Id: I8ad28da70ec31aa8f7c6dad7a3371afbb614b86a Signed-off-by: Nico Huber nico.huber@secunet.com --- A util/crossgcc/patches/gcc-13.2.0_musl_poisoned_calloc.patch 1 file changed, 122 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/25/79225/1
diff --git a/util/crossgcc/patches/gcc-13.2.0_musl_poisoned_calloc.patch b/util/crossgcc/patches/gcc-13.2.0_musl_poisoned_calloc.patch new file mode 100644 index 0000000..552a7e7 --- /dev/null +++ b/util/crossgcc/patches/gcc-13.2.0_musl_poisoned_calloc.patch @@ -0,0 +1,122 @@ +Musl's <sched.h> uses calloc() which is marked as poisoned by GCC's +"system.h". Work around that by making sure that <sched.h> gets +included first. + +--- gcc-13.2.0/gcc/ada/adaint.c ++++ gcc-13.2.0.musl/gcc/ada/adaint.c +@@ -101,6 +101,10 @@ + #include <sys/time.h> + #endif + ++#if defined (__linux__) ++#include <sched.h> ++#endif ++ + #ifdef IN_RTS + + #ifdef STANDALONE +@@ -3441,7 +3445,6 @@ + #endif + + #if defined (__linux__) +-#include <sched.h> + + /* glibc versions earlier than 2.7 do not define the routines to handle + dynamically allocated CPU sets. For these targets, we use the static +--- gcc-13.2.0/gcc/ada/argv.c ++++ gcc-13.2.0.musl/gcc/ada/argv.c +@@ -42,6 +42,8 @@ + main program, and these routines are accessed from the + Ada.Command_Line.Environment package. */ + ++#include "adaint.h" ++ + #ifdef IN_RTS + #include "runtime.h" + #include <stdlib.h> +@@ -50,8 +52,6 @@ + #include "config.h" + #include "system.h" + #endif +- +-#include "adaint.h" + + #ifdef __cplusplus + extern "C" { +--- gcc-13.2.0/gcc/ada/cio.c ++++ gcc-13.2.0.musl/gcc/ada/cio.c +@@ -29,6 +29,8 @@ + * * + ****************************************************************************/ + ++#include "adaint.h" ++ + #ifdef IN_RTS + #include "runtime.h" + #include <sys/stat.h> +@@ -36,8 +38,6 @@ + #include "config.h" + #include "system.h" + #endif +- +-#include "adaint.h" + + /* We need L_tmpnam definition */ + #include <stdio.h> +--- gcc-13.2.0/gcc/ada/cstreams.c ++++ gcc-13.2.0.musl/gcc/ada/cstreams.c +@@ -58,14 +58,14 @@ + #include "vxWorks.h" + #endif + ++#include "adaint.h" ++ + #ifdef IN_RTS + #include <string.h> + #else + #include "config.h" + #include "system.h" + #endif +- +-#include "adaint.h" + + #ifdef __cplusplus + extern "C" { +--- gcc-13.2.0/gcc/ada/init.c ++++ gcc-13.2.0.musl/gcc/ada/init.c +@@ -53,6 +53,8 @@ + #undef __linux__ + #endif + ++#include "adaint.h" ++ + #ifdef IN_RTS + + #ifdef STANDALONE +@@ -71,7 +73,6 @@ + #include "system.h" + #endif + +-#include "adaint.h" + #include "raise.h" + + #ifdef __cplusplus +--- gcc-13.2.0/gcc/ada/raise.c ++++ gcc-13.2.0.musl/gcc/ada/raise.c +@@ -32,6 +32,8 @@ + /* Shared routines to support exception handling. __gnat_unhandled_terminate + is shared between all exception handling mechanisms. */ + ++#include "adaint.h" ++ + #ifdef IN_RTS + #include "runtime.h" + #else +@@ -39,7 +41,6 @@ + #include "system.h" + #endif + +-#include "adaint.h" + #include "raise.h" + + #ifdef __cplusplus