mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-24 15:11:19 +02:00
eclass/toolchain-funcs: Sync with Gentoo
It's from Gentoo commit 2aea6c3ff2181ad96187e456a3307609fd288d4c.
This commit is contained in:
parent
345c6b2b31
commit
cf3c4e4c10
@ -1230,4 +1230,25 @@ tc-get-build-ptr-size() {
|
|||||||
die "Could not determine CBUILD pointer 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
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user