Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/crossdev:master commit in: /
Date: Tue, 18 Sep 2018 22:44:38
Message-Id: 1537310208.a23e6057c94403e010a4ccd06091b59cc332e593.slyfox@gentoo
1 commit: a23e6057c94403e010a4ccd06091b59cc332e593
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 18 22:36:48 2018 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 18 22:36:48 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=a23e6057
7
8 crossdev: don't enable USE=pie by default on any bare-metal targets
9
10 Unfortunately embedded world has a long way to go
11 to adopt --enable-default-pie as a first class citizen.
12
13 Note:
14 --enable-default-pie enabled two things:
15 - PIC-friendly code generation (-fPIE)
16 - PIE executables (-pie)
17
18 Normally one would expect firmware to pass compiler modes explicitly
19 to gcc: -fPIC (or -mauto-pic, -fno-PIC), -ffreestanding, -nostdlib.
20
21 Unfortunately upstreams are frequently reluctant to explicitly specify
22 new moving parts available in gcc (in this case -no-pie) and expect
23 gcc to behave as it used to in the world before --enable-default-pie.
24 Unfortunate but not entirely unreasonable.
25
26 Disable --enable-default-pie until user explicitly requests USE=pie.
27
28 Reported-by: Bertrand Jacquin
29 Reported-by: sklv
30 Bug: https://lists.gnupg.org/pipermail/gnuk-users/2018-August/000086.html
31 Bug: https://github.com/gl-sergei/u2f-token/issues/14
32 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
33
34 crossdev | 13 +++++++------
35 1 file changed, 7 insertions(+), 6 deletions(-)
36
37 diff --git a/crossdev b/crossdev
38 index 81bd50d..b8027a3 100755
39 --- a/crossdev
40 +++ b/crossdev
41 @@ -397,13 +397,14 @@ parse_target() {
42 # [2.] mingw32 startup code is broken: bug #644930
43 # at least on i686-w64-mingw32 and x86_64-w64-mingw32
44 mingw*|*-mingw*) pie_support=no;;
45 - # Some bare-metal targets don't work with pie as-is
46 + # Many bare-metal targets don't work with pie as-is
47 *-elf|*-eabi)
48 - case ${CTARGET} in
49 - # mips can't generate freestanding PIC:
50 - # cc1: error: position-independent code requires ‘-mabicalls’
51 - mips*) pie_support=no;;
52 - esac
53 + # mips can't generate freestanding PIC:
54 + # cc1: error: position-independent code requires ‘-mabicalls’
55 + # arm firmware packages don't expect pie-by-default:
56 + # https://lists.gnupg.org/pipermail/gnuk-users/2018-August/000086.html
57 + # https://github.com/gl-sergei/u2f-token/issues/14
58 + pie_support=no
59 ;;
60 esac
61 if [[ $pie_support = "no" ]]; then