From 293b7d4c34fb5285799bb5149595e29dae34cac9 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 22 Jul 2023 02:49:03 +0100 Subject: gentoo auto-resync : 22:07:2023 - 02:49:03 --- eclass/toolchain-funcs.eclass | 50 +++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 28 deletions(-) (limited to 'eclass/toolchain-funcs.eclass') diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 78ebfe54e41a..e194342f7bb5 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -338,7 +338,7 @@ tc-is-static-only() { tc-stack-grows-down() { # List the few that grow up. case ${ARCH} in - hppa|metag) return 1 ;; + hppa|metag) return 1 ;; esac # Assume all others grow down. @@ -535,7 +535,7 @@ tc-ld-force-bfd() { # Set up LD to point directly to bfd if it's available. # We need to extract the first word in case there are flags appended - # to its value (like multilib). #545218 + # to its value (like multilib), bug #545218. local ld=$(tc-getLD "$@") local bfd_ld="${ld%% *}.bfd" local path_ld=$(type -P "${bfd_ld}" 2>/dev/null) @@ -543,24 +543,17 @@ tc-ld-force-bfd() { # Set up LDFLAGS to select bfd based on the gcc / clang version. local fallback="true" - if tc-is-gcc; then - local major=$(gcc-major-version "$@") - local minor=$(gcc-minor-version "$@") - if [[ ${major} -gt 4 ]] || [[ ${major} -eq 4 && ${minor} -ge 8 ]]; then - # gcc-4.8+ supports -fuse-ld directly. - export LDFLAGS="${LDFLAGS} -fuse-ld=bfd" - fallback="false" - fi - elif tc-is-clang; then - local major=$(clang-major-version "$@") - local minor=$(clang-minor-version "$@") - if [[ ${major} -gt 3 ]] || [[ ${major} -eq 3 && ${minor} -ge 5 ]]; then - # clang-3.5+ supports -fuse-ld directly. - export LDFLAGS="${LDFLAGS} -fuse-ld=bfd" - fallback="false" - fi + if tc-is-gcc || tc-is-clang ; then + export LDFLAGS="${LDFLAGS} -fuse-ld=bfd" fi + if [[ ${fallback} == "true" ]] ; then + # TODO: Clean this up, or is it useful for when the compiler can't + # be detected or for rubbish shims? Might be helpful for cases like + # when porting to new linker which GCC doesn't yet recognise (less + # of a problem for Clang as it accepts absolute paths), like was + # the case for mold. + # # <=gcc-4.7 and <=clang-3.4 require some coercion. # Only works if bfd exists. if [[ -e ${path_ld} ]] ; then @@ -647,6 +640,7 @@ tc-has-tls() { return *i ? j : *i; } EOF + local flags case $1 in -s) flags="-S";; @@ -654,6 +648,7 @@ tc-has-tls() { -l) ;; -*) die "Usage: tc-has-tls [-c|-l] [toolchain prefix]";; esac + : "${flags:=-fPIC -shared -Wl,-z,defs}" [[ $1 == -* ]] && shift $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" >&/dev/null @@ -710,7 +705,7 @@ tc-ninja_magic_to_arch() { score*) echo score;; sh64*) _tc_echo_kernel_alias sh64 sh;; sh*) echo sh;; - sparc64*) ninj sparc64 sparc;; + sparc64*) _tc_echo_kernel_alias sparc64 sparc;; sparc*) [[ ${PROFILE_ARCH} == "sparc64" ]] \ && _tc_echo_kernel_alias sparc64 sparc \ || echo sparc @@ -731,7 +726,7 @@ tc-ninja_magic_to_arch() { # since our usage of tc-arch is largely concerned with # normalizing inputs for testing ${CTARGET}, let's filter # other cross targets (mingw and such) into the unknown. - *) echo unknown;; + *) echo unknown;; esac } # @FUNCTION: tc-arch-kernel @@ -781,7 +776,7 @@ tc-endian() { sh*) echo little;; sparc*) echo big;; x86_64*) echo little;; - *) echo wtf;; + *) echo wtf;; esac } @@ -1058,18 +1053,17 @@ gen_usr_ldscript() { tc-is-static-only && return - # We only care about stuffing / for the native ABI. #479448 + # We only care about stuffing / for the native ABI, bug #479448 if [[ $(type -t multilib_is_native_abi) == "function" ]] ; then multilib_is_native_abi || return 0 fi - # Eventually we'd like to get rid of this func completely #417451 + # Eventually we'd like to get rid of this func completely, bug #417451 case ${CTARGET:-${CHOST}} in - *-darwin*) ;; - *-android*) return 0 ;; - *linux*) - use prefix && return 0 ;; - *) return 0 ;; + *-darwin*) ;; + *-android*) return 0 ;; + *linux*) use prefix && return 0 ;; + *) return 0 ;; esac # Just make sure it exists -- cgit v1.2.3