commit:     d6c59e8252caed2b0b382a5ea81db6988ebe585c
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 15:40:53 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 15:40:53 2018 +0000
URL:        https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=d6c59e82

crossdev: default to USE=-pie for bare-metal mips targets

When built with pie-by-default compiling gcc fails as:
    cc1: error: position-independent code requires ‘-mabicalls’

Tested as:
    USE=-pie crossdev -t mipsel-elf

Reported-by: rhn
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 crossdev | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/crossdev b/crossdev
index 4ee7076..81bd50d 100755
--- a/crossdev
+++ b/crossdev
@@ -397,6 +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
+               *-elf|*-eabi)
+                       case ${CTARGET} in
+                               # mips can't generate freestanding PIC:
+                               #   cc1: error: position-independent code 
requires ‘-mabicalls’
+                               mips*) pie_support=no;;
+                       esac
+                       ;;
        esac
        if [[ $pie_support = "no" ]]; then
                # pie is >=gcc-6, nopie is <gcc-6

Reply via email to