summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-07-21 23:23:15 +0100
committerSam James <sam@gentoo.org>2023-07-22 00:23:12 +0100
commitc4e911da66c918bd0944d1457776b82260657cd6 (patch)
tree2599b9e5a6273ba4720a25a404fad5207a84fb2c /eclass
parenttoolchain-funcs.eclass: formatting tweaks (diff)
downloadgentoo-c4e911da66c918bd0944d1457776b82260657cd6.tar.gz
gentoo-c4e911da66c918bd0944d1457776b82260657cd6.tar.bz2
gentoo-c4e911da66c918bd0944d1457776b82260657cd6.zip
toolchain-funcs.eclass: cleanup old gcc/clang logic in tc-ld-force-bfd
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/toolchain-funcs.eclass24
1 files changed, 8 insertions, 16 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 2f5ed29e875d..e194342f7bb5 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -543,25 +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