mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-10 14:36:58 +02:00
eclass/toolchain-funcs: Sync with Gentoo
It's from Gentoo commit c7f5ca73ddfab78834c5bf240cb544e07a6d61ab.
This commit is contained in:
parent
a2b065614b
commit
aeca7bf1c4
@ -1,4 +1,4 @@
|
||||
# Copyright 2002-2023 Gentoo Authors
|
||||
# Copyright 2002-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# @ECLASS: toolchain-funcs.eclass
|
||||
@ -251,7 +251,7 @@ tc-detect-is-softfloat() {
|
||||
|
||||
case ${CTARGET:-${CHOST}} in
|
||||
# Avoid autodetection for bare-metal targets. bug #666896
|
||||
*-newlib|*-elf|*-eabi)
|
||||
*-newlib|*-elf|*-eabi|arm64-apple-darwin*)
|
||||
return 1 ;;
|
||||
|
||||
# arm-unknown-linux-gnueabi is ambiguous. We used to treat it as
|
||||
@ -295,6 +295,8 @@ tc-tuple-is-softfloat() {
|
||||
# bare-metal targets have their defaults. bug #666896
|
||||
*-newlib|*-elf|*-eabi)
|
||||
echo "no" ;;
|
||||
arm64-apple-darwin*)
|
||||
echo "no" ;;
|
||||
arm*)
|
||||
echo "yes" ;;
|
||||
*)
|
||||
@ -626,7 +628,14 @@ tc-has-tls() {
|
||||
-*) die "Usage: tc-has-tls [-c|-l] [toolchain prefix]";;
|
||||
esac
|
||||
|
||||
: "${flags:=-fPIC -shared -Wl,-z,defs}"
|
||||
case "${CHOST}" in
|
||||
*-darwin*)
|
||||
# bug #612370
|
||||
: ${flags:=-dynamiclib}
|
||||
;;
|
||||
*)
|
||||
: ${flags:=-fPIC -shared -Wl,-z,defs}
|
||||
esac
|
||||
[[ $1 == -* ]] && shift
|
||||
$(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" >&/dev/null
|
||||
local ret=$?
|
||||
@ -645,6 +654,7 @@ tc-ninja_magic_to_arch() {
|
||||
[[ -z ${host} ]] && host=${CTARGET:-${CHOST}}
|
||||
|
||||
case ${host} in
|
||||
arm64*) echo arm64;;
|
||||
aarch64*) echo arm64;;
|
||||
alpha*) echo alpha;;
|
||||
arc*) echo arc;;
|
||||
@ -1032,6 +1042,7 @@ gen_usr_ldscript() {
|
||||
[[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/
|
||||
|
||||
tc-is-static-only && return
|
||||
use prefix && return
|
||||
|
||||
# We only care about stuffing / for the native ABI, bug #479448
|
||||
if [[ $(type -t multilib_is_native_abi) == "function" ]] ; then
|
||||
@ -1234,6 +1245,7 @@ tc-get-build-ptr-size() {
|
||||
# @RETURN: Shell true if we are using LTO, shell false otherwise
|
||||
tc-is-lto() {
|
||||
local f="${T}/test-lto.o"
|
||||
local ret=1
|
||||
|
||||
case $(tc-get-compiler-type) in
|
||||
clang)
|
||||
@ -1241,14 +1253,25 @@ tc-is-lto() {
|
||||
# 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
|
||||
llvm-bcanalyzer "${f}" &>/dev/null && ret=0
|
||||
;;
|
||||
gcc)
|
||||
$(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die
|
||||
[[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && return 0
|
||||
[[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && ret=0
|
||||
;;
|
||||
esac
|
||||
return 1
|
||||
rm -f "${f}" || die
|
||||
return "${ret}"
|
||||
}
|
||||
|
||||
# @FUNCTION: tc-has-64bit-time_t
|
||||
# @RETURN: Shell true if time_t is at least 64 bits long, false otherwise
|
||||
tc-has-64bit-time_t() {
|
||||
$(tc-getCC) ${CFLAGS} ${CPPFLAGS} -c -x c - -o /dev/null <<-EOF &>/dev/null
|
||||
#include <sys/types.h>
|
||||
int test[sizeof(time_t) >= 8 ? 1 : -1];
|
||||
EOF
|
||||
return $?
|
||||
}
|
||||
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user