Skip to content

Commit

Permalink
eclass/toolchain-funcs: sync with gx86
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
  • Loading branch information
grobian committed Aug 10, 2024
1 parent 27820f8 commit 5beccb2
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions eclass/toolchain-funcs.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -665,16 +665,7 @@ tc-ninja_magic_to_arch() {
frv*) echo frv;;
hexagon*) echo hexagon;;
hppa*) _tc_echo_kernel_alias parisc hppa;;
i?86*)
# Starting with linux-2.6.24, the 'x86_64' and 'i386'
# trees have been unified into 'x86'.
# FreeBSD still uses i386
if [[ ${type} == "kern" && ${host} == *freebsd* ]] ; then
echo i386
else
echo x86
fi
;;
i?86*) echo x86;;
ia64*) echo ia64;;
loongarch*) _tc_echo_kernel_alias loongarch loong;;
m68*) echo m68k;;
Expand Down Expand Up @@ -1062,8 +1053,7 @@ gen_usr_ldscript() {
case ${CTARGET:-${CHOST}} in
*-darwin*) ;;
*-android*) return 0 ;;
*linux*|*-freebsd*|*-openbsd*|*-netbsd*)
use prefix && return 0 ;;
*linux*) use prefix && return 0 ;;
*) return 0 ;;
esac

Expand Down Expand Up @@ -1255,21 +1245,33 @@ 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)
$(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
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

0 comments on commit 5beccb2

Please sign in to comment.