commit: 1803a14a1ad634a1e1153efd2f906aa1c7bb0fc1 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> AuthorDate: Sat Jan 20 12:30:01 2018 +0000 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> CommitDate: Sat Jan 20 12:30:01 2018 +0000 URL: https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=1803a14a
crossdev: blacklist known broken targets for PIE and SSP, bug #644930 - SSP is not supported by alpha, hppa, ia64, avr, nios2, mmix - PIE is not supported by avr, mmix, mingw32 Bug: https://bugs.gentoo.org/644930 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> crossdev | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/crossdev b/crossdev index 10097a0..3eccfcd 100755 --- a/crossdev +++ b/crossdev @@ -228,7 +228,7 @@ parse_target() { avr*) KPKG="[none]" LCAT="dev-embedded" LPKG="avr-libc" - GUSE+=" -fortran -go -pie nopie" # doesn't work + GUSE+=" -fortran -go" # doesn't work MULTILIB_USE="yes" #377039 BUSE+=" cxx" STAGE_DEFAULT=${STAGE_LIBC} @@ -334,6 +334,10 @@ parse_target() { ;; esac + # Target-specific defaults (workarounds for upstream bugs). User + # can override them by passing 'USE=foo crossdev ...'. Useful when + # one wants to fix upstream bugs. + local sanitizer_support=no # Whitelist asan on explicitly supported arches for linux. # Broken examples: @@ -379,6 +383,36 @@ parse_target() { if [[ $vtv_support = "no" ]]; then GUSE+=" -vtv" fi + + local pie_support=yes + # Blacklist rare targets that: + # 1. don't support -fPIC in compiler + # 2. have -fPIE broken + case ${CTARGET} in + # [1.]: no -fPIC flag support: + # check as '$CC -fPIC -c -x c - </dev/null' + avr*|mmix*) pie_support=no;; + # [2.] mingw32 startup code is broken: bug #644930 + mingw32|i686-w64-mingw32) pie_support=no;; + esac + if [[ $pie_support = "no" ]]; then + # pie is >=gcc-6, nopie is <gcc-6 + GUSE+=" -pie nopie" + fi + + local ssp_support=yes + # Blacklist rare targets that: + # 1. don't support -fstack-protector in compiler + # 2. have -fstack-protector broken + case ${CTARGET} in + # [1.]: no -fstack-protector flag support: + # check as '$CC -fstack-protector -c -x c - </dev/null' + alpha*|avr*|hppa*|ia64*|mmix*|nios2*) ssp_support=no;; + esac + if [[ $ssp_support = "no" ]]; then + # ssp is >=gcc-6, nossp is <gcc-6 + GUSE+=" -ssp nossp" + fi } parse_repo_config() { @@ -1089,8 +1123,8 @@ set_portage() { case ${CTARGET} in # avr requires multilib, that provides # libgcc for all sub-architectures #378387 - avr*) set_use_force ${pkg} multilib -pie; - set_use_mask ${pkg} -multilib pie;; + avr*) set_use_force ${pkg} multilib + set_use_mask ${pkg} -multilib;; *-newlib|*-elf|*-eabi) set_use_force ${pkg} multilib; set_use_mask ${pkg} -multilib;;
