Skip to content

Commit

Permalink
clang.bbclass: create lld symbolic link in sysroot when ld-is-lld is set
Browse files Browse the repository at this point in the history
Create a symbolic link lld -> ld in recipe sysroot to choose the
default linker lld when ld-is-lld is set in DISTRO_FEATURES. othereise,
we can get linking issues when '-fuse-ld=lld' is in LDFLAGS but the
actual ld is not lld.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
  • Loading branch information
liuming50 authored and kraj committed May 26, 2023
1 parent b9df712 commit 71321dd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions classes/clang.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ set( CMAKE_CLANG_TIDY ${HOST_PREFIX}clang-tidy )
EOF
sed -i 's/ -mmusl / /g' ${WORKDIR}/toolchain.cmake
}

RECIPESYSROOTFUNCS = ""
RECIPESYSROOTFUNCS:toolchain-clang = "recipe_sysroot_check_ld_is_lld"

recipe_sysroot_check_ld_is_lld () {
if "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', 'true', 'false', d)}"; then
ln -srf ${RECIPE_SYSROOT_NATIVE}${bindir}/${TARGET_SYS}/${TARGET_PREFIX}ld.lld ${RECIPE_SYSROOT_NATIVE}${bindir}/${TARGET_SYS}/${TARGET_PREFIX}ld
fi
}
do_prepare_recipe_sysroot[postfuncs] += "${RECIPESYSROOTFUNCS}"
#
# dump recipes which still use gcc
#python __anonymous() {
Expand Down

0 comments on commit 71321dd

Please sign in to comment.