aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2018-09-18 23:36:48 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2018-09-18 23:36:48 +0100
commita23e6057c94403e010a4ccd06091b59cc332e593 (patch)
tree49f2507a9500412780d20e1e14756de28f39987a
parentcrossdev: default to USE=-pie for bare-metal mips targets (diff)
downloadcrossdev-a23e6057c94403e010a4ccd06091b59cc332e593.tar.gz
crossdev-a23e6057c94403e010a4ccd06091b59cc332e593.tar.bz2
crossdev-a23e6057c94403e010a4ccd06091b59cc332e593.zip
crossdev: don't enable USE=pie by default on any bare-metal targets
Unfortunately embedded world has a long way to go to adopt --enable-default-pie as a first class citizen. Note: --enable-default-pie enabled two things: - PIC-friendly code generation (-fPIE) - PIE executables (-pie) Normally one would expect firmware to pass compiler modes explicitly to gcc: -fPIC (or -mauto-pic, -fno-PIC), -ffreestanding, -nostdlib. Unfortunately upstreams are frequently reluctant to explicitly specify new moving parts available in gcc (in this case -no-pie) and expect gcc to behave as it used to in the world before --enable-default-pie. Unfortunate but not entirely unreasonable. Disable --enable-default-pie until user explicitly requests USE=pie. Reported-by: Bertrand Jacquin Reported-by: sklv Bug: https://lists.gnupg.org/pipermail/gnuk-users/2018-August/000086.html Bug: https://github.com/gl-sergei/u2f-token/issues/14 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rwxr-xr-xcrossdev13
1 files changed, 7 insertions, 6 deletions
diff --git a/crossdev b/crossdev
index 81bd50d..b8027a3 100755
--- a/crossdev
+++ b/crossdev
@@ -397,13 +397,14 @@ parse_target() {
# [2.] mingw32 startup code is broken: bug #644930
# at least on i686-w64-mingw32 and x86_64-w64-mingw32
mingw*|*-mingw*) pie_support=no;;
- # Some bare-metal targets don't work with pie as-is
+ # Many bare-metal targets don't work with pie as-is
*-elf|*-eabi)
- case ${CTARGET} in
- # mips can't generate freestanding PIC:
- # cc1: error: position-independent code requires ‘-mabicalls’
- mips*) pie_support=no;;
- esac
+ # mips can't generate freestanding PIC:
+ # cc1: error: position-independent code requires ‘-mabicalls’
+ # arm firmware packages don't expect pie-by-default:
+ # https://lists.gnupg.org/pipermail/gnuk-users/2018-August/000086.html
+ # https://github.com/gl-sergei/u2f-token/issues/14
+ pie_support=no
;;
esac
if [[ $pie_support = "no" ]]; then