Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 7 additions & 28 deletions crossdev
Original file line number Diff line number Diff line change
Expand Up @@ -1919,35 +1919,14 @@ if ! ex_fast ; then

# stage 0: binutils
if [[ "${LLVM}" == "yes" ]] ; then
if ! portageq has_version / "llvm-core/llvm" ; then
eerror "LLVM is not installed"
exit 1
fi

best_ver=$(portageq best_version "${EPREFIX}"/ llvm-core/llvm)
llvm_use=$(portageq metadata "${EPREFIX}"/ installed "${best_ver}" USE)

llvm_arch=""
case ${CTARGET} in
x86*) llvm_arch="X86" ;;
arm*) llvm_arch="ARM" ;;
aarch64*) llvm_arch="AArch64" ;;
riscv*) llvm_arch="RISCV" ;;
mips*) llvm_arch="Mips" ;;
loongarch*) llvm_arch="LoongArch" ;;
powerpc*) llvm_arch="PowerPC" ;;
sparc*) llvm_arch="Sparc" ;;
esac

supported_arch=0
for flag in ${llvm_use} ; do
if [[ ${flag} == llvm_targets_* ]] ; then
target=${flag#llvm_targets_}
[[ ${llvm_arch} == ${target} ]] && supported_arch=1
fi
done

[[ ${supported_arch} -eq 0 ]] && die "Target architecture not supported by installed LLVM toolchain"
CC=${CC:-clang}
if ! ${CC} -target ${CTARGET} -mcpu=help &> /dev/null; then
case $? in
1) die "Target architecture not supported by installed LLVM toolchain" ;;
*) die "LLVM is not installed" ;;
esac
fi

USE="${CUSE}" doemerge ${CPKG}
else
Expand Down