summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorIsmael Luceno2019-05-24 18:44:33 +0200
committerIsmael Luceno2019-05-24 18:42:38 +0200
commit9af493a19d816dac47c82ba211d975beda233bb5 (patch)
treeb0184cb96363a6ff474e68553c2bd85f9917d6d6 /gnu
parent6b39e78c0789cfd74fcf39c7bac21966a4d5d71f (diff)
gcc: Fix build against musl
Diffstat (limited to 'gnu')
-rwxr-xr-xgnu/gcc/BUILD18
-rw-r--r--gnu/gcc/HISTORY3
-rwxr-xr-xgnu/gcc/PRE_BUILD8
-rw-r--r--gnu/gcc/ssp_nonshared.diff14
4 files changed, 41 insertions, 2 deletions
diff --git a/gnu/gcc/BUILD b/gnu/gcc/BUILD
index 57eceb7b4e..a6fe06c01f 100755
--- a/gnu/gcc/BUILD
+++ b/gnu/gcc/BUILD
@@ -1,3 +1,6 @@
+# cc1 compilation fails if the file blocks limit is too low
+ulimit -f unlimited &&
+
. "$GRIMOIRE/FUNCTIONS" &&
# using -pipe causes spurious test-suite failures
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
@@ -96,7 +99,6 @@ if [[ "$GCC_CLOOG" == "y" ]]; then
else
OPTS="--without-isl --without-cloog $OPTS"
fi &&
-OPTS="--enable-lto $OPTS" &&
OPTS="--enable-plugin $OPTS" &&
OPTS="--enable-install-libiberty $OPTS" &&
OPTS="--with-linker-hash-style=gnu $OPTS" &&
@@ -107,6 +109,20 @@ OPTS="--enable-default-ssp $OPTS" &&
OPTS="--enable-cet=auto $OPTS" &&
OPTS="$GCC_MULTILIB $OPTS" &&
+case "$HOST" in
+*-musl)
+ OPTS="--disable-libssp $OPTS" &&
+ OPTS="--disable-libmpx $OPTS" &&
+ OPTS="--disable-libmudflap $OPTS" &&
+ OPTS="--disable-libsanitizer $OPTS" &&
+ OPTS="--disable-symvers $OPTS" &&
+ OPTS="--disable-lto $OPTS"
+ ;;
+*)
+ OPTS="--enable-lto $OPTS"
+ ;;
+esac &&
+
# https://sourceware.org/bugzilla/show_bug.cgi?id=21930
export glibcxx_cv_c99_math_cxx98=yes glibcxx_cv_c99_math_cxx11=yes &&
diff --git a/gnu/gcc/HISTORY b/gnu/gcc/HISTORY
index 28d702e33a..13a6383311 100644
--- a/gnu/gcc/HISTORY
+++ b/gnu/gcc/HISTORY
@@ -1,3 +1,6 @@
+2019-05-24 Ismael Luceno <ismael@sourcemage.org>
+ * BUILD, PRE_BUILD, ssp_nonshared.diff: Fixed build against musl
+
2019-05-19 Remko van der Vossen <wich@sourcemage.org>
* PREPARE: fix warning about invalid options in tablet
* BUILD, DEPENDS: rely on gcc49 to build if current installed gcc
diff --git a/gnu/gcc/PRE_BUILD b/gnu/gcc/PRE_BUILD
index 4ac0589312..3572c671d5 100755
--- a/gnu/gcc/PRE_BUILD
+++ b/gnu/gcc/PRE_BUILD
@@ -34,6 +34,12 @@ sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in &&
if list_find "$GCC_COMPILER" "go"; then
message "${MESSAGE_COLOR}Applying patch for Go header generation...${DEFAULT_COLOR}" &&
patch -p1 < "$SPELL_DIRECTORY/0003-fix-header-generation-for-libgo.patch"
-fi
+fi &&
+
+case "$HOST" in
+*-musl)
+ patch -fp1 -i "$SPELL_DIRECTORY/ssp_nonshared.diff"
+ ;;
+esac
#grep -lR "struct ucontext\>" libgcc | xargs sed -i -e 's/struct ucontext\>/ucontext_t/'
diff --git a/gnu/gcc/ssp_nonshared.diff b/gnu/gcc/ssp_nonshared.diff
new file mode 100644
index 0000000000..2d3e5866a8
--- /dev/null
+++ b/gnu/gcc/ssp_nonshared.diff
@@ -0,0 +1,14 @@
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index c48178f1aa3..e2fae4ef055 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -863,7 +863,8 @@ proper position among the other output files. */
+ #ifndef LINK_SSP_SPEC
+ #ifdef TARGET_LIBC_PROVIDES_SSP
+ #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+- "|fstack-protector-strong|fstack-protector-explicit:}"
++ "|fstack-protector-strong|fstack-protector-explicit" \
++ ":-lssp_nonshared}"
+ #else
+ #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+ "|fstack-protector-strong|fstack-protector-explicit" \