summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-12-26 19:38:09 +0000
committerV3n3RiX <venerix@koprulu.sector>2023-12-26 19:38:09 +0000
commit7ab79528a3e9a77497eb58022bb0e775e7440885 (patch)
tree10bac8ed3339f6c09a7afc5111ff705b708831d1 /eclass
parentc25546f65119d2fb9a2f79588fd130d62989eddb (diff)
gentoo auto-resync : 26:12:2023 - 19:38:09
Diffstat (limited to 'eclass')
-rw-r--r--eclass/Manifest.gzbin38916 -> 38918 bytes
-rw-r--r--eclass/toolchain-funcs.eclass21
2 files changed, 21 insertions, 0 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index 307ddee8a1c8..40f6f860486f 100644
--- a/eclass/Manifest.gz
+++ b/eclass/Manifest.gz
Binary files differ
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 5da93063866b..cde84e6f34c8 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1230,4 +1230,25 @@ tc-get-build-ptr-size() {
die "Could not determine CBUILD pointer size"
}
+# @FUNCTION: tc-is-lto
+# @RETURN: Shell true if we are using LTO, shell false otherwise
+tc-is-lto() {
+ local f="${T}/test-lto.o"
+
+ case $(tc-get-compiler-type) in
+ clang)
+ $(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die
+ # If LTO is used, clang will output bytecode and llvm-bcanalyzer
+ # will run successfully. Otherwise, it will output plain object
+ # file and llvm-bcanalyzer will exit with error.
+ llvm-bcanalyzer "${f}" &>/dev/null && return 0
+ ;;
+ gcc)
+ $(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die
+ [[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && return 0
+ ;;
+ esac
+ return 1
+}
+
fi