From c08af979852f3dc7a5d3c828873ca44864b6b28d Mon Sep 17 00:00:00 2001 From: Aster Boese Date: Sun, 3 May 2026 14:19:31 +0200 Subject: [PATCH] cross/gcc{4,6}-*: sync with compilers in main/ Signed-off-by: Aster Boese Part-of: --- .../10_all_default-fortify-source.patch | 31 --- cross/gcc4-aarch64/APKBUILD | 80 ++++-- cross/gcc4-aarch64/gcc-4.9-musl-fortify.patch | 11 - cross/gcc4-aarch64/pr64037.patch | 83 ------ .../10_all_default-fortify-source.patch | 31 --- cross/gcc4-armhf/APKBUILD | 80 ++++-- cross/gcc4-armhf/gcc-4.9-musl-fortify.patch | 11 - cross/gcc4-armhf/pr64037.patch | 83 ------ .../10_all_default-fortify-source.patch | 31 --- cross/gcc4-armv7/APKBUILD | 80 ++++-- cross/gcc4-armv7/gcc-4.9-musl-fortify.patch | 11 - cross/gcc4-armv7/pr64037.patch | 83 ------ .../003_all_default-fortify-source.patch | 40 --- cross/gcc6-aarch64/APKBUILD | 78 +++++- cross/gcc6-aarch64/gcc-4.9-musl-fortify.patch | 11 - cross/gcc6-aarch64/gcc-6.4-isl.patch | 251 ++++++++++++++++++ .../003_all_default-fortify-source.patch | 40 --- cross/gcc6-armhf/APKBUILD | 78 +++++- cross/gcc6-armhf/gcc-4.9-musl-fortify.patch | 11 - cross/gcc6-armhf/gcc-6.4-isl.patch | 251 ++++++++++++++++++ .../003_all_default-fortify-source.patch | 40 --- cross/gcc6-armv7/APKBUILD | 78 +++++- cross/gcc6-armv7/gcc-4.9-musl-fortify.patch | 11 - cross/gcc6-armv7/gcc-6.4-isl.patch | 251 ++++++++++++++++++ 24 files changed, 1137 insertions(+), 618 deletions(-) delete mode 100644 cross/gcc4-aarch64/10_all_default-fortify-source.patch delete mode 100644 cross/gcc4-aarch64/gcc-4.9-musl-fortify.patch delete mode 100644 cross/gcc4-aarch64/pr64037.patch delete mode 100644 cross/gcc4-armhf/10_all_default-fortify-source.patch delete mode 100644 cross/gcc4-armhf/gcc-4.9-musl-fortify.patch delete mode 100644 cross/gcc4-armhf/pr64037.patch delete mode 100644 cross/gcc4-armv7/10_all_default-fortify-source.patch delete mode 100644 cross/gcc4-armv7/gcc-4.9-musl-fortify.patch delete mode 100644 cross/gcc4-armv7/pr64037.patch delete mode 100644 cross/gcc6-aarch64/003_all_default-fortify-source.patch delete mode 100644 cross/gcc6-aarch64/gcc-4.9-musl-fortify.patch create mode 100644 cross/gcc6-aarch64/gcc-6.4-isl.patch delete mode 100644 cross/gcc6-armhf/003_all_default-fortify-source.patch delete mode 100644 cross/gcc6-armhf/gcc-4.9-musl-fortify.patch create mode 100644 cross/gcc6-armhf/gcc-6.4-isl.patch delete mode 100644 cross/gcc6-armv7/003_all_default-fortify-source.patch delete mode 100644 cross/gcc6-armv7/gcc-4.9-musl-fortify.patch create mode 100644 cross/gcc6-armv7/gcc-6.4-isl.patch diff --git a/cross/gcc4-aarch64/10_all_default-fortify-source.patch b/cross/gcc4-aarch64/10_all_default-fortify-source.patch deleted file mode 100644 index e74d60cc2..000000000 --- a/cross/gcc4-aarch64/10_all_default-fortify-source.patch +++ /dev/null @@ -1,31 +0,0 @@ -Enable -D_FORTIFY_SOURCE=2 by default. - -Original patch from: -http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.2/gentoo/10_all_default-fortify-source.patch - ---- a/gcc/c-family/c-cppbuiltin.c -+++ b/gcc/c-family/c-cppbuiltin.c -@@ -951,6 +951,9 @@ c_cpp_builtins (cpp_reader *pfile) - builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); - builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); - -+ /* Fortify Source enabled by default w/optimization. */ -+ cpp_define (pfile, "_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)"); -+ - /* Misc. */ - if (flag_gnu89_inline) - cpp_define (pfile, "__GNUC_GNU_INLINE__"); ---- a/gcc/doc/gcc.info -+++ b/gcc/doc/gcc.info -@@ -6255,6 +6255,11 @@ find out the exact set of optimizations that are enabled at each level. - Please note the warning under '-fgcse' about invoking '-O2' on - programs that use computed gotos. - -+ NOTE: In Alpine Linux, `-D_FORTIFY_SOURCE=2' is set by default, and is -+ activated when `-Os' or `-O1' or higher is used. This enables additional -+ compile-time and run-time checks for several libc functions. To disable, -+ specify either `-U_FORTIFY_SOURCE' or `-D_FORTIFY_SOURCE=0'. -+ - '-O3' - Optimize yet more. '-O3' turns on all optimizations specified by - '-O2' and also turns on the '-finline-functions', diff --git a/cross/gcc4-aarch64/APKBUILD b/cross/gcc4-aarch64/APKBUILD index b880f566e..a1c6795e3 100644 --- a/cross/gcc4-aarch64/APKBUILD +++ b/cross/gcc4-aarch64/APKBUILD @@ -1,7 +1,6 @@ # Automatically generated aport, do not edit! # Generator: pmbootstrap aportgen gcc4-aarch64 # Based on: main/gcc4 (from postmarketOS) - CTARGET_ARCH=aarch64 CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})" LANG_D=false @@ -23,19 +22,22 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" +maintainer="" pkgname=gcc4-aarch64 pkgver=9999 -_pkgver=4.9.2 -pkgrel=7 +_pkgver=4.9.4 +pkgrel=10 pkgdesc="Stage2 cross-compiler for aarch64" url="http://gcc.gnu.org" +# loongarch64: not supported +# ppc64le, riscv64: doesn't build arch="x86_64" -license="GPL LGPL" +license="GPL-2.0-or-later AND LGPL-2.1-or-later" _gccrel=$_pkgver-r$pkgrel -depends="binutils-aarch64 mpc1" +depends="binutils-aarch64 mpc1 so:libc.musl-x86_64.so.1 so:libgcc_s.so.1 so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libstdc++.so.6 so:libz.so.1" makedepends_build="gcc g++ bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev" makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-aarch64 binutils-aarch64" -options="!strip" +options="!strip !tracedeps toolchain" # We only care about C, so we can compile old Linux kernels LANG_CXX=false @@ -67,11 +69,23 @@ if [ "$CHOST" != "$CTARGET" ]; then LIBATOMIC=false LIBITM=false + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 4 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS export CFLAGS_FOR_TARGET=" " export CXXFLAGS_FOR_TARGET=" " @@ -79,10 +93,23 @@ if [ "$CHOST" != "$CTARGET" ]; then STRIP_FOR_TARGET="$CTARGET-strip" elif [ "$CBUILD" != "$CHOST" ]; then + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 4 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS # reset flags and cc for build @@ -106,6 +133,31 @@ elif [ "$CBUILD" != "$CHOST" ]; then else STRIP_FOR_TARGET=${CROSS_COMPILE}strip _builddir="$srcdir/build" + + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 4 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) + # fixup flags. seems gcc treats CPPFLAGS as global without + # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. + export CFLAGS="$CPPFLAGS -g0 $CFLAGS -O2" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS -O2" + unset CPPFLAGS + # https://gcc.gnu.org/install/build.html + export CFLAGS_FOR_TARGET="$CFLAGS" + export CXXFLAGS_FOR_TARGET="$CXXFLAGS" + export LDFLAGS_FOR_TARGET="$LDFLAGS" + export BOOT_CFLAGS="$CFLAGS" + export BOOT_LDFLAGS="$LDFLAGS" fi # Go needs {set,make,swap}context, unimplemented in musl @@ -176,7 +228,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg 40_all_gcc49_config_esp.patch 41_all_gcc49_config_esp_alpine.patch - 10_all_default-fortify-source.patch 12_all_default-warn-trampolines.patch 15_all_libgfortran-Werror.patch 16_all_libgomp-Werror.patch @@ -193,7 +244,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg gcc-4.9-musl.patch gcc-4.8-musl-fix-iteratephdr.patch gcc-4.8-musl-libssp.patch - gcc-4.9-musl-fortify.patch boehm-gc-uclibc.patch boehm-gc-musl.patch gcc-pure64.patch @@ -201,7 +251,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg fix-gcj-iconv-musl.patch musl-posix_memalign-c++.patch pr63740.patch - pr64037.patch gcc-4.8-build-args.patch fix-cxxflags-passing.patch @@ -435,7 +484,7 @@ package() { } sha512sums=" -35a1386ae2b8629cd464383fbb3c61e94a07f3691f48b8029b97cc62a60c792ffb870aad2343b2ad8185bf46f77e1e1dd62309ecdadc42f919874c6e2c58b936 gcc-4.9.2.tar.gz +ca0f589f33987755195e81a9c7a83f797cfe5775fca908d025eb3ddbe8857edd666d272c2e97088c1808b268c5785326b72f2a340a277f6aa2c9bfe22c02ad69 gcc-4.9.4.tar.gz 28f8c6fdbcb19e950b1d0bafb3bcc7a8cba87bc673aa6027cece116599cdee80f0cf5e95a1440544890239f5c754e8a93ab46d9daedd937faef445d7ea33b226 ecj-4.9.jar 618a8d037ccad15e60182acc9c85ba844cb9b5800a22ece0b814e43541b01b4e390a2847f86debb351f4b05580241747fde87e86a17060744e7bb2b9a3dc5bd4 01_all_gcc49_configure.patch 21770259c7916e55568027926e4a543eea468b04436cc61c28f749be5a6635c48e68b7924a8eb19a76733a9d2f00921ba06faddaedbf14b1cdad5ab1810cc6c6 02_all_gcc48_config.in.patch @@ -448,7 +497,6 @@ dd5b9b30eb7716cb3c010ca79a83ed6219ff6e6f2557deb4e1d26cecac0f2b14c4ef7bf4dc5c2aec 8829f85323d8b11e26e3c19ced4a51875fc63f1483cfdc4d0f579a6cb37e1b6e23fcf33a87a574a6e0007250374ea46d117a136e73a40fbe43f0e39d9b2dd1a8 35_all_gcc48_config_arm.patch 976994900d20a448b97fa91e1d758b6da6d8ad9121b3dbc2e8f66ff8006d8e496cd3dddc41394db6c4d20366d56fe12375b97f494d6fb9abb8e64ab626acc2ef 40_all_gcc49_config_esp.patch e2d027be2e76a64a607ae44566d163bcc2a03c9e14d5bd20cd8bb15c2e9e395d8964b747a6a9c49541a5d1613d721855b73d60cce7c834427b44788fa92d44dc 41_all_gcc49_config_esp_alpine.patch -6cdac0741568b418af1e267a69b487e48a98e319f5ec8ab2bad293f2520ceced40c7df7ddef84963f5b101b94f34e441574c501ef3993ded097beb7c9d3b205f 10_all_default-fortify-source.patch 5069e4b741488913a646a9b5d871af8e7f7a606158ea09305d0ddd46257c5b659770627bc2ca3abeaae039da1717b3ba6c9cd90554a441da74eb4ecf24c13074 12_all_default-warn-trampolines.patch c18a99b7303a734fe4dca9d4e90e21d18e5bd71c7d91e1a26c86b1354c73f567590a875941bfe64ce59f0393023b91c606c96b30885c55b98a790c3ab0c84ca7 15_all_libgfortran-Werror.patch 433404fd9bfa172d69fff4a5505e8648cbbbf5f052d2b4235608ff7af0c4063d557d25d80c85c5bd0d1e1ed64b568e7bbc0cdbce11cc74db4c0189af3a01634a 16_all_libgomp-Werror.patch @@ -464,7 +512,6 @@ d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2 e2be926c0ed4d67587857652678253a2a4e42294009a0c4b9fc420e53b0e6d44d1a2c6c2c62db837bc010470e9e62eb4af1ba7f51ff507c41e40922cd022dd26 gcc-4.9-musl.patch b5b0210dfaccfe0b06f0a9090666b1fae2a3faa4140b7930146b29531f0da9beb1f2c1f7e7bc2bd29179f9fe05dc30e246e96220b8ff75a90f75e8350c9058a1 gcc-4.8-musl-fix-iteratephdr.patch e6d9b103c128e5d4eca515b1496d78b05708de770597c883daddd95ea41e77b5ef1be613b989357cc870a7efd9e43b011022c2d302e7056cff7b69e764906ff2 gcc-4.8-musl-libssp.patch -600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch e1d6a450dfb40b134ad7f759c4c10174d2490b0093fe47cb33479245f26a3a8c54ebcf6255943c0ccfcb5095600d1c05e530baeed35609c8ffe75caac8e57c49 boehm-gc-uclibc.patch bda845a6aa1854d2c883910b115f79ccfa93dfc2b5eac69a3a236d83eb34cadc140731d616ffc24698c7abc8878dd15f231bcc5119f1860e575a120b311706c7 boehm-gc-musl.patch 4a5aeff0399782c752e6e3f2f48d984b2056dfb5d229b23a24eee1562d241339989b2203f139821cfc03c9b25c9bd7da6ccbbdc7a09d242e4de7f0d606c6f63c gcc-pure64.patch @@ -472,7 +519,6 @@ f89ddeb21bc8f97e6a850a6b70b4501a8f3e49a4bc8cc82897488decda5d98ad01cb7f6c8b392d45 54d67cc008b735e47771314171930c5d8b8f5f5dc97fcf4214824c105c808f3e75d22d5a4fdf5068ed0457fa0d46c60cfb442e276259a4a5e9b8722a027d18e6 fix-gcj-iconv-musl.patch 7de81fc8c7eb36690949eb30082515454978440a8f389b12407ac5e9125ef6824d6059ffb5b063ab1ccc6c4827b1a6a0984b538f056b85e3171800a6f723ec8b musl-posix_memalign-c++.patch 095281d940ad7504ed7071cc9800d81db33eb4aa5465696ef7b12bf1213dbdfa701f4392095c5167b331c38219b19d25a0798524b319f1c77aa8522d76d8c92c pr63740.patch -efc04b179d41b484eddddc56d0e442634995d56c994e6295ae09b9856ab46649d5f45f51ea84494ab39df41c213772d0e68aee67e66fdf340f0a647b55629ced pr64037.patch abe9aaf9aa956058d0386a4396a511d176a46bb3906b90e952383646cdc158cbeb0a5dc616a1ccb1ca7d49fd0b5e351532aa15a3b13362abbf1ca4266f54a687 gcc-4.8-build-args.patch 35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch c731f4aaaa65c8950e1b2bd9331410f92d378fd8c7e718532dccaa27ee11984d51d74216c3611e89a802325b81d7f184116839dce2dab50cae9b643c20a82fe7 fix-cxxflags-for-target.patch diff --git a/cross/gcc4-aarch64/gcc-4.9-musl-fortify.patch b/cross/gcc4-aarch64/gcc-4.9-musl-fortify.patch deleted file mode 100644 index daae954c8..000000000 --- a/cross/gcc4-aarch64/gcc-4.9-musl-fortify.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.9.2/gcc/config/linux.h.orig 2015-03-09 13:27:13.289736710 +0000 -+++ gcc-4.9.2/gcc/config/linux.h 2015-03-09 13:29:32.295625046 +0000 -@@ -146,6 +146,8 @@ - - #ifdef NATIVE_SYSTEM_HEADER_DIR - #define INCLUDE_DEFAULTS_MUSL_NATIVE \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, - #else diff --git a/cross/gcc4-aarch64/pr64037.patch b/cross/gcc4-aarch64/pr64037.patch deleted file mode 100644 index 6b08a5117..000000000 --- a/cross/gcc4-aarch64/pr64037.patch +++ /dev/null @@ -1,83 +0,0 @@ -https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=0817dc6f0e6b973e0e3671eb72d3758a8f042324 -(changelog changes removed) - -From 0817dc6f0e6b973e0e3671eb72d3758a8f042324 Mon Sep 17 00:00:00 2001 -From: hjl -Date: Sun, 14 Dec 2014 16:07:03 +0000 -Subject: [PATCH] Pass unpromoted argument to promote_function_mode - -This patch updates setup_incoming_promotions in combine.c to match what -is actually passed in assign_parm_setup_reg in function.c. - -Backported from mainline: - -gcc/ - - PR rtl-optimization/64037 - * combine.c (setup_incoming_promotions): Pass the argument - before any promotions happen to promote_function_mode. - -gcc/testsuite/ - - PR rtl-optimization/64037 - * g++.dg/pr64037.C: New test. - - -git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@218721 138bc75d-0d04-0410-961f-82ee72b054a4 ---- - gcc/combine.c | 4 ++-- - gcc/testsuite/g++.dg/pr64037.C | 27 +++++++++++++++++++++++++++ - 4 files changed, 46 insertions(+), 2 deletions(-) - create mode 100644 gcc/testsuite/g++.dg/pr64037.C - -diff --git a/gcc/combine.c b/gcc/combine.c -index 7c00452..adea2c1 100644 ---- a/gcc/combine.c -+++ b/gcc/combine.c -@@ -1529,8 +1529,8 @@ setup_incoming_promotions (rtx first) - uns3 = TYPE_UNSIGNED (DECL_ARG_TYPE (arg)); - - /* The mode and signedness of the argument as it is actually passed, -- after any TARGET_PROMOTE_FUNCTION_ARGS-driven ABI promotions. */ -- mode3 = promote_function_mode (DECL_ARG_TYPE (arg), mode2, &uns3, -+ see assign_parm_setup_reg in function.c. */ -+ mode3 = promote_function_mode (TREE_TYPE (arg), mode1, &uns3, - TREE_TYPE (cfun->decl), 0); - - /* The mode of the register in which the argument is being passed. */ -diff --git a/gcc/testsuite/g++.dg/pr64037.C b/gcc/testsuite/g++.dg/pr64037.C -new file mode 100644 -index 0000000..e5cd0e2 ---- /dev/null -+++ b/gcc/testsuite/g++.dg/pr64037.C -@@ -0,0 +1,27 @@ -+// { dg-do run { target i?86-*-* x86_64-*-* } } -+// { dg-options "-std=c++11 -Os" } -+ -+enum class X : unsigned char { -+ V = 2, -+}; -+ -+static void -+__attribute__((noinline,noclone)) -+foo(unsigned &out, unsigned a, X b) -+{ -+ out = static_cast(b); -+} -+ -+int main() -+{ -+ unsigned deadbeef = 0xDEADBEEF; -+ asm volatile ("" : "+d" (deadbeef), "+c" (deadbeef)); -+ -+ unsigned out; -+ foo(out, 2, X::V); -+ -+ if (out != 2) -+ __builtin_abort (); -+ -+ return 0; -+} --- -1.7.1 - diff --git a/cross/gcc4-armhf/10_all_default-fortify-source.patch b/cross/gcc4-armhf/10_all_default-fortify-source.patch deleted file mode 100644 index e74d60cc2..000000000 --- a/cross/gcc4-armhf/10_all_default-fortify-source.patch +++ /dev/null @@ -1,31 +0,0 @@ -Enable -D_FORTIFY_SOURCE=2 by default. - -Original patch from: -http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.2/gentoo/10_all_default-fortify-source.patch - ---- a/gcc/c-family/c-cppbuiltin.c -+++ b/gcc/c-family/c-cppbuiltin.c -@@ -951,6 +951,9 @@ c_cpp_builtins (cpp_reader *pfile) - builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); - builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); - -+ /* Fortify Source enabled by default w/optimization. */ -+ cpp_define (pfile, "_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)"); -+ - /* Misc. */ - if (flag_gnu89_inline) - cpp_define (pfile, "__GNUC_GNU_INLINE__"); ---- a/gcc/doc/gcc.info -+++ b/gcc/doc/gcc.info -@@ -6255,6 +6255,11 @@ find out the exact set of optimizations that are enabled at each level. - Please note the warning under '-fgcse' about invoking '-O2' on - programs that use computed gotos. - -+ NOTE: In Alpine Linux, `-D_FORTIFY_SOURCE=2' is set by default, and is -+ activated when `-Os' or `-O1' or higher is used. This enables additional -+ compile-time and run-time checks for several libc functions. To disable, -+ specify either `-U_FORTIFY_SOURCE' or `-D_FORTIFY_SOURCE=0'. -+ - '-O3' - Optimize yet more. '-O3' turns on all optimizations specified by - '-O2' and also turns on the '-finline-functions', diff --git a/cross/gcc4-armhf/APKBUILD b/cross/gcc4-armhf/APKBUILD index 6abb55d6d..b654dd75a 100644 --- a/cross/gcc4-armhf/APKBUILD +++ b/cross/gcc4-armhf/APKBUILD @@ -1,7 +1,6 @@ # Automatically generated aport, do not edit! # Generator: pmbootstrap aportgen gcc4-armhf # Based on: main/gcc4 (from postmarketOS) - CTARGET_ARCH=armhf CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})" LANG_D=false @@ -23,19 +22,22 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" +maintainer="" pkgname=gcc4-armhf pkgver=9999 -_pkgver=4.9.2 -pkgrel=7 +_pkgver=4.9.4 +pkgrel=10 pkgdesc="Stage2 cross-compiler for armhf" url="http://gcc.gnu.org" +# loongarch64: not supported +# ppc64le, riscv64: doesn't build arch="x86_64" -license="GPL LGPL" +license="GPL-2.0-or-later AND LGPL-2.1-or-later" _gccrel=$_pkgver-r$pkgrel -depends="binutils-armhf mpc1" +depends="binutils-armhf mpc1 so:libc.musl-x86_64.so.1 so:libgcc_s.so.1 so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libstdc++.so.6 so:libz.so.1" makedepends_build="gcc g++ bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev" makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-armhf binutils-armhf" -options="!strip" +options="!strip !tracedeps toolchain" # We only care about C, so we can compile old Linux kernels LANG_CXX=false @@ -67,11 +69,23 @@ if [ "$CHOST" != "$CTARGET" ]; then LIBATOMIC=false LIBITM=false + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 4 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS export CFLAGS_FOR_TARGET=" " export CXXFLAGS_FOR_TARGET=" " @@ -79,10 +93,23 @@ if [ "$CHOST" != "$CTARGET" ]; then STRIP_FOR_TARGET="$CTARGET-strip" elif [ "$CBUILD" != "$CHOST" ]; then + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 4 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS # reset flags and cc for build @@ -106,6 +133,31 @@ elif [ "$CBUILD" != "$CHOST" ]; then else STRIP_FOR_TARGET=${CROSS_COMPILE}strip _builddir="$srcdir/build" + + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 4 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) + # fixup flags. seems gcc treats CPPFLAGS as global without + # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. + export CFLAGS="$CPPFLAGS -g0 $CFLAGS -O2" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS -O2" + unset CPPFLAGS + # https://gcc.gnu.org/install/build.html + export CFLAGS_FOR_TARGET="$CFLAGS" + export CXXFLAGS_FOR_TARGET="$CXXFLAGS" + export LDFLAGS_FOR_TARGET="$LDFLAGS" + export BOOT_CFLAGS="$CFLAGS" + export BOOT_LDFLAGS="$LDFLAGS" fi # Go needs {set,make,swap}context, unimplemented in musl @@ -176,7 +228,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg 40_all_gcc49_config_esp.patch 41_all_gcc49_config_esp_alpine.patch - 10_all_default-fortify-source.patch 12_all_default-warn-trampolines.patch 15_all_libgfortran-Werror.patch 16_all_libgomp-Werror.patch @@ -193,7 +244,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg gcc-4.9-musl.patch gcc-4.8-musl-fix-iteratephdr.patch gcc-4.8-musl-libssp.patch - gcc-4.9-musl-fortify.patch boehm-gc-uclibc.patch boehm-gc-musl.patch gcc-pure64.patch @@ -201,7 +251,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg fix-gcj-iconv-musl.patch musl-posix_memalign-c++.patch pr63740.patch - pr64037.patch gcc-4.8-build-args.patch fix-cxxflags-passing.patch @@ -435,7 +484,7 @@ package() { } sha512sums=" -35a1386ae2b8629cd464383fbb3c61e94a07f3691f48b8029b97cc62a60c792ffb870aad2343b2ad8185bf46f77e1e1dd62309ecdadc42f919874c6e2c58b936 gcc-4.9.2.tar.gz +ca0f589f33987755195e81a9c7a83f797cfe5775fca908d025eb3ddbe8857edd666d272c2e97088c1808b268c5785326b72f2a340a277f6aa2c9bfe22c02ad69 gcc-4.9.4.tar.gz 28f8c6fdbcb19e950b1d0bafb3bcc7a8cba87bc673aa6027cece116599cdee80f0cf5e95a1440544890239f5c754e8a93ab46d9daedd937faef445d7ea33b226 ecj-4.9.jar 618a8d037ccad15e60182acc9c85ba844cb9b5800a22ece0b814e43541b01b4e390a2847f86debb351f4b05580241747fde87e86a17060744e7bb2b9a3dc5bd4 01_all_gcc49_configure.patch 21770259c7916e55568027926e4a543eea468b04436cc61c28f749be5a6635c48e68b7924a8eb19a76733a9d2f00921ba06faddaedbf14b1cdad5ab1810cc6c6 02_all_gcc48_config.in.patch @@ -448,7 +497,6 @@ dd5b9b30eb7716cb3c010ca79a83ed6219ff6e6f2557deb4e1d26cecac0f2b14c4ef7bf4dc5c2aec 8829f85323d8b11e26e3c19ced4a51875fc63f1483cfdc4d0f579a6cb37e1b6e23fcf33a87a574a6e0007250374ea46d117a136e73a40fbe43f0e39d9b2dd1a8 35_all_gcc48_config_arm.patch 976994900d20a448b97fa91e1d758b6da6d8ad9121b3dbc2e8f66ff8006d8e496cd3dddc41394db6c4d20366d56fe12375b97f494d6fb9abb8e64ab626acc2ef 40_all_gcc49_config_esp.patch e2d027be2e76a64a607ae44566d163bcc2a03c9e14d5bd20cd8bb15c2e9e395d8964b747a6a9c49541a5d1613d721855b73d60cce7c834427b44788fa92d44dc 41_all_gcc49_config_esp_alpine.patch -6cdac0741568b418af1e267a69b487e48a98e319f5ec8ab2bad293f2520ceced40c7df7ddef84963f5b101b94f34e441574c501ef3993ded097beb7c9d3b205f 10_all_default-fortify-source.patch 5069e4b741488913a646a9b5d871af8e7f7a606158ea09305d0ddd46257c5b659770627bc2ca3abeaae039da1717b3ba6c9cd90554a441da74eb4ecf24c13074 12_all_default-warn-trampolines.patch c18a99b7303a734fe4dca9d4e90e21d18e5bd71c7d91e1a26c86b1354c73f567590a875941bfe64ce59f0393023b91c606c96b30885c55b98a790c3ab0c84ca7 15_all_libgfortran-Werror.patch 433404fd9bfa172d69fff4a5505e8648cbbbf5f052d2b4235608ff7af0c4063d557d25d80c85c5bd0d1e1ed64b568e7bbc0cdbce11cc74db4c0189af3a01634a 16_all_libgomp-Werror.patch @@ -464,7 +512,6 @@ d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2 e2be926c0ed4d67587857652678253a2a4e42294009a0c4b9fc420e53b0e6d44d1a2c6c2c62db837bc010470e9e62eb4af1ba7f51ff507c41e40922cd022dd26 gcc-4.9-musl.patch b5b0210dfaccfe0b06f0a9090666b1fae2a3faa4140b7930146b29531f0da9beb1f2c1f7e7bc2bd29179f9fe05dc30e246e96220b8ff75a90f75e8350c9058a1 gcc-4.8-musl-fix-iteratephdr.patch e6d9b103c128e5d4eca515b1496d78b05708de770597c883daddd95ea41e77b5ef1be613b989357cc870a7efd9e43b011022c2d302e7056cff7b69e764906ff2 gcc-4.8-musl-libssp.patch -600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch e1d6a450dfb40b134ad7f759c4c10174d2490b0093fe47cb33479245f26a3a8c54ebcf6255943c0ccfcb5095600d1c05e530baeed35609c8ffe75caac8e57c49 boehm-gc-uclibc.patch bda845a6aa1854d2c883910b115f79ccfa93dfc2b5eac69a3a236d83eb34cadc140731d616ffc24698c7abc8878dd15f231bcc5119f1860e575a120b311706c7 boehm-gc-musl.patch 4a5aeff0399782c752e6e3f2f48d984b2056dfb5d229b23a24eee1562d241339989b2203f139821cfc03c9b25c9bd7da6ccbbdc7a09d242e4de7f0d606c6f63c gcc-pure64.patch @@ -472,7 +519,6 @@ f89ddeb21bc8f97e6a850a6b70b4501a8f3e49a4bc8cc82897488decda5d98ad01cb7f6c8b392d45 54d67cc008b735e47771314171930c5d8b8f5f5dc97fcf4214824c105c808f3e75d22d5a4fdf5068ed0457fa0d46c60cfb442e276259a4a5e9b8722a027d18e6 fix-gcj-iconv-musl.patch 7de81fc8c7eb36690949eb30082515454978440a8f389b12407ac5e9125ef6824d6059ffb5b063ab1ccc6c4827b1a6a0984b538f056b85e3171800a6f723ec8b musl-posix_memalign-c++.patch 095281d940ad7504ed7071cc9800d81db33eb4aa5465696ef7b12bf1213dbdfa701f4392095c5167b331c38219b19d25a0798524b319f1c77aa8522d76d8c92c pr63740.patch -efc04b179d41b484eddddc56d0e442634995d56c994e6295ae09b9856ab46649d5f45f51ea84494ab39df41c213772d0e68aee67e66fdf340f0a647b55629ced pr64037.patch abe9aaf9aa956058d0386a4396a511d176a46bb3906b90e952383646cdc158cbeb0a5dc616a1ccb1ca7d49fd0b5e351532aa15a3b13362abbf1ca4266f54a687 gcc-4.8-build-args.patch 35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch c731f4aaaa65c8950e1b2bd9331410f92d378fd8c7e718532dccaa27ee11984d51d74216c3611e89a802325b81d7f184116839dce2dab50cae9b643c20a82fe7 fix-cxxflags-for-target.patch diff --git a/cross/gcc4-armhf/gcc-4.9-musl-fortify.patch b/cross/gcc4-armhf/gcc-4.9-musl-fortify.patch deleted file mode 100644 index daae954c8..000000000 --- a/cross/gcc4-armhf/gcc-4.9-musl-fortify.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.9.2/gcc/config/linux.h.orig 2015-03-09 13:27:13.289736710 +0000 -+++ gcc-4.9.2/gcc/config/linux.h 2015-03-09 13:29:32.295625046 +0000 -@@ -146,6 +146,8 @@ - - #ifdef NATIVE_SYSTEM_HEADER_DIR - #define INCLUDE_DEFAULTS_MUSL_NATIVE \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, - #else diff --git a/cross/gcc4-armhf/pr64037.patch b/cross/gcc4-armhf/pr64037.patch deleted file mode 100644 index 6b08a5117..000000000 --- a/cross/gcc4-armhf/pr64037.patch +++ /dev/null @@ -1,83 +0,0 @@ -https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=0817dc6f0e6b973e0e3671eb72d3758a8f042324 -(changelog changes removed) - -From 0817dc6f0e6b973e0e3671eb72d3758a8f042324 Mon Sep 17 00:00:00 2001 -From: hjl -Date: Sun, 14 Dec 2014 16:07:03 +0000 -Subject: [PATCH] Pass unpromoted argument to promote_function_mode - -This patch updates setup_incoming_promotions in combine.c to match what -is actually passed in assign_parm_setup_reg in function.c. - -Backported from mainline: - -gcc/ - - PR rtl-optimization/64037 - * combine.c (setup_incoming_promotions): Pass the argument - before any promotions happen to promote_function_mode. - -gcc/testsuite/ - - PR rtl-optimization/64037 - * g++.dg/pr64037.C: New test. - - -git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@218721 138bc75d-0d04-0410-961f-82ee72b054a4 ---- - gcc/combine.c | 4 ++-- - gcc/testsuite/g++.dg/pr64037.C | 27 +++++++++++++++++++++++++++ - 4 files changed, 46 insertions(+), 2 deletions(-) - create mode 100644 gcc/testsuite/g++.dg/pr64037.C - -diff --git a/gcc/combine.c b/gcc/combine.c -index 7c00452..adea2c1 100644 ---- a/gcc/combine.c -+++ b/gcc/combine.c -@@ -1529,8 +1529,8 @@ setup_incoming_promotions (rtx first) - uns3 = TYPE_UNSIGNED (DECL_ARG_TYPE (arg)); - - /* The mode and signedness of the argument as it is actually passed, -- after any TARGET_PROMOTE_FUNCTION_ARGS-driven ABI promotions. */ -- mode3 = promote_function_mode (DECL_ARG_TYPE (arg), mode2, &uns3, -+ see assign_parm_setup_reg in function.c. */ -+ mode3 = promote_function_mode (TREE_TYPE (arg), mode1, &uns3, - TREE_TYPE (cfun->decl), 0); - - /* The mode of the register in which the argument is being passed. */ -diff --git a/gcc/testsuite/g++.dg/pr64037.C b/gcc/testsuite/g++.dg/pr64037.C -new file mode 100644 -index 0000000..e5cd0e2 ---- /dev/null -+++ b/gcc/testsuite/g++.dg/pr64037.C -@@ -0,0 +1,27 @@ -+// { dg-do run { target i?86-*-* x86_64-*-* } } -+// { dg-options "-std=c++11 -Os" } -+ -+enum class X : unsigned char { -+ V = 2, -+}; -+ -+static void -+__attribute__((noinline,noclone)) -+foo(unsigned &out, unsigned a, X b) -+{ -+ out = static_cast(b); -+} -+ -+int main() -+{ -+ unsigned deadbeef = 0xDEADBEEF; -+ asm volatile ("" : "+d" (deadbeef), "+c" (deadbeef)); -+ -+ unsigned out; -+ foo(out, 2, X::V); -+ -+ if (out != 2) -+ __builtin_abort (); -+ -+ return 0; -+} --- -1.7.1 - diff --git a/cross/gcc4-armv7/10_all_default-fortify-source.patch b/cross/gcc4-armv7/10_all_default-fortify-source.patch deleted file mode 100644 index e74d60cc2..000000000 --- a/cross/gcc4-armv7/10_all_default-fortify-source.patch +++ /dev/null @@ -1,31 +0,0 @@ -Enable -D_FORTIFY_SOURCE=2 by default. - -Original patch from: -http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.2/gentoo/10_all_default-fortify-source.patch - ---- a/gcc/c-family/c-cppbuiltin.c -+++ b/gcc/c-family/c-cppbuiltin.c -@@ -951,6 +951,9 @@ c_cpp_builtins (cpp_reader *pfile) - builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); - builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); - -+ /* Fortify Source enabled by default w/optimization. */ -+ cpp_define (pfile, "_FORTIFY_SOURCE=((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)"); -+ - /* Misc. */ - if (flag_gnu89_inline) - cpp_define (pfile, "__GNUC_GNU_INLINE__"); ---- a/gcc/doc/gcc.info -+++ b/gcc/doc/gcc.info -@@ -6255,6 +6255,11 @@ find out the exact set of optimizations that are enabled at each level. - Please note the warning under '-fgcse' about invoking '-O2' on - programs that use computed gotos. - -+ NOTE: In Alpine Linux, `-D_FORTIFY_SOURCE=2' is set by default, and is -+ activated when `-Os' or `-O1' or higher is used. This enables additional -+ compile-time and run-time checks for several libc functions. To disable, -+ specify either `-U_FORTIFY_SOURCE' or `-D_FORTIFY_SOURCE=0'. -+ - '-O3' - Optimize yet more. '-O3' turns on all optimizations specified by - '-O2' and also turns on the '-finline-functions', diff --git a/cross/gcc4-armv7/APKBUILD b/cross/gcc4-armv7/APKBUILD index f78c2310f..13d62bed0 100644 --- a/cross/gcc4-armv7/APKBUILD +++ b/cross/gcc4-armv7/APKBUILD @@ -1,7 +1,6 @@ # Automatically generated aport, do not edit! # Generator: pmbootstrap aportgen gcc4-armv7 # Based on: main/gcc4 (from postmarketOS) - CTARGET_ARCH=armv7 CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})" LANG_D=false @@ -23,19 +22,22 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" +maintainer="" pkgname=gcc4-armv7 pkgver=9999 -_pkgver=4.9.2 -pkgrel=7 +_pkgver=4.9.4 +pkgrel=10 pkgdesc="Stage2 cross-compiler for armv7" url="http://gcc.gnu.org" +# loongarch64: not supported +# ppc64le, riscv64: doesn't build arch="x86_64" -license="GPL LGPL" +license="GPL-2.0-or-later AND LGPL-2.1-or-later" _gccrel=$_pkgver-r$pkgrel -depends="binutils-armv7 mpc1" +depends="binutils-armv7 mpc1 so:libc.musl-x86_64.so.1 so:libgcc_s.so.1 so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libstdc++.so.6 so:libz.so.1" makedepends_build="gcc g++ bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev" makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-armv7 binutils-armv7" -options="!strip" +options="!strip !tracedeps toolchain" # We only care about C, so we can compile old Linux kernels LANG_CXX=false @@ -67,11 +69,23 @@ if [ "$CHOST" != "$CTARGET" ]; then LIBATOMIC=false LIBITM=false + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 4 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS export CFLAGS_FOR_TARGET=" " export CXXFLAGS_FOR_TARGET=" " @@ -79,10 +93,23 @@ if [ "$CHOST" != "$CTARGET" ]; then STRIP_FOR_TARGET="$CTARGET-strip" elif [ "$CBUILD" != "$CHOST" ]; then + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 4 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS # reset flags and cc for build @@ -106,6 +133,31 @@ elif [ "$CBUILD" != "$CHOST" ]; then else STRIP_FOR_TARGET=${CROSS_COMPILE}strip _builddir="$srcdir/build" + + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 4 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) + # fixup flags. seems gcc treats CPPFLAGS as global without + # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. + export CFLAGS="$CPPFLAGS -g0 $CFLAGS -O2" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS -O2" + unset CPPFLAGS + # https://gcc.gnu.org/install/build.html + export CFLAGS_FOR_TARGET="$CFLAGS" + export CXXFLAGS_FOR_TARGET="$CXXFLAGS" + export LDFLAGS_FOR_TARGET="$LDFLAGS" + export BOOT_CFLAGS="$CFLAGS" + export BOOT_LDFLAGS="$LDFLAGS" fi # Go needs {set,make,swap}context, unimplemented in musl @@ -176,7 +228,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg 40_all_gcc49_config_esp.patch 41_all_gcc49_config_esp_alpine.patch - 10_all_default-fortify-source.patch 12_all_default-warn-trampolines.patch 15_all_libgfortran-Werror.patch 16_all_libgomp-Werror.patch @@ -193,7 +244,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg gcc-4.9-musl.patch gcc-4.8-musl-fix-iteratephdr.patch gcc-4.8-musl-libssp.patch - gcc-4.9-musl-fortify.patch boehm-gc-uclibc.patch boehm-gc-musl.patch gcc-pure64.patch @@ -201,7 +251,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg fix-gcj-iconv-musl.patch musl-posix_memalign-c++.patch pr63740.patch - pr64037.patch gcc-4.8-build-args.patch fix-cxxflags-passing.patch @@ -435,7 +484,7 @@ package() { } sha512sums=" -35a1386ae2b8629cd464383fbb3c61e94a07f3691f48b8029b97cc62a60c792ffb870aad2343b2ad8185bf46f77e1e1dd62309ecdadc42f919874c6e2c58b936 gcc-4.9.2.tar.gz +ca0f589f33987755195e81a9c7a83f797cfe5775fca908d025eb3ddbe8857edd666d272c2e97088c1808b268c5785326b72f2a340a277f6aa2c9bfe22c02ad69 gcc-4.9.4.tar.gz 28f8c6fdbcb19e950b1d0bafb3bcc7a8cba87bc673aa6027cece116599cdee80f0cf5e95a1440544890239f5c754e8a93ab46d9daedd937faef445d7ea33b226 ecj-4.9.jar 618a8d037ccad15e60182acc9c85ba844cb9b5800a22ece0b814e43541b01b4e390a2847f86debb351f4b05580241747fde87e86a17060744e7bb2b9a3dc5bd4 01_all_gcc49_configure.patch 21770259c7916e55568027926e4a543eea468b04436cc61c28f749be5a6635c48e68b7924a8eb19a76733a9d2f00921ba06faddaedbf14b1cdad5ab1810cc6c6 02_all_gcc48_config.in.patch @@ -448,7 +497,6 @@ dd5b9b30eb7716cb3c010ca79a83ed6219ff6e6f2557deb4e1d26cecac0f2b14c4ef7bf4dc5c2aec 8829f85323d8b11e26e3c19ced4a51875fc63f1483cfdc4d0f579a6cb37e1b6e23fcf33a87a574a6e0007250374ea46d117a136e73a40fbe43f0e39d9b2dd1a8 35_all_gcc48_config_arm.patch 976994900d20a448b97fa91e1d758b6da6d8ad9121b3dbc2e8f66ff8006d8e496cd3dddc41394db6c4d20366d56fe12375b97f494d6fb9abb8e64ab626acc2ef 40_all_gcc49_config_esp.patch e2d027be2e76a64a607ae44566d163bcc2a03c9e14d5bd20cd8bb15c2e9e395d8964b747a6a9c49541a5d1613d721855b73d60cce7c834427b44788fa92d44dc 41_all_gcc49_config_esp_alpine.patch -6cdac0741568b418af1e267a69b487e48a98e319f5ec8ab2bad293f2520ceced40c7df7ddef84963f5b101b94f34e441574c501ef3993ded097beb7c9d3b205f 10_all_default-fortify-source.patch 5069e4b741488913a646a9b5d871af8e7f7a606158ea09305d0ddd46257c5b659770627bc2ca3abeaae039da1717b3ba6c9cd90554a441da74eb4ecf24c13074 12_all_default-warn-trampolines.patch c18a99b7303a734fe4dca9d4e90e21d18e5bd71c7d91e1a26c86b1354c73f567590a875941bfe64ce59f0393023b91c606c96b30885c55b98a790c3ab0c84ca7 15_all_libgfortran-Werror.patch 433404fd9bfa172d69fff4a5505e8648cbbbf5f052d2b4235608ff7af0c4063d557d25d80c85c5bd0d1e1ed64b568e7bbc0cdbce11cc74db4c0189af3a01634a 16_all_libgomp-Werror.patch @@ -464,7 +512,6 @@ d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2 e2be926c0ed4d67587857652678253a2a4e42294009a0c4b9fc420e53b0e6d44d1a2c6c2c62db837bc010470e9e62eb4af1ba7f51ff507c41e40922cd022dd26 gcc-4.9-musl.patch b5b0210dfaccfe0b06f0a9090666b1fae2a3faa4140b7930146b29531f0da9beb1f2c1f7e7bc2bd29179f9fe05dc30e246e96220b8ff75a90f75e8350c9058a1 gcc-4.8-musl-fix-iteratephdr.patch e6d9b103c128e5d4eca515b1496d78b05708de770597c883daddd95ea41e77b5ef1be613b989357cc870a7efd9e43b011022c2d302e7056cff7b69e764906ff2 gcc-4.8-musl-libssp.patch -600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch e1d6a450dfb40b134ad7f759c4c10174d2490b0093fe47cb33479245f26a3a8c54ebcf6255943c0ccfcb5095600d1c05e530baeed35609c8ffe75caac8e57c49 boehm-gc-uclibc.patch bda845a6aa1854d2c883910b115f79ccfa93dfc2b5eac69a3a236d83eb34cadc140731d616ffc24698c7abc8878dd15f231bcc5119f1860e575a120b311706c7 boehm-gc-musl.patch 4a5aeff0399782c752e6e3f2f48d984b2056dfb5d229b23a24eee1562d241339989b2203f139821cfc03c9b25c9bd7da6ccbbdc7a09d242e4de7f0d606c6f63c gcc-pure64.patch @@ -472,7 +519,6 @@ f89ddeb21bc8f97e6a850a6b70b4501a8f3e49a4bc8cc82897488decda5d98ad01cb7f6c8b392d45 54d67cc008b735e47771314171930c5d8b8f5f5dc97fcf4214824c105c808f3e75d22d5a4fdf5068ed0457fa0d46c60cfb442e276259a4a5e9b8722a027d18e6 fix-gcj-iconv-musl.patch 7de81fc8c7eb36690949eb30082515454978440a8f389b12407ac5e9125ef6824d6059ffb5b063ab1ccc6c4827b1a6a0984b538f056b85e3171800a6f723ec8b musl-posix_memalign-c++.patch 095281d940ad7504ed7071cc9800d81db33eb4aa5465696ef7b12bf1213dbdfa701f4392095c5167b331c38219b19d25a0798524b319f1c77aa8522d76d8c92c pr63740.patch -efc04b179d41b484eddddc56d0e442634995d56c994e6295ae09b9856ab46649d5f45f51ea84494ab39df41c213772d0e68aee67e66fdf340f0a647b55629ced pr64037.patch abe9aaf9aa956058d0386a4396a511d176a46bb3906b90e952383646cdc158cbeb0a5dc616a1ccb1ca7d49fd0b5e351532aa15a3b13362abbf1ca4266f54a687 gcc-4.8-build-args.patch 35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch c731f4aaaa65c8950e1b2bd9331410f92d378fd8c7e718532dccaa27ee11984d51d74216c3611e89a802325b81d7f184116839dce2dab50cae9b643c20a82fe7 fix-cxxflags-for-target.patch diff --git a/cross/gcc4-armv7/gcc-4.9-musl-fortify.patch b/cross/gcc4-armv7/gcc-4.9-musl-fortify.patch deleted file mode 100644 index daae954c8..000000000 --- a/cross/gcc4-armv7/gcc-4.9-musl-fortify.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.9.2/gcc/config/linux.h.orig 2015-03-09 13:27:13.289736710 +0000 -+++ gcc-4.9.2/gcc/config/linux.h 2015-03-09 13:29:32.295625046 +0000 -@@ -146,6 +146,8 @@ - - #ifdef NATIVE_SYSTEM_HEADER_DIR - #define INCLUDE_DEFAULTS_MUSL_NATIVE \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, - #else diff --git a/cross/gcc4-armv7/pr64037.patch b/cross/gcc4-armv7/pr64037.patch deleted file mode 100644 index 6b08a5117..000000000 --- a/cross/gcc4-armv7/pr64037.patch +++ /dev/null @@ -1,83 +0,0 @@ -https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=0817dc6f0e6b973e0e3671eb72d3758a8f042324 -(changelog changes removed) - -From 0817dc6f0e6b973e0e3671eb72d3758a8f042324 Mon Sep 17 00:00:00 2001 -From: hjl -Date: Sun, 14 Dec 2014 16:07:03 +0000 -Subject: [PATCH] Pass unpromoted argument to promote_function_mode - -This patch updates setup_incoming_promotions in combine.c to match what -is actually passed in assign_parm_setup_reg in function.c. - -Backported from mainline: - -gcc/ - - PR rtl-optimization/64037 - * combine.c (setup_incoming_promotions): Pass the argument - before any promotions happen to promote_function_mode. - -gcc/testsuite/ - - PR rtl-optimization/64037 - * g++.dg/pr64037.C: New test. - - -git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@218721 138bc75d-0d04-0410-961f-82ee72b054a4 ---- - gcc/combine.c | 4 ++-- - gcc/testsuite/g++.dg/pr64037.C | 27 +++++++++++++++++++++++++++ - 4 files changed, 46 insertions(+), 2 deletions(-) - create mode 100644 gcc/testsuite/g++.dg/pr64037.C - -diff --git a/gcc/combine.c b/gcc/combine.c -index 7c00452..adea2c1 100644 ---- a/gcc/combine.c -+++ b/gcc/combine.c -@@ -1529,8 +1529,8 @@ setup_incoming_promotions (rtx first) - uns3 = TYPE_UNSIGNED (DECL_ARG_TYPE (arg)); - - /* The mode and signedness of the argument as it is actually passed, -- after any TARGET_PROMOTE_FUNCTION_ARGS-driven ABI promotions. */ -- mode3 = promote_function_mode (DECL_ARG_TYPE (arg), mode2, &uns3, -+ see assign_parm_setup_reg in function.c. */ -+ mode3 = promote_function_mode (TREE_TYPE (arg), mode1, &uns3, - TREE_TYPE (cfun->decl), 0); - - /* The mode of the register in which the argument is being passed. */ -diff --git a/gcc/testsuite/g++.dg/pr64037.C b/gcc/testsuite/g++.dg/pr64037.C -new file mode 100644 -index 0000000..e5cd0e2 ---- /dev/null -+++ b/gcc/testsuite/g++.dg/pr64037.C -@@ -0,0 +1,27 @@ -+// { dg-do run { target i?86-*-* x86_64-*-* } } -+// { dg-options "-std=c++11 -Os" } -+ -+enum class X : unsigned char { -+ V = 2, -+}; -+ -+static void -+__attribute__((noinline,noclone)) -+foo(unsigned &out, unsigned a, X b) -+{ -+ out = static_cast(b); -+} -+ -+int main() -+{ -+ unsigned deadbeef = 0xDEADBEEF; -+ asm volatile ("" : "+d" (deadbeef), "+c" (deadbeef)); -+ -+ unsigned out; -+ foo(out, 2, X::V); -+ -+ if (out != 2) -+ __builtin_abort (); -+ -+ return 0; -+} --- -1.7.1 - diff --git a/cross/gcc6-aarch64/003_all_default-fortify-source.patch b/cross/gcc6-aarch64/003_all_default-fortify-source.patch deleted file mode 100644 index 6ca803343..000000000 --- a/cross/gcc6-aarch64/003_all_default-fortify-source.patch +++ /dev/null @@ -1,40 +0,0 @@ -# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++, -# DP: if the optimization level is > 0 - ---- - gcc/doc/invoke.texi | 6 ++++++ - gcc/c-family/c-cppbuiltin.c | 3 + - 2 files changed, 9 insertions(+), 0 deletions(-) - -Index: b/gcc/doc/invoke.texi -=================================================================== ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -7840,6 +7840,12 @@ also turns on the following optimization - Please note the warning under @option{-fgcse} about - invoking @option{-O2} on programs that use computed gotos. - -+NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is -+set by default, and is activated when @option{-O} is set to 2 or higher. -+This enables additional compile-time and run-time checks for several libc -+functions. To disable, specify either @option{-U_FORTIFY_SOURCE} or -+@option{-D_FORTIFY_SOURCE=0}. -+ - @item -O3 - @opindex O3 - Optimize yet more. @option{-O3} turns on all optimizations specified -Index: b/gcc/c-family/c-cppbuiltin.c -=================================================================== ---- a/gcc/c-family/c-cppbuiltin.c -+++ b/gcc/c-family/c-cppbuiltin.c -@@ -1176,6 +1176,10 @@ c_cpp_builtins (cpp_reader *pfile) - builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); - builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); - -+ /* Fortify Source enabled by default for optimization levels > 0 */ -+ if (optimize) -+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2); -+ - /* Misc. */ - if (flag_gnu89_inline) - cpp_define (pfile, "__GNUC_GNU_INLINE__"); diff --git a/cross/gcc6-aarch64/APKBUILD b/cross/gcc6-aarch64/APKBUILD index 4bbe9420e..004992519 100644 --- a/cross/gcc6-aarch64/APKBUILD +++ b/cross/gcc6-aarch64/APKBUILD @@ -1,7 +1,6 @@ # Automatically generated aport, do not edit! # Generator: pmbootstrap aportgen gcc6-aarch64 # Based on: main/gcc6 (from postmarketOS) - CTARGET_ARCH=aarch64 CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})" LANG_D=false @@ -23,19 +22,23 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" +maintainer="" pkgname=gcc6-aarch64 pkgver=9999 _pkgver=6.4.0 -pkgrel=12 +pkgrel=15 pkgdesc="Stage2 cross-compiler for aarch64" url="http://gcc.gnu.org" +# loongarch64: not relevant +# ppc64le: not relevant +# riscv64: doesn't build arch="x86_64" -license="GPL LGPL" +license="GPL-2.0-or-later AND LGPL-2.1-or-later" _gccrel=$_pkgver-r$pkgrel -depends="binutils-aarch64 mpc1" +depends="binutils-aarch64 mpc1 so:libc.musl-x86_64.so.1 so:libgcc_s.so.1 so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libstdc++.so.6 so:libz.so.1" makedepends_build="gcc g++ bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev" makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-aarch64 binutils-aarch64" -options="!strip" +options="!strip !tracedeps toolchain" # We only care about C, so we can compile old Linux kernels LANG_CXX=false @@ -67,11 +70,23 @@ if [ "$CHOST" != "$CTARGET" ]; then LIBATOMIC=false LIBITM=false + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 6 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS export CFLAGS_FOR_TARGET=" " export CXXFLAGS_FOR_TARGET=" " @@ -79,10 +94,23 @@ if [ "$CHOST" != "$CTARGET" ]; then STRIP_FOR_TARGET="$CTARGET-strip" elif [ "$CBUILD" != "$CHOST" ]; then + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 6 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS # reset flags and cc for build @@ -106,6 +134,31 @@ elif [ "$CBUILD" != "$CHOST" ]; then else STRIP_FOR_TARGET=${CROSS_COMPILE}strip _builddir="$srcdir/build" + + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 6 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) + # fixup flags. seems gcc treats CPPFLAGS as global without + # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. + export CFLAGS="$CPPFLAGS -g0 $CFLAGS -O2" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS -O2" + unset CPPFLAGS + # https://gcc.gnu.org/install/build.html + export CFLAGS_FOR_TARGET="$CFLAGS" + export CXXFLAGS_FOR_TARGET="$CXXFLAGS" + export LDFLAGS_FOR_TARGET="$LDFLAGS" + export BOOT_CFLAGS="$CFLAGS" + export BOOT_LDFLAGS="$LDFLAGS" fi # Go needs {set,make,swap}context, unimplemented in musl @@ -166,7 +219,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg 001_all_default-ssp-strong.patch 002_all_default-relro.patch - 003_all_default-fortify-source.patch 005_all_default-as-needed.patch 011_all_default-warn-format-security.patch 012_all_default-warn-trampolines.patch @@ -184,7 +236,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg 207-static-pie.patch libgcc-always-build-gcceh.a.patch - gcc-4.9-musl-fortify.patch gcc-6.1-musl-libssp.patch boehm-gc-musl.patch gcc-pure64.patch @@ -208,6 +259,8 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg gcc-pure64-mips.patch ada-mips64.patch + gcc-6.4-isl.patch + 0001-i386-Move-struct-ix86_frame-to-machine_function.patch 0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch 0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch @@ -446,7 +499,6 @@ sha512sums=" 28f8c6fdbcb19e950b1d0bafb3bcc7a8cba87bc673aa6027cece116599cdee80f0cf5e95a1440544890239f5c754e8a93ab46d9daedd937faef445d7ea33b226 ecj-4.9.jar a1335adc2fbee98e36c4437ff2587771b98ed4180726779020f65039498235626a411cdb0100dbd20cd19d12f0d94f9a21af179ff624676c28cead9d60598b5d 001_all_default-ssp-strong.patch e36e95b81489163abd6fe9d58f7867bdca43e61143afacbfb17f4698c0b16ec5fd0061d8fab7b2ae615540bebd721c2e2227f80401b4e7fc253da9da62e6b513 002_all_default-relro.patch -f86466c62b8291fac46f9c250c7ad8fa5ab7b1cce2504442fd07ddc4543665b317ae28951f244e39aba29aeaf3fff252ec4f6a147aa16adb2b7aed747dd89188 003_all_default-fortify-source.patch 51282fea54c7e616367bbeb2479ba13fec6f24eb47bd04e2071907b3b36273b2ff24676f46ef8d22f241c8ab4857307861eee076eab66797c3a50a8ecaa1809a 005_all_default-as-needed.patch 3398386dd1e079d6545dd9799adc799c6b80e3984fac6899d0e1a7ee21b66d0c7e53cddf17a65d590c883db750f9f79aaedd857355a8b9f7fb9476c906237919 011_all_default-warn-format-security.patch 9adb0d2b9b67dd957df6c609b8714c7c078efb52cd88770905c37c67827be8fc83d1125037b9c29d77db21ce78756aa2bb0bacdb0b98d869ac126da76a298e21 012_all_default-warn-trampolines.patch @@ -462,7 +514,6 @@ fc0de05b36613b732a0222ea005c90653c6a40d6761b6894af2419272f4e74875f37e26af33a9b99 98473bcaa77903a223ca9b0d2087c0921b287a2816d308cc32c8fe009e6cbf5dd1ae7fba27794ab8d9c09e117fe534413d91a464d1218474fc123ce0adfdc2c1 205-nopie.patch 3287d5b443bea8ec64132bcabe869c738ae98ea8f1a86df1c5d18c927f8816edbfcefeefc47792dbbb2bcacf50319af00e01b3735d34525913b64350770ad453 207-static-pie.patch d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch -600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch dbe0ee917fc7668571722364ab7c806731e3a31e8bfa30b4941b28b16b877d2a32b4a3897ef533399a28f82d43cac9b28e92de0493f0e779046db56584e07fa4 gcc-6.1-musl-libssp.patch bda845a6aa1854d2c883910b115f79ccfa93dfc2b5eac69a3a236d83eb34cadc140731d616ffc24698c7abc8878dd15f231bcc5119f1860e575a120b311706c7 boehm-gc-musl.patch fa62556719449caec6b2b434355bfbcaa5ae55ffe017b3e1f827f66a2aae21b79c571ee7a4ce723ea69169bc3a6447e73650991a200cc372adf2f102677518d7 gcc-pure64.patch @@ -482,6 +533,7 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45 34a818d5be67eb1f34e44a80b83c28a9b9c17d37fc9fac639f490d6bb5b53ebe3318140d09c236a17d7c98f5a7792ae3d6cefccda8067a5e942d6305b9d1f87c fix-linux-header-use-in-libgcc.patch 86be3338cc9c33089608bc4c5e3b7918c4e500a345c338f361b18c342119a6ed69af5495d72950de7106d760f003528b46ad14795e805f8a3331e206dcb234e3 gcc-pure64-mips.patch 508f3bca214d88531d739d761d07affc953689b1540905c73420b34c246e1e6b72588cf89f0e1462752633f8ddc88da8c0238be2a1b6e1c213829cecee7924cf ada-mips64.patch +80084d4f5984ea1c62f813c3c1fe7ce033d41d6cd5e6df3b10c649c0bbc2544ad0a58e7076fa28bf71d691df0211b07fc11eb0d5c9f462ef28eed4c3fbeeb9ee gcc-6.4-isl.patch 7912964bf3a985e9f870250d6e068f715582a4fb04270849d697a50e6aad0cf50df3d483ff80a0eb777d9940fd85526dd8d0b85da9bc71a5f2fbc07616263866 0001-i386-Move-struct-ix86_frame-to-machine_function.patch baa27a4b912d8e27cd65a556b09cf45289a0e00e86dae3925f2923d1f3752080e80d80e159c996ef4156c4df1dfc3069114810a846672170ef3ae461ae0ab7e1 0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch 6701d15000bdd7c4c98a8fece8c814f5e4e73603eecf84fe4dc5ac10f79b3074afba7c2cc9e51d08b2abade1c34cb0c944c08ead7a85db94e97158c752fd1aac 0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch diff --git a/cross/gcc6-aarch64/gcc-4.9-musl-fortify.patch b/cross/gcc6-aarch64/gcc-4.9-musl-fortify.patch deleted file mode 100644 index daae954c8..000000000 --- a/cross/gcc6-aarch64/gcc-4.9-musl-fortify.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.9.2/gcc/config/linux.h.orig 2015-03-09 13:27:13.289736710 +0000 -+++ gcc-4.9.2/gcc/config/linux.h 2015-03-09 13:29:32.295625046 +0000 -@@ -146,6 +146,8 @@ - - #ifdef NATIVE_SYSTEM_HEADER_DIR - #define INCLUDE_DEFAULTS_MUSL_NATIVE \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, - #else diff --git a/cross/gcc6-aarch64/gcc-6.4-isl.patch b/cross/gcc6-aarch64/gcc-6.4-isl.patch new file mode 100644 index 000000000..58a4aa054 --- /dev/null +++ b/cross/gcc6-aarch64/gcc-6.4-isl.patch @@ -0,0 +1,251 @@ +From cc46a51d4ff8bc1c42b7e6ae472494733bed5c49 Mon Sep 17 00:00:00 2001 +From: Richard Biener +Date: Thu, 16 Feb 2017 07:53:53 +0000 +Subject: [PATCH] graphite.h: Do not include isl/isl_val_gmp.h, instead include + isl/isl_val.h. + +2017-02-16 Richard Biener + + * graphite.h: Do not include isl/isl_val_gmp.h, instead include + isl/isl_val.h. + * graphite-isl-ast-to-gimple.c (gmp_cst_to_tree): Remove. + (gcc_expression_from_isl_expr_int): Use generic isl_val interface. + * graphite-sese-to-poly.c: Do not include isl/isl_val_gmp.h. + (isl_val_int_from_wi): New function. + (extract_affine_gmp): Rename to ... + (extract_affine_wi): ... this, take a widest_int. + (extract_affine_int): Just wrap extract_affine_wi. + (add_param_constraints): Use isl_val_int_from_wi. + (add_loop_constraints): Likewise, and extract_affine_wi. + +From-SVN: r245501 +--- + gcc/ChangeLog | 14 ++++++++ + gcc/graphite-isl-ast-to-gimple.c | 30 +++++------------ + gcc/graphite-sese-to-poly.c | 58 ++++++++++++++------------------ + gcc/graphite.h | 2 +- + 4 files changed, 50 insertions(+), 54 deletions(-) + +diff --git a/gcc/ChangeLog b/gcc/ChangeLog +index 24d9c1589f456..5fc6142eaa03f 100644 +--- a/gcc/ChangeLog ++++ b/gcc/ChangeLog +@@ -1,3 +1,17 @@ ++2017-02-16 Richard Biener ++ ++ * graphite.h: Do not include isl/isl_val_gmp.h, instead include ++ isl/isl_val.h. ++ * graphite-isl-ast-to-gimple.c (gmp_cst_to_tree): Remove. ++ (gcc_expression_from_isl_expr_int): Use generic isl_val interface. ++ * graphite-sese-to-poly.c: Do not include isl/isl_val_gmp.h. ++ (isl_val_int_from_wi): New function. ++ (extract_affine_gmp): Rename to ... ++ (extract_affine_wi): ... this, take a widest_int. ++ (extract_affine_int): Just wrap extract_affine_wi. ++ (add_param_constraints): Use isl_val_int_from_wi. ++ (add_loop_constraints): Likewise, and extract_affine_wi. ++ + 2017-02-15 Jeff Law + + PR middle-end/79521 +diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c +index dbdae7a7c155d..ec5fb73d9b2bc 100644 +--- a/gcc/graphite-isl-ast-to-gimple.c ++++ b/gcc/graphite-isl-ast-to-gimple.c +@@ -73,22 +73,6 @@ struct ast_build_info + bool is_parallelizable; + }; + +-/* Converts a GMP constant VAL to a tree and returns it. */ +- +-static tree +-gmp_cst_to_tree (tree type, mpz_t val) +-{ +- tree t = type ? type : integer_type_node; +- mpz_t tmp; +- +- mpz_init (tmp); +- mpz_set (tmp, val); +- wide_int wi = wi::from_mpz (t, tmp, true); +- mpz_clear (tmp); +- +- return wide_int_to_tree (t, wi); +-} +- + /* Verifies properties that GRAPHITE should maintain during translation. */ + + static inline void +@@ -325,16 +309,20 @@ gcc_expression_from_isl_expr_int (tree type, __isl_take isl_ast_expr *expr) + { + gcc_assert (isl_ast_expr_get_type (expr) == isl_ast_expr_int); + isl_val *val = isl_ast_expr_get_val (expr); +- mpz_t val_mpz_t; +- mpz_init (val_mpz_t); ++ size_t n = isl_val_n_abs_num_chunks (val, sizeof (HOST_WIDE_INT)); ++ HOST_WIDE_INT *chunks = XALLOCAVEC (HOST_WIDE_INT, n); + tree res; +- if (isl_val_get_num_gmp (val, val_mpz_t) == -1) ++ if (isl_val_get_abs_num_chunks (val, sizeof (HOST_WIDE_INT), chunks) == -1) + res = NULL_TREE; + else +- res = gmp_cst_to_tree (type, val_mpz_t); ++ { ++ widest_int wi = widest_int::from_array (chunks, n, true); ++ if (isl_val_is_neg (val)) ++ wi = -wi; ++ res = wide_int_to_tree (type, wi); ++ } + isl_val_free (val); + isl_ast_expr_free (expr); +- mpz_clear (val_mpz_t); + return res; + } + +diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c +index ede96e5a3c299..8ff9a22e12916 100644 +--- a/gcc/graphite-sese-to-poly.c ++++ b/gcc/graphite-sese-to-poly.c +@@ -55,7 +55,6 @@ along with GCC; see the file COPYING3. If not see + #include + #include + #include +-#include + + #include "graphite.h" + +@@ -154,16 +153,32 @@ extract_affine_name (scop_p s, tree e, __isl_take isl_space *space) + return isl_pw_aff_alloc (dom, aff); + } + ++/* Convert WI to a isl_val with CTX. */ ++ ++static __isl_give isl_val * ++isl_val_int_from_wi (isl_ctx *ctx, const widest_int &wi) ++{ ++ if (wi::neg_p (wi, SIGNED)) ++ { ++ widest_int mwi = -wi; ++ return isl_val_neg (isl_val_int_from_chunks (ctx, mwi.get_len (), ++ sizeof (HOST_WIDE_INT), ++ mwi.get_val ())); ++ } ++ return isl_val_int_from_chunks (ctx, wi.get_len (), sizeof (HOST_WIDE_INT), ++ wi.get_val ()); ++} ++ + /* Extract an affine expression from the gmp constant G. */ + + static isl_pw_aff * +-extract_affine_gmp (mpz_t g, __isl_take isl_space *space) ++extract_affine_wi (const widest_int &g, __isl_take isl_space *space) + { + isl_local_space *ls = isl_local_space_from_space (isl_space_copy (space)); + isl_aff *aff = isl_aff_zero_on_domain (ls); + isl_set *dom = isl_set_universe (space); + isl_ctx *ct = isl_aff_get_ctx (aff); +- isl_val *v = isl_val_int_from_gmp (ct, g); ++ isl_val *v = isl_val_int_from_wi (ct, g); + aff = isl_aff_add_constant_val (aff, v); + + return isl_pw_aff_alloc (dom, aff); +@@ -174,13 +189,7 @@ extract_affine_gmp (mpz_t g, __isl_take isl_space *space) + static isl_pw_aff * + extract_affine_int (tree e, __isl_take isl_space *space) + { +- mpz_t g; +- +- mpz_init (g); +- tree_int_to_gmp (e, g); +- isl_pw_aff *res = extract_affine_gmp (g, space); +- mpz_clear (g); +- ++ isl_pw_aff *res = extract_affine_wi (wi::to_widest (e), space); + return res; + } + +@@ -411,15 +420,11 @@ add_param_constraints (scop_p scop, graphite_dim_t p) + { + isl_space *space = isl_set_get_space (scop->param_context); + isl_constraint *c; +- mpz_t g; + isl_val *v; + + c = isl_inequality_alloc (isl_local_space_from_space (space)); +- mpz_init (g); +- tree_int_to_gmp (lb, g); +- v = isl_val_int_from_gmp (scop->isl_context, g); ++ v = isl_val_int_from_wi (scop->isl_context, wi::to_widest (lb)); + v = isl_val_neg (v); +- mpz_clear (g); + c = isl_constraint_set_constant_val (c, v); + c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, 1); + +@@ -431,15 +436,11 @@ add_param_constraints (scop_p scop, graphite_dim_t p) + { + isl_space *space = isl_set_get_space (scop->param_context); + isl_constraint *c; +- mpz_t g; + isl_val *v; + + c = isl_inequality_alloc (isl_local_space_from_space (space)); + +- mpz_init (g); +- tree_int_to_gmp (ub, g); +- v = isl_val_int_from_gmp (scop->isl_context, g); +- mpz_clear (g); ++ v = isl_val_int_from_wi (scop->isl_context, wi::to_widest (ub)); + c = isl_constraint_set_constant_val (c, v); + c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, -1); + +@@ -773,11 +774,8 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, + isl_local_space *ls = isl_local_space_from_space (space); + isl_constraint *c = isl_inequality_alloc (ls); + c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, -1); +- mpz_t g; +- mpz_init (g); +- tree_int_to_gmp (nb_iters, g); +- isl_val *v = isl_val_int_from_gmp (scop->isl_context, g); +- mpz_clear (g); ++ isl_val *v ++ = isl_val_int_from_wi (scop->isl_context, wi::to_widest (nb_iters)); + c = isl_constraint_set_constant_val (c, v); + return isl_set_add_constraint (domain, c); + } +@@ -817,12 +815,9 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, + + /* NIT is an upper bound to NB_ITERS: "NIT >= NB_ITERS", although we + do not know whether the loop executes at least once. */ +- mpz_t g; +- mpz_init (g); +- wi::to_mpz (nit, g, SIGNED); +- mpz_sub_ui (g, g, 1); ++ --nit; + +- isl_pw_aff *approx = extract_affine_gmp (g, isl_space_copy (space)); ++ isl_pw_aff *approx = extract_affine_wi (nit, isl_space_copy (space)); + isl_set *x = isl_pw_aff_ge_set (approx, aff_nb_iters); + x = isl_set_project_out (x, isl_dim_set, 0, + isl_set_dim (x, isl_dim_set)); +@@ -831,8 +826,7 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, + ls = isl_local_space_from_space (space); + c = isl_inequality_alloc (ls); + c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, -1); +- isl_val *v = isl_val_int_from_gmp (scop->isl_context, g); +- mpz_clear (g); ++ isl_val *v = isl_val_int_from_wi (scop->isl_context, nit); + c = isl_constraint_set_constant_val (c, v); + + if (dump_file) +diff --git a/gcc/graphite.h b/gcc/graphite.h +index 5103c614ff140..d22c4f2693f52 100644 +--- a/gcc/graphite.h ++++ b/gcc/graphite.h +@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see + #include "sese.h" + #include + #include +-#include ++#include + #include + #include + #include diff --git a/cross/gcc6-armhf/003_all_default-fortify-source.patch b/cross/gcc6-armhf/003_all_default-fortify-source.patch deleted file mode 100644 index 6ca803343..000000000 --- a/cross/gcc6-armhf/003_all_default-fortify-source.patch +++ /dev/null @@ -1,40 +0,0 @@ -# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++, -# DP: if the optimization level is > 0 - ---- - gcc/doc/invoke.texi | 6 ++++++ - gcc/c-family/c-cppbuiltin.c | 3 + - 2 files changed, 9 insertions(+), 0 deletions(-) - -Index: b/gcc/doc/invoke.texi -=================================================================== ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -7840,6 +7840,12 @@ also turns on the following optimization - Please note the warning under @option{-fgcse} about - invoking @option{-O2} on programs that use computed gotos. - -+NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is -+set by default, and is activated when @option{-O} is set to 2 or higher. -+This enables additional compile-time and run-time checks for several libc -+functions. To disable, specify either @option{-U_FORTIFY_SOURCE} or -+@option{-D_FORTIFY_SOURCE=0}. -+ - @item -O3 - @opindex O3 - Optimize yet more. @option{-O3} turns on all optimizations specified -Index: b/gcc/c-family/c-cppbuiltin.c -=================================================================== ---- a/gcc/c-family/c-cppbuiltin.c -+++ b/gcc/c-family/c-cppbuiltin.c -@@ -1176,6 +1176,10 @@ c_cpp_builtins (cpp_reader *pfile) - builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); - builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); - -+ /* Fortify Source enabled by default for optimization levels > 0 */ -+ if (optimize) -+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2); -+ - /* Misc. */ - if (flag_gnu89_inline) - cpp_define (pfile, "__GNUC_GNU_INLINE__"); diff --git a/cross/gcc6-armhf/APKBUILD b/cross/gcc6-armhf/APKBUILD index e69f8293d..431fc6eb6 100644 --- a/cross/gcc6-armhf/APKBUILD +++ b/cross/gcc6-armhf/APKBUILD @@ -1,7 +1,6 @@ # Automatically generated aport, do not edit! # Generator: pmbootstrap aportgen gcc6-armhf # Based on: main/gcc6 (from postmarketOS) - CTARGET_ARCH=armhf CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})" LANG_D=false @@ -23,19 +22,23 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" +maintainer="" pkgname=gcc6-armhf pkgver=9999 _pkgver=6.4.0 -pkgrel=12 +pkgrel=15 pkgdesc="Stage2 cross-compiler for armhf" url="http://gcc.gnu.org" +# loongarch64: not relevant +# ppc64le: not relevant +# riscv64: doesn't build arch="x86_64" -license="GPL LGPL" +license="GPL-2.0-or-later AND LGPL-2.1-or-later" _gccrel=$_pkgver-r$pkgrel -depends="binutils-armhf mpc1" +depends="binutils-armhf mpc1 so:libc.musl-x86_64.so.1 so:libgcc_s.so.1 so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libstdc++.so.6 so:libz.so.1" makedepends_build="gcc g++ bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev" makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-armhf binutils-armhf" -options="!strip" +options="!strip !tracedeps toolchain" # We only care about C, so we can compile old Linux kernels LANG_CXX=false @@ -67,11 +70,23 @@ if [ "$CHOST" != "$CTARGET" ]; then LIBATOMIC=false LIBITM=false + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 6 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS export CFLAGS_FOR_TARGET=" " export CXXFLAGS_FOR_TARGET=" " @@ -79,10 +94,23 @@ if [ "$CHOST" != "$CTARGET" ]; then STRIP_FOR_TARGET="$CTARGET-strip" elif [ "$CBUILD" != "$CHOST" ]; then + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 6 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS # reset flags and cc for build @@ -106,6 +134,31 @@ elif [ "$CBUILD" != "$CHOST" ]; then else STRIP_FOR_TARGET=${CROSS_COMPILE}strip _builddir="$srcdir/build" + + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 6 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) + # fixup flags. seems gcc treats CPPFLAGS as global without + # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. + export CFLAGS="$CPPFLAGS -g0 $CFLAGS -O2" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS -O2" + unset CPPFLAGS + # https://gcc.gnu.org/install/build.html + export CFLAGS_FOR_TARGET="$CFLAGS" + export CXXFLAGS_FOR_TARGET="$CXXFLAGS" + export LDFLAGS_FOR_TARGET="$LDFLAGS" + export BOOT_CFLAGS="$CFLAGS" + export BOOT_LDFLAGS="$LDFLAGS" fi # Go needs {set,make,swap}context, unimplemented in musl @@ -166,7 +219,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg 001_all_default-ssp-strong.patch 002_all_default-relro.patch - 003_all_default-fortify-source.patch 005_all_default-as-needed.patch 011_all_default-warn-format-security.patch 012_all_default-warn-trampolines.patch @@ -184,7 +236,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg 207-static-pie.patch libgcc-always-build-gcceh.a.patch - gcc-4.9-musl-fortify.patch gcc-6.1-musl-libssp.patch boehm-gc-musl.patch gcc-pure64.patch @@ -208,6 +259,8 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg gcc-pure64-mips.patch ada-mips64.patch + gcc-6.4-isl.patch + 0001-i386-Move-struct-ix86_frame-to-machine_function.patch 0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch 0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch @@ -446,7 +499,6 @@ sha512sums=" 28f8c6fdbcb19e950b1d0bafb3bcc7a8cba87bc673aa6027cece116599cdee80f0cf5e95a1440544890239f5c754e8a93ab46d9daedd937faef445d7ea33b226 ecj-4.9.jar a1335adc2fbee98e36c4437ff2587771b98ed4180726779020f65039498235626a411cdb0100dbd20cd19d12f0d94f9a21af179ff624676c28cead9d60598b5d 001_all_default-ssp-strong.patch e36e95b81489163abd6fe9d58f7867bdca43e61143afacbfb17f4698c0b16ec5fd0061d8fab7b2ae615540bebd721c2e2227f80401b4e7fc253da9da62e6b513 002_all_default-relro.patch -f86466c62b8291fac46f9c250c7ad8fa5ab7b1cce2504442fd07ddc4543665b317ae28951f244e39aba29aeaf3fff252ec4f6a147aa16adb2b7aed747dd89188 003_all_default-fortify-source.patch 51282fea54c7e616367bbeb2479ba13fec6f24eb47bd04e2071907b3b36273b2ff24676f46ef8d22f241c8ab4857307861eee076eab66797c3a50a8ecaa1809a 005_all_default-as-needed.patch 3398386dd1e079d6545dd9799adc799c6b80e3984fac6899d0e1a7ee21b66d0c7e53cddf17a65d590c883db750f9f79aaedd857355a8b9f7fb9476c906237919 011_all_default-warn-format-security.patch 9adb0d2b9b67dd957df6c609b8714c7c078efb52cd88770905c37c67827be8fc83d1125037b9c29d77db21ce78756aa2bb0bacdb0b98d869ac126da76a298e21 012_all_default-warn-trampolines.patch @@ -462,7 +514,6 @@ fc0de05b36613b732a0222ea005c90653c6a40d6761b6894af2419272f4e74875f37e26af33a9b99 98473bcaa77903a223ca9b0d2087c0921b287a2816d308cc32c8fe009e6cbf5dd1ae7fba27794ab8d9c09e117fe534413d91a464d1218474fc123ce0adfdc2c1 205-nopie.patch 3287d5b443bea8ec64132bcabe869c738ae98ea8f1a86df1c5d18c927f8816edbfcefeefc47792dbbb2bcacf50319af00e01b3735d34525913b64350770ad453 207-static-pie.patch d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch -600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch dbe0ee917fc7668571722364ab7c806731e3a31e8bfa30b4941b28b16b877d2a32b4a3897ef533399a28f82d43cac9b28e92de0493f0e779046db56584e07fa4 gcc-6.1-musl-libssp.patch bda845a6aa1854d2c883910b115f79ccfa93dfc2b5eac69a3a236d83eb34cadc140731d616ffc24698c7abc8878dd15f231bcc5119f1860e575a120b311706c7 boehm-gc-musl.patch fa62556719449caec6b2b434355bfbcaa5ae55ffe017b3e1f827f66a2aae21b79c571ee7a4ce723ea69169bc3a6447e73650991a200cc372adf2f102677518d7 gcc-pure64.patch @@ -482,6 +533,7 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45 34a818d5be67eb1f34e44a80b83c28a9b9c17d37fc9fac639f490d6bb5b53ebe3318140d09c236a17d7c98f5a7792ae3d6cefccda8067a5e942d6305b9d1f87c fix-linux-header-use-in-libgcc.patch 86be3338cc9c33089608bc4c5e3b7918c4e500a345c338f361b18c342119a6ed69af5495d72950de7106d760f003528b46ad14795e805f8a3331e206dcb234e3 gcc-pure64-mips.patch 508f3bca214d88531d739d761d07affc953689b1540905c73420b34c246e1e6b72588cf89f0e1462752633f8ddc88da8c0238be2a1b6e1c213829cecee7924cf ada-mips64.patch +80084d4f5984ea1c62f813c3c1fe7ce033d41d6cd5e6df3b10c649c0bbc2544ad0a58e7076fa28bf71d691df0211b07fc11eb0d5c9f462ef28eed4c3fbeeb9ee gcc-6.4-isl.patch 7912964bf3a985e9f870250d6e068f715582a4fb04270849d697a50e6aad0cf50df3d483ff80a0eb777d9940fd85526dd8d0b85da9bc71a5f2fbc07616263866 0001-i386-Move-struct-ix86_frame-to-machine_function.patch baa27a4b912d8e27cd65a556b09cf45289a0e00e86dae3925f2923d1f3752080e80d80e159c996ef4156c4df1dfc3069114810a846672170ef3ae461ae0ab7e1 0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch 6701d15000bdd7c4c98a8fece8c814f5e4e73603eecf84fe4dc5ac10f79b3074afba7c2cc9e51d08b2abade1c34cb0c944c08ead7a85db94e97158c752fd1aac 0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch diff --git a/cross/gcc6-armhf/gcc-4.9-musl-fortify.patch b/cross/gcc6-armhf/gcc-4.9-musl-fortify.patch deleted file mode 100644 index daae954c8..000000000 --- a/cross/gcc6-armhf/gcc-4.9-musl-fortify.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.9.2/gcc/config/linux.h.orig 2015-03-09 13:27:13.289736710 +0000 -+++ gcc-4.9.2/gcc/config/linux.h 2015-03-09 13:29:32.295625046 +0000 -@@ -146,6 +146,8 @@ - - #ifdef NATIVE_SYSTEM_HEADER_DIR - #define INCLUDE_DEFAULTS_MUSL_NATIVE \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, - #else diff --git a/cross/gcc6-armhf/gcc-6.4-isl.patch b/cross/gcc6-armhf/gcc-6.4-isl.patch new file mode 100644 index 000000000..58a4aa054 --- /dev/null +++ b/cross/gcc6-armhf/gcc-6.4-isl.patch @@ -0,0 +1,251 @@ +From cc46a51d4ff8bc1c42b7e6ae472494733bed5c49 Mon Sep 17 00:00:00 2001 +From: Richard Biener +Date: Thu, 16 Feb 2017 07:53:53 +0000 +Subject: [PATCH] graphite.h: Do not include isl/isl_val_gmp.h, instead include + isl/isl_val.h. + +2017-02-16 Richard Biener + + * graphite.h: Do not include isl/isl_val_gmp.h, instead include + isl/isl_val.h. + * graphite-isl-ast-to-gimple.c (gmp_cst_to_tree): Remove. + (gcc_expression_from_isl_expr_int): Use generic isl_val interface. + * graphite-sese-to-poly.c: Do not include isl/isl_val_gmp.h. + (isl_val_int_from_wi): New function. + (extract_affine_gmp): Rename to ... + (extract_affine_wi): ... this, take a widest_int. + (extract_affine_int): Just wrap extract_affine_wi. + (add_param_constraints): Use isl_val_int_from_wi. + (add_loop_constraints): Likewise, and extract_affine_wi. + +From-SVN: r245501 +--- + gcc/ChangeLog | 14 ++++++++ + gcc/graphite-isl-ast-to-gimple.c | 30 +++++------------ + gcc/graphite-sese-to-poly.c | 58 ++++++++++++++------------------ + gcc/graphite.h | 2 +- + 4 files changed, 50 insertions(+), 54 deletions(-) + +diff --git a/gcc/ChangeLog b/gcc/ChangeLog +index 24d9c1589f456..5fc6142eaa03f 100644 +--- a/gcc/ChangeLog ++++ b/gcc/ChangeLog +@@ -1,3 +1,17 @@ ++2017-02-16 Richard Biener ++ ++ * graphite.h: Do not include isl/isl_val_gmp.h, instead include ++ isl/isl_val.h. ++ * graphite-isl-ast-to-gimple.c (gmp_cst_to_tree): Remove. ++ (gcc_expression_from_isl_expr_int): Use generic isl_val interface. ++ * graphite-sese-to-poly.c: Do not include isl/isl_val_gmp.h. ++ (isl_val_int_from_wi): New function. ++ (extract_affine_gmp): Rename to ... ++ (extract_affine_wi): ... this, take a widest_int. ++ (extract_affine_int): Just wrap extract_affine_wi. ++ (add_param_constraints): Use isl_val_int_from_wi. ++ (add_loop_constraints): Likewise, and extract_affine_wi. ++ + 2017-02-15 Jeff Law + + PR middle-end/79521 +diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c +index dbdae7a7c155d..ec5fb73d9b2bc 100644 +--- a/gcc/graphite-isl-ast-to-gimple.c ++++ b/gcc/graphite-isl-ast-to-gimple.c +@@ -73,22 +73,6 @@ struct ast_build_info + bool is_parallelizable; + }; + +-/* Converts a GMP constant VAL to a tree and returns it. */ +- +-static tree +-gmp_cst_to_tree (tree type, mpz_t val) +-{ +- tree t = type ? type : integer_type_node; +- mpz_t tmp; +- +- mpz_init (tmp); +- mpz_set (tmp, val); +- wide_int wi = wi::from_mpz (t, tmp, true); +- mpz_clear (tmp); +- +- return wide_int_to_tree (t, wi); +-} +- + /* Verifies properties that GRAPHITE should maintain during translation. */ + + static inline void +@@ -325,16 +309,20 @@ gcc_expression_from_isl_expr_int (tree type, __isl_take isl_ast_expr *expr) + { + gcc_assert (isl_ast_expr_get_type (expr) == isl_ast_expr_int); + isl_val *val = isl_ast_expr_get_val (expr); +- mpz_t val_mpz_t; +- mpz_init (val_mpz_t); ++ size_t n = isl_val_n_abs_num_chunks (val, sizeof (HOST_WIDE_INT)); ++ HOST_WIDE_INT *chunks = XALLOCAVEC (HOST_WIDE_INT, n); + tree res; +- if (isl_val_get_num_gmp (val, val_mpz_t) == -1) ++ if (isl_val_get_abs_num_chunks (val, sizeof (HOST_WIDE_INT), chunks) == -1) + res = NULL_TREE; + else +- res = gmp_cst_to_tree (type, val_mpz_t); ++ { ++ widest_int wi = widest_int::from_array (chunks, n, true); ++ if (isl_val_is_neg (val)) ++ wi = -wi; ++ res = wide_int_to_tree (type, wi); ++ } + isl_val_free (val); + isl_ast_expr_free (expr); +- mpz_clear (val_mpz_t); + return res; + } + +diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c +index ede96e5a3c299..8ff9a22e12916 100644 +--- a/gcc/graphite-sese-to-poly.c ++++ b/gcc/graphite-sese-to-poly.c +@@ -55,7 +55,6 @@ along with GCC; see the file COPYING3. If not see + #include + #include + #include +-#include + + #include "graphite.h" + +@@ -154,16 +153,32 @@ extract_affine_name (scop_p s, tree e, __isl_take isl_space *space) + return isl_pw_aff_alloc (dom, aff); + } + ++/* Convert WI to a isl_val with CTX. */ ++ ++static __isl_give isl_val * ++isl_val_int_from_wi (isl_ctx *ctx, const widest_int &wi) ++{ ++ if (wi::neg_p (wi, SIGNED)) ++ { ++ widest_int mwi = -wi; ++ return isl_val_neg (isl_val_int_from_chunks (ctx, mwi.get_len (), ++ sizeof (HOST_WIDE_INT), ++ mwi.get_val ())); ++ } ++ return isl_val_int_from_chunks (ctx, wi.get_len (), sizeof (HOST_WIDE_INT), ++ wi.get_val ()); ++} ++ + /* Extract an affine expression from the gmp constant G. */ + + static isl_pw_aff * +-extract_affine_gmp (mpz_t g, __isl_take isl_space *space) ++extract_affine_wi (const widest_int &g, __isl_take isl_space *space) + { + isl_local_space *ls = isl_local_space_from_space (isl_space_copy (space)); + isl_aff *aff = isl_aff_zero_on_domain (ls); + isl_set *dom = isl_set_universe (space); + isl_ctx *ct = isl_aff_get_ctx (aff); +- isl_val *v = isl_val_int_from_gmp (ct, g); ++ isl_val *v = isl_val_int_from_wi (ct, g); + aff = isl_aff_add_constant_val (aff, v); + + return isl_pw_aff_alloc (dom, aff); +@@ -174,13 +189,7 @@ extract_affine_gmp (mpz_t g, __isl_take isl_space *space) + static isl_pw_aff * + extract_affine_int (tree e, __isl_take isl_space *space) + { +- mpz_t g; +- +- mpz_init (g); +- tree_int_to_gmp (e, g); +- isl_pw_aff *res = extract_affine_gmp (g, space); +- mpz_clear (g); +- ++ isl_pw_aff *res = extract_affine_wi (wi::to_widest (e), space); + return res; + } + +@@ -411,15 +420,11 @@ add_param_constraints (scop_p scop, graphite_dim_t p) + { + isl_space *space = isl_set_get_space (scop->param_context); + isl_constraint *c; +- mpz_t g; + isl_val *v; + + c = isl_inequality_alloc (isl_local_space_from_space (space)); +- mpz_init (g); +- tree_int_to_gmp (lb, g); +- v = isl_val_int_from_gmp (scop->isl_context, g); ++ v = isl_val_int_from_wi (scop->isl_context, wi::to_widest (lb)); + v = isl_val_neg (v); +- mpz_clear (g); + c = isl_constraint_set_constant_val (c, v); + c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, 1); + +@@ -431,15 +436,11 @@ add_param_constraints (scop_p scop, graphite_dim_t p) + { + isl_space *space = isl_set_get_space (scop->param_context); + isl_constraint *c; +- mpz_t g; + isl_val *v; + + c = isl_inequality_alloc (isl_local_space_from_space (space)); + +- mpz_init (g); +- tree_int_to_gmp (ub, g); +- v = isl_val_int_from_gmp (scop->isl_context, g); +- mpz_clear (g); ++ v = isl_val_int_from_wi (scop->isl_context, wi::to_widest (ub)); + c = isl_constraint_set_constant_val (c, v); + c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, -1); + +@@ -773,11 +774,8 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, + isl_local_space *ls = isl_local_space_from_space (space); + isl_constraint *c = isl_inequality_alloc (ls); + c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, -1); +- mpz_t g; +- mpz_init (g); +- tree_int_to_gmp (nb_iters, g); +- isl_val *v = isl_val_int_from_gmp (scop->isl_context, g); +- mpz_clear (g); ++ isl_val *v ++ = isl_val_int_from_wi (scop->isl_context, wi::to_widest (nb_iters)); + c = isl_constraint_set_constant_val (c, v); + return isl_set_add_constraint (domain, c); + } +@@ -817,12 +815,9 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, + + /* NIT is an upper bound to NB_ITERS: "NIT >= NB_ITERS", although we + do not know whether the loop executes at least once. */ +- mpz_t g; +- mpz_init (g); +- wi::to_mpz (nit, g, SIGNED); +- mpz_sub_ui (g, g, 1); ++ --nit; + +- isl_pw_aff *approx = extract_affine_gmp (g, isl_space_copy (space)); ++ isl_pw_aff *approx = extract_affine_wi (nit, isl_space_copy (space)); + isl_set *x = isl_pw_aff_ge_set (approx, aff_nb_iters); + x = isl_set_project_out (x, isl_dim_set, 0, + isl_set_dim (x, isl_dim_set)); +@@ -831,8 +826,7 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, + ls = isl_local_space_from_space (space); + c = isl_inequality_alloc (ls); + c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, -1); +- isl_val *v = isl_val_int_from_gmp (scop->isl_context, g); +- mpz_clear (g); ++ isl_val *v = isl_val_int_from_wi (scop->isl_context, nit); + c = isl_constraint_set_constant_val (c, v); + + if (dump_file) +diff --git a/gcc/graphite.h b/gcc/graphite.h +index 5103c614ff140..d22c4f2693f52 100644 +--- a/gcc/graphite.h ++++ b/gcc/graphite.h +@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see + #include "sese.h" + #include + #include +-#include ++#include + #include + #include + #include diff --git a/cross/gcc6-armv7/003_all_default-fortify-source.patch b/cross/gcc6-armv7/003_all_default-fortify-source.patch deleted file mode 100644 index 6ca803343..000000000 --- a/cross/gcc6-armv7/003_all_default-fortify-source.patch +++ /dev/null @@ -1,40 +0,0 @@ -# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++, -# DP: if the optimization level is > 0 - ---- - gcc/doc/invoke.texi | 6 ++++++ - gcc/c-family/c-cppbuiltin.c | 3 + - 2 files changed, 9 insertions(+), 0 deletions(-) - -Index: b/gcc/doc/invoke.texi -=================================================================== ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -7840,6 +7840,12 @@ also turns on the following optimization - Please note the warning under @option{-fgcse} about - invoking @option{-O2} on programs that use computed gotos. - -+NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is -+set by default, and is activated when @option{-O} is set to 2 or higher. -+This enables additional compile-time and run-time checks for several libc -+functions. To disable, specify either @option{-U_FORTIFY_SOURCE} or -+@option{-D_FORTIFY_SOURCE=0}. -+ - @item -O3 - @opindex O3 - Optimize yet more. @option{-O3} turns on all optimizations specified -Index: b/gcc/c-family/c-cppbuiltin.c -=================================================================== ---- a/gcc/c-family/c-cppbuiltin.c -+++ b/gcc/c-family/c-cppbuiltin.c -@@ -1176,6 +1176,10 @@ c_cpp_builtins (cpp_reader *pfile) - builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); - builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); - -+ /* Fortify Source enabled by default for optimization levels > 0 */ -+ if (optimize) -+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2); -+ - /* Misc. */ - if (flag_gnu89_inline) - cpp_define (pfile, "__GNUC_GNU_INLINE__"); diff --git a/cross/gcc6-armv7/APKBUILD b/cross/gcc6-armv7/APKBUILD index d15823225..7eff3dbd3 100644 --- a/cross/gcc6-armv7/APKBUILD +++ b/cross/gcc6-armv7/APKBUILD @@ -1,7 +1,6 @@ # Automatically generated aport, do not edit! # Generator: pmbootstrap aportgen gcc6-armv7 # Based on: main/gcc6 (from postmarketOS) - CTARGET_ARCH=armv7 CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})" LANG_D=false @@ -23,19 +22,23 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" +maintainer="" pkgname=gcc6-armv7 pkgver=9999 _pkgver=6.4.0 -pkgrel=12 +pkgrel=15 pkgdesc="Stage2 cross-compiler for armv7" url="http://gcc.gnu.org" +# loongarch64: not relevant +# ppc64le: not relevant +# riscv64: doesn't build arch="x86_64" -license="GPL LGPL" +license="GPL-2.0-or-later AND LGPL-2.1-or-later" _gccrel=$_pkgver-r$pkgrel -depends="binutils-armv7 mpc1" +depends="binutils-armv7 mpc1 so:libc.musl-x86_64.so.1 so:libgcc_s.so.1 so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libstdc++.so.6 so:libz.so.1" makedepends_build="gcc g++ bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev" makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-armv7 binutils-armv7" -options="!strip" +options="!strip !tracedeps toolchain" # We only care about C, so we can compile old Linux kernels LANG_CXX=false @@ -67,11 +70,23 @@ if [ "$CHOST" != "$CTARGET" ]; then LIBATOMIC=false LIBITM=false + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 6 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS export CFLAGS_FOR_TARGET=" " export CXXFLAGS_FOR_TARGET=" " @@ -79,10 +94,23 @@ if [ "$CHOST" != "$CTARGET" ]; then STRIP_FOR_TARGET="$CTARGET-strip" elif [ "$CBUILD" != "$CHOST" ]; then + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 6 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) # fixup flags. seems gcc treats CPPFLAGS as global without # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS $CFLAGS" - export CXXFLAGS="$CPPFLAGS $CXXFLAGS" + export CFLAGS="$CPPFLAGS -g0 $CFLAGS" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" unset CPPFLAGS # reset flags and cc for build @@ -106,6 +134,31 @@ elif [ "$CBUILD" != "$CHOST" ]; then else STRIP_FOR_TARGET=${CROSS_COMPILE}strip _builddir="$srcdir/build" + + # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 + CFLAGS="${CFLAGS/-Werror=format-security/}" + CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" + CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" + # fstack-clash-protection is not known to GCC 6 + CFLAGS="${CFLAGS/-fstack-clash-protection/}" + CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" + CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" + # and neither is -fno-plt + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + CPPFLAGS="${CPPFLAGS/-fno-plt/}" + # reset target flags (should be set in crosscreate abuild) + # fixup flags. seems gcc treats CPPFLAGS as global without + # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. + export CFLAGS="$CPPFLAGS -g0 $CFLAGS -O2" + export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS -O2" + unset CPPFLAGS + # https://gcc.gnu.org/install/build.html + export CFLAGS_FOR_TARGET="$CFLAGS" + export CXXFLAGS_FOR_TARGET="$CXXFLAGS" + export LDFLAGS_FOR_TARGET="$LDFLAGS" + export BOOT_CFLAGS="$CFLAGS" + export BOOT_LDFLAGS="$LDFLAGS" fi # Go needs {set,make,swap}context, unimplemented in musl @@ -166,7 +219,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg 001_all_default-ssp-strong.patch 002_all_default-relro.patch - 003_all_default-fortify-source.patch 005_all_default-as-needed.patch 011_all_default-warn-format-security.patch 012_all_default-warn-trampolines.patch @@ -184,7 +236,6 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg 207-static-pie.patch libgcc-always-build-gcceh.a.patch - gcc-4.9-musl-fortify.patch gcc-6.1-musl-libssp.patch boehm-gc-musl.patch gcc-pure64.patch @@ -208,6 +259,8 @@ source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkg gcc-pure64-mips.patch ada-mips64.patch + gcc-6.4-isl.patch + 0001-i386-Move-struct-ix86_frame-to-machine_function.patch 0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch 0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch @@ -446,7 +499,6 @@ sha512sums=" 28f8c6fdbcb19e950b1d0bafb3bcc7a8cba87bc673aa6027cece116599cdee80f0cf5e95a1440544890239f5c754e8a93ab46d9daedd937faef445d7ea33b226 ecj-4.9.jar a1335adc2fbee98e36c4437ff2587771b98ed4180726779020f65039498235626a411cdb0100dbd20cd19d12f0d94f9a21af179ff624676c28cead9d60598b5d 001_all_default-ssp-strong.patch e36e95b81489163abd6fe9d58f7867bdca43e61143afacbfb17f4698c0b16ec5fd0061d8fab7b2ae615540bebd721c2e2227f80401b4e7fc253da9da62e6b513 002_all_default-relro.patch -f86466c62b8291fac46f9c250c7ad8fa5ab7b1cce2504442fd07ddc4543665b317ae28951f244e39aba29aeaf3fff252ec4f6a147aa16adb2b7aed747dd89188 003_all_default-fortify-source.patch 51282fea54c7e616367bbeb2479ba13fec6f24eb47bd04e2071907b3b36273b2ff24676f46ef8d22f241c8ab4857307861eee076eab66797c3a50a8ecaa1809a 005_all_default-as-needed.patch 3398386dd1e079d6545dd9799adc799c6b80e3984fac6899d0e1a7ee21b66d0c7e53cddf17a65d590c883db750f9f79aaedd857355a8b9f7fb9476c906237919 011_all_default-warn-format-security.patch 9adb0d2b9b67dd957df6c609b8714c7c078efb52cd88770905c37c67827be8fc83d1125037b9c29d77db21ce78756aa2bb0bacdb0b98d869ac126da76a298e21 012_all_default-warn-trampolines.patch @@ -462,7 +514,6 @@ fc0de05b36613b732a0222ea005c90653c6a40d6761b6894af2419272f4e74875f37e26af33a9b99 98473bcaa77903a223ca9b0d2087c0921b287a2816d308cc32c8fe009e6cbf5dd1ae7fba27794ab8d9c09e117fe534413d91a464d1218474fc123ce0adfdc2c1 205-nopie.patch 3287d5b443bea8ec64132bcabe869c738ae98ea8f1a86df1c5d18c927f8816edbfcefeefc47792dbbb2bcacf50319af00e01b3735d34525913b64350770ad453 207-static-pie.patch d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch -600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch dbe0ee917fc7668571722364ab7c806731e3a31e8bfa30b4941b28b16b877d2a32b4a3897ef533399a28f82d43cac9b28e92de0493f0e779046db56584e07fa4 gcc-6.1-musl-libssp.patch bda845a6aa1854d2c883910b115f79ccfa93dfc2b5eac69a3a236d83eb34cadc140731d616ffc24698c7abc8878dd15f231bcc5119f1860e575a120b311706c7 boehm-gc-musl.patch fa62556719449caec6b2b434355bfbcaa5ae55ffe017b3e1f827f66a2aae21b79c571ee7a4ce723ea69169bc3a6447e73650991a200cc372adf2f102677518d7 gcc-pure64.patch @@ -482,6 +533,7 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45 34a818d5be67eb1f34e44a80b83c28a9b9c17d37fc9fac639f490d6bb5b53ebe3318140d09c236a17d7c98f5a7792ae3d6cefccda8067a5e942d6305b9d1f87c fix-linux-header-use-in-libgcc.patch 86be3338cc9c33089608bc4c5e3b7918c4e500a345c338f361b18c342119a6ed69af5495d72950de7106d760f003528b46ad14795e805f8a3331e206dcb234e3 gcc-pure64-mips.patch 508f3bca214d88531d739d761d07affc953689b1540905c73420b34c246e1e6b72588cf89f0e1462752633f8ddc88da8c0238be2a1b6e1c213829cecee7924cf ada-mips64.patch +80084d4f5984ea1c62f813c3c1fe7ce033d41d6cd5e6df3b10c649c0bbc2544ad0a58e7076fa28bf71d691df0211b07fc11eb0d5c9f462ef28eed4c3fbeeb9ee gcc-6.4-isl.patch 7912964bf3a985e9f870250d6e068f715582a4fb04270849d697a50e6aad0cf50df3d483ff80a0eb777d9940fd85526dd8d0b85da9bc71a5f2fbc07616263866 0001-i386-Move-struct-ix86_frame-to-machine_function.patch baa27a4b912d8e27cd65a556b09cf45289a0e00e86dae3925f2923d1f3752080e80d80e159c996ef4156c4df1dfc3069114810a846672170ef3ae461ae0ab7e1 0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch 6701d15000bdd7c4c98a8fece8c814f5e4e73603eecf84fe4dc5ac10f79b3074afba7c2cc9e51d08b2abade1c34cb0c944c08ead7a85db94e97158c752fd1aac 0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch diff --git a/cross/gcc6-armv7/gcc-4.9-musl-fortify.patch b/cross/gcc6-armv7/gcc-4.9-musl-fortify.patch deleted file mode 100644 index daae954c8..000000000 --- a/cross/gcc6-armv7/gcc-4.9-musl-fortify.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.9.2/gcc/config/linux.h.orig 2015-03-09 13:27:13.289736710 +0000 -+++ gcc-4.9.2/gcc/config/linux.h 2015-03-09 13:29:32.295625046 +0000 -@@ -146,6 +146,8 @@ - - #ifdef NATIVE_SYSTEM_HEADER_DIR - #define INCLUDE_DEFAULTS_MUSL_NATIVE \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, - #else diff --git a/cross/gcc6-armv7/gcc-6.4-isl.patch b/cross/gcc6-armv7/gcc-6.4-isl.patch new file mode 100644 index 000000000..58a4aa054 --- /dev/null +++ b/cross/gcc6-armv7/gcc-6.4-isl.patch @@ -0,0 +1,251 @@ +From cc46a51d4ff8bc1c42b7e6ae472494733bed5c49 Mon Sep 17 00:00:00 2001 +From: Richard Biener +Date: Thu, 16 Feb 2017 07:53:53 +0000 +Subject: [PATCH] graphite.h: Do not include isl/isl_val_gmp.h, instead include + isl/isl_val.h. + +2017-02-16 Richard Biener + + * graphite.h: Do not include isl/isl_val_gmp.h, instead include + isl/isl_val.h. + * graphite-isl-ast-to-gimple.c (gmp_cst_to_tree): Remove. + (gcc_expression_from_isl_expr_int): Use generic isl_val interface. + * graphite-sese-to-poly.c: Do not include isl/isl_val_gmp.h. + (isl_val_int_from_wi): New function. + (extract_affine_gmp): Rename to ... + (extract_affine_wi): ... this, take a widest_int. + (extract_affine_int): Just wrap extract_affine_wi. + (add_param_constraints): Use isl_val_int_from_wi. + (add_loop_constraints): Likewise, and extract_affine_wi. + +From-SVN: r245501 +--- + gcc/ChangeLog | 14 ++++++++ + gcc/graphite-isl-ast-to-gimple.c | 30 +++++------------ + gcc/graphite-sese-to-poly.c | 58 ++++++++++++++------------------ + gcc/graphite.h | 2 +- + 4 files changed, 50 insertions(+), 54 deletions(-) + +diff --git a/gcc/ChangeLog b/gcc/ChangeLog +index 24d9c1589f456..5fc6142eaa03f 100644 +--- a/gcc/ChangeLog ++++ b/gcc/ChangeLog +@@ -1,3 +1,17 @@ ++2017-02-16 Richard Biener ++ ++ * graphite.h: Do not include isl/isl_val_gmp.h, instead include ++ isl/isl_val.h. ++ * graphite-isl-ast-to-gimple.c (gmp_cst_to_tree): Remove. ++ (gcc_expression_from_isl_expr_int): Use generic isl_val interface. ++ * graphite-sese-to-poly.c: Do not include isl/isl_val_gmp.h. ++ (isl_val_int_from_wi): New function. ++ (extract_affine_gmp): Rename to ... ++ (extract_affine_wi): ... this, take a widest_int. ++ (extract_affine_int): Just wrap extract_affine_wi. ++ (add_param_constraints): Use isl_val_int_from_wi. ++ (add_loop_constraints): Likewise, and extract_affine_wi. ++ + 2017-02-15 Jeff Law + + PR middle-end/79521 +diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c +index dbdae7a7c155d..ec5fb73d9b2bc 100644 +--- a/gcc/graphite-isl-ast-to-gimple.c ++++ b/gcc/graphite-isl-ast-to-gimple.c +@@ -73,22 +73,6 @@ struct ast_build_info + bool is_parallelizable; + }; + +-/* Converts a GMP constant VAL to a tree and returns it. */ +- +-static tree +-gmp_cst_to_tree (tree type, mpz_t val) +-{ +- tree t = type ? type : integer_type_node; +- mpz_t tmp; +- +- mpz_init (tmp); +- mpz_set (tmp, val); +- wide_int wi = wi::from_mpz (t, tmp, true); +- mpz_clear (tmp); +- +- return wide_int_to_tree (t, wi); +-} +- + /* Verifies properties that GRAPHITE should maintain during translation. */ + + static inline void +@@ -325,16 +309,20 @@ gcc_expression_from_isl_expr_int (tree type, __isl_take isl_ast_expr *expr) + { + gcc_assert (isl_ast_expr_get_type (expr) == isl_ast_expr_int); + isl_val *val = isl_ast_expr_get_val (expr); +- mpz_t val_mpz_t; +- mpz_init (val_mpz_t); ++ size_t n = isl_val_n_abs_num_chunks (val, sizeof (HOST_WIDE_INT)); ++ HOST_WIDE_INT *chunks = XALLOCAVEC (HOST_WIDE_INT, n); + tree res; +- if (isl_val_get_num_gmp (val, val_mpz_t) == -1) ++ if (isl_val_get_abs_num_chunks (val, sizeof (HOST_WIDE_INT), chunks) == -1) + res = NULL_TREE; + else +- res = gmp_cst_to_tree (type, val_mpz_t); ++ { ++ widest_int wi = widest_int::from_array (chunks, n, true); ++ if (isl_val_is_neg (val)) ++ wi = -wi; ++ res = wide_int_to_tree (type, wi); ++ } + isl_val_free (val); + isl_ast_expr_free (expr); +- mpz_clear (val_mpz_t); + return res; + } + +diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c +index ede96e5a3c299..8ff9a22e12916 100644 +--- a/gcc/graphite-sese-to-poly.c ++++ b/gcc/graphite-sese-to-poly.c +@@ -55,7 +55,6 @@ along with GCC; see the file COPYING3. If not see + #include + #include + #include +-#include + + #include "graphite.h" + +@@ -154,16 +153,32 @@ extract_affine_name (scop_p s, tree e, __isl_take isl_space *space) + return isl_pw_aff_alloc (dom, aff); + } + ++/* Convert WI to a isl_val with CTX. */ ++ ++static __isl_give isl_val * ++isl_val_int_from_wi (isl_ctx *ctx, const widest_int &wi) ++{ ++ if (wi::neg_p (wi, SIGNED)) ++ { ++ widest_int mwi = -wi; ++ return isl_val_neg (isl_val_int_from_chunks (ctx, mwi.get_len (), ++ sizeof (HOST_WIDE_INT), ++ mwi.get_val ())); ++ } ++ return isl_val_int_from_chunks (ctx, wi.get_len (), sizeof (HOST_WIDE_INT), ++ wi.get_val ()); ++} ++ + /* Extract an affine expression from the gmp constant G. */ + + static isl_pw_aff * +-extract_affine_gmp (mpz_t g, __isl_take isl_space *space) ++extract_affine_wi (const widest_int &g, __isl_take isl_space *space) + { + isl_local_space *ls = isl_local_space_from_space (isl_space_copy (space)); + isl_aff *aff = isl_aff_zero_on_domain (ls); + isl_set *dom = isl_set_universe (space); + isl_ctx *ct = isl_aff_get_ctx (aff); +- isl_val *v = isl_val_int_from_gmp (ct, g); ++ isl_val *v = isl_val_int_from_wi (ct, g); + aff = isl_aff_add_constant_val (aff, v); + + return isl_pw_aff_alloc (dom, aff); +@@ -174,13 +189,7 @@ extract_affine_gmp (mpz_t g, __isl_take isl_space *space) + static isl_pw_aff * + extract_affine_int (tree e, __isl_take isl_space *space) + { +- mpz_t g; +- +- mpz_init (g); +- tree_int_to_gmp (e, g); +- isl_pw_aff *res = extract_affine_gmp (g, space); +- mpz_clear (g); +- ++ isl_pw_aff *res = extract_affine_wi (wi::to_widest (e), space); + return res; + } + +@@ -411,15 +420,11 @@ add_param_constraints (scop_p scop, graphite_dim_t p) + { + isl_space *space = isl_set_get_space (scop->param_context); + isl_constraint *c; +- mpz_t g; + isl_val *v; + + c = isl_inequality_alloc (isl_local_space_from_space (space)); +- mpz_init (g); +- tree_int_to_gmp (lb, g); +- v = isl_val_int_from_gmp (scop->isl_context, g); ++ v = isl_val_int_from_wi (scop->isl_context, wi::to_widest (lb)); + v = isl_val_neg (v); +- mpz_clear (g); + c = isl_constraint_set_constant_val (c, v); + c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, 1); + +@@ -431,15 +436,11 @@ add_param_constraints (scop_p scop, graphite_dim_t p) + { + isl_space *space = isl_set_get_space (scop->param_context); + isl_constraint *c; +- mpz_t g; + isl_val *v; + + c = isl_inequality_alloc (isl_local_space_from_space (space)); + +- mpz_init (g); +- tree_int_to_gmp (ub, g); +- v = isl_val_int_from_gmp (scop->isl_context, g); +- mpz_clear (g); ++ v = isl_val_int_from_wi (scop->isl_context, wi::to_widest (ub)); + c = isl_constraint_set_constant_val (c, v); + c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, -1); + +@@ -773,11 +774,8 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, + isl_local_space *ls = isl_local_space_from_space (space); + isl_constraint *c = isl_inequality_alloc (ls); + c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, -1); +- mpz_t g; +- mpz_init (g); +- tree_int_to_gmp (nb_iters, g); +- isl_val *v = isl_val_int_from_gmp (scop->isl_context, g); +- mpz_clear (g); ++ isl_val *v ++ = isl_val_int_from_wi (scop->isl_context, wi::to_widest (nb_iters)); + c = isl_constraint_set_constant_val (c, v); + return isl_set_add_constraint (domain, c); + } +@@ -817,12 +815,9 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, + + /* NIT is an upper bound to NB_ITERS: "NIT >= NB_ITERS", although we + do not know whether the loop executes at least once. */ +- mpz_t g; +- mpz_init (g); +- wi::to_mpz (nit, g, SIGNED); +- mpz_sub_ui (g, g, 1); ++ --nit; + +- isl_pw_aff *approx = extract_affine_gmp (g, isl_space_copy (space)); ++ isl_pw_aff *approx = extract_affine_wi (nit, isl_space_copy (space)); + isl_set *x = isl_pw_aff_ge_set (approx, aff_nb_iters); + x = isl_set_project_out (x, isl_dim_set, 0, + isl_set_dim (x, isl_dim_set)); +@@ -831,8 +826,7 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, + ls = isl_local_space_from_space (space); + c = isl_inequality_alloc (ls); + c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, -1); +- isl_val *v = isl_val_int_from_gmp (scop->isl_context, g); +- mpz_clear (g); ++ isl_val *v = isl_val_int_from_wi (scop->isl_context, nit); + c = isl_constraint_set_constant_val (c, v); + + if (dump_file) +diff --git a/gcc/graphite.h b/gcc/graphite.h +index 5103c614ff140..d22c4f2693f52 100644 +--- a/gcc/graphite.h ++++ b/gcc/graphite.h +@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see + #include "sese.h" + #include + #include +-#include ++#include + #include + #include + #include