commit:     a23e6057c94403e010a4ccd06091b59cc332e593
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 18 22:36:48 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Sep 18 22:36:48 2018 +0000
URL:        https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=a23e6057

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 <AT> gentoo.org>

 crossdev | 13 +++++++------
 1 file 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

Reply via email to