X-Original-To: alpine-aports@lists.alpinelinux.org Received: from mx12.valuehost.ru (mx12.valuehost.ru [217.112.42.215]) by lists.alpinelinux.org (Postfix) with ESMTP id 53C8D5C662F for ; Mon, 3 Dec 2018 10:54:11 +0000 (GMT) Received: from mx7.valuehost.ru (unknown [127.0.0.255]) by mx12.valuehost.ru (Postfix) with ESMTP id E27B54C4A2 for ; Mon, 3 Dec 2018 13:54:09 +0300 (MSK) From: alpine-mips-patches Date: Mon, 3 Dec 2018 10:26:30 +0000 Subject: [alpine-aports] [PATCH] main/gcc: fix -static and -static-pie option handling on mips* To: alpine-aports@lists.alpinelinux.org Message-Id: <20181203105409.E27B54C4A2@mx12.valuehost.ru> X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: 1) Fix '--as-needed' spelling for mips (and riscv, while here). The '-static -pie' (with '-pie' implied or explicit) support was somehow broken on mips* without this correction. 2) Fix missing '-static-pie' option handling on mips by actually passing '-static -pie' to linker when needed. With this change toolchain is able to create reasonably-looking mipsel static PIE binaries that work under qemu-mipsel user-mode emulation but fail on real hardware. --- main/gcc/0012-static-pie-mips.patch | 18 ++++++++++++++++++ main/gcc/005_all_default-as-needed.patch | 4 ++-- main/gcc/APKBUILD | 6 ++++-- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 main/gcc/0012-static-pie-mips.patch diff --git a/main/gcc/0012-static-pie-mips.patch b/main/gcc/0012-static-pie-mips.patch new file mode 100644 index 0000000000..1a4ec56a04 --- /dev/null +++ b/main/gcc/0012-static-pie-mips.patch @@ -0,0 +1,18 @@ +--- a/gcc/config/mips/gnu-user.h ++++ b/gcc/config/mips/gnu-user.h +@@ -56,12 +56,12 @@ + #define GNU_USER_TARGET_LINK_SPEC "\ + %{G*} %{EB} %{EL} %{mips*} %{shared} \ + %{!shared: \ +- %{!static: \ ++ %{!static: %{!static-pie: \ + %{rdynamic:-export-dynamic} \ + %{mabi=n32: -dynamic-linker " GNU_USER_DYNAMIC_LINKERN32 "} \ + %{mabi=64: -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \ +- %{mabi=32: -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \ +- %{static}} \ ++ %{mabi=32: -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \ ++ %{static} %{static-pie: -Bstatic -pie --no-dynamic-linker -z text}} \ + %{mabi=n32:-m" GNU_USER_LINK_EMULATIONN32 "} \ + %{mabi=64:-m" GNU_USER_LINK_EMULATION64 "} \ + %{mabi=32:-m" GNU_USER_LINK_EMULATION32 "}" diff --git a/main/gcc/005_all_default-as-needed.patch b/main/gcc/005_all_default-as-needed.patch index 00852197fa..5db93dd6d0 100644 --- a/main/gcc/005_all_default-as-needed.patch +++ b/main/gcc/005_all_default-as-needed.patch @@ -226,7 +226,7 @@ Index: b/gcc/config/mips/gnu-user.h #undef GNU_USER_TARGET_LINK_SPEC #define GNU_USER_TARGET_LINK_SPEC "\ %{G*} %{EB} %{EL} %{mips*} %{shared} \ -+ -as-needed \ ++ --as-needed \ %{!shared: \ %{!static: \ %{rdynamic:-export-dynamic} \ @@ -238,7 +238,7 @@ Index: b/gcc/config/riscv/linux.h #define CPP_SPEC "%{pthread:-D_REENTRANT}" #define LINK_SPEC "\ -+-as-needed \ ++--as-needed \ -melf" XLEN_SPEC "lriscv \ %{mno-relax:--no-relax} \ %{shared} \ diff --git a/main/gcc/APKBUILD b/main/gcc/APKBUILD index c528005ea1..c408114341 100644 --- a/main/gcc/APKBUILD +++ b/main/gcc/APKBUILD @@ -6,7 +6,7 @@ pkgver=8.2.0 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target="" pkgname="$pkgname$_target" -pkgrel=1 +pkgrel=2 pkgdesc="The GNU Compiler Collection" url="http://gcc.gnu.org" arch="all" @@ -158,6 +158,7 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg 0008-s390x-muslldso.patch 0010-ldbl128-config.patch 0012-static-pie.patch + 0012-static-pie-mips.patch libgcc-always-build-gcceh.a.patch gcc-4.9-musl-fortify.patch @@ -556,7 +557,7 @@ gnat() { sha512sums="64898a165f67e136d802a92e7633bf1b06c85266027e52127ea025bf5fc2291b5e858288aac0bdba246e6cdf7c6ec88bc8e0e7f3f6f1985f4297710cafde56ed gcc-8.2.0.tar.xz e36e95b81489163abd6fe9d58f7867bdca43e61143afacbfb17f4698c0b16ec5fd0061d8fab7b2ae615540bebd721c2e2227f80401b4e7fc253da9da62e6b513 002_all_default-relro.patch f86466c62b8291fac46f9c250c7ad8fa5ab7b1cce2504442fd07ddc4543665b317ae28951f244e39aba29aeaf3fff252ec4f6a147aa16adb2b7aed747dd89188 003_all_default-fortify-source.patch -02b725b220e540077efef741e9d457f9e004fe53ae642a138e214875d076a60f7c2f27de0ed9a4225db2030fc9c3d2c5b0414c895b9eec0f5f48fad70e2fb029 005_all_default-as-needed.patch +03824826a5a4bf29c34d11306baa5cf6e0859fc9b89ebde17de58887819c985cb29f731b137811c9b6ee106dfce1ff1afb6e596adb64bb82e401cfb155ab80a6 005_all_default-as-needed.patch 6c9a5068f6eea8a85d297a3555b1d2333ffd4b9ddbfb7560a3e643f8577603871ca123373ef7f96e894225291d88f7bf575c7f8386bcfdd1dabcd7ba12598b65 gcc-as-needed-gold.patch ab0df1862f1b645634e79b8101326ce53215eba39861a455cd145b81b5267a6a61bc6e76b32d53887a0a48873f7efc23e2c52cc04400c6afd89822f245cdbc77 gcc-as-needed-push-pop.patch e026bf9f73ee254528423c6cabdfd7794960c567161581b7d4b7c61c45027e12a6efef79662d4288b9cbaecb4798f01af6a5b4a13b766c2d501444ac1846fd43 011_all_default-warn-format-security.patch @@ -574,6 +575,7 @@ d1c2d7ff7f673375dc7cd84ae9d8515853b5af6390c70bb763412c012101344e4ee1ce155151ce3f 7f434a7350c9b06d0ae7cc18a569d813238483afa34b0801d112844a0dfe6164ae36b0416955fd4da7a8caa54672247f319a8ec7ce4b6a97a5f4e17ec083112a 0008-s390x-muslldso.patch 66085c5555e6b91b6874d1782d5a1dc0ab1792889f9400f48cde9483f82b51b9e3a5de1efbba21a19fc5e664334f2188d0c2bc988d42335efa26118b3c85cc7f 0010-ldbl128-config.patch 45d5bc11a89e5af77503ca06eec52d6d84e6fea0be021aaee1bcc39f8dd3c7b4baa4200cfa2b0688faa0f207d005db89c029eff32f362207aa3d2365b2f2363e 0012-static-pie.patch +a82645202602f192ef722ca062a17050ed609ba4465173f9c23674491f42d67f9c9151b1e32b263c2846e6d0d6474c1a7521db0defe2d2576e8d6f1632b3296f 0012-static-pie-mips.patch d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch 600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch dbe0ee917fc7668571722364ab7c806731e3a31e8bfa30b4941b28b16b877d2a32b4a3897ef533399a28f82d43cac9b28e92de0493f0e779046db56584e07fa4 gcc-6.1-musl-libssp.patch -- 2.19.2 --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---