[langdale 40/41] perfetto: pass TUNE_CCARGS to use machine tune


Armin Kuster
 

From: Markus Volk <f_l_k@...>

We already tried to pass -mfloat-abi=hard if the machine can use it, but since
no floating-point-unit was defined it got stubbed out and the result was, that
only arm targets configured for softfp were able to build perfetto.

Simplify by passing ${TUNE_CCARGS} to ensure, we always use the features, the
machine was configured for.

Also, do not use sed to remove the hardcoded -mfpu=neon entry. If this really
turns out to be problematic, we need to patch it out to avoid not having a
floating-point-unit again.

Signed-off-by: Markus Volk <f_l_k@...>
Signed-off-by: Khem Raj <raj.khem@...>
(cherry picked from commit c23bde86d0bcba3acc677bc4cd3240a8b3116921)
[Fixes build failure]
Signed-off-by: Armin Kuster <akuster808@...>
---
meta-oe/recipes-devtools/perfetto/perfetto.bb | 25 ++++++-------------
1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/meta-oe/recipes-devtools/perfetto/perfetto.bb b/meta-oe/recipes-devtools/perfetto/perfetto.bb
index 98e39f068d..86ab18cacf 100644
--- a/meta-oe/recipes-devtools/perfetto/perfetto.bb
+++ b/meta-oe/recipes-devtools/perfetto/perfetto.bb
@@ -70,24 +70,14 @@ do_configure () {
elif [ $arch = "aarch64" ]; then
arch="arm64"
fi
-
- # For ARM32 with hardware floating point using clang and musl, we need to
- # specify -mfloat-abi=hard to make the ABI settings of the linker and the
- # compiler match. The linker would use hardware float ABI. The compiler does
- # not. As a result we need to force the compiler to do so by adding
- # -mfloat-abi=hard to compilation flags.
- FLOAT_ABI=""
- if [[ "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'true', 'false', d)}" == "true" ]]; then
- FLOAT_ABI="-mfloat-abi=hard"
- fi

ARGS=$ARGS" target_os=\"linux\""
ARGS=$ARGS" target_cpu=\"$arch\""
- ARGS=$ARGS" target_cc=\"$CC_BIN ${FLOAT_ABI}\""
- ARGS=$ARGS" target_cxx=\"$CXX_BIN -std=c++11 ${FLOAT_ABI}\""
+ ARGS=$ARGS" target_cc=\"$CC_BIN ${TUNE_CCARGS}\""
+ ARGS=$ARGS" target_cxx=\"$CXX_BIN -std=c++11 ${TUNE_CCARGS}\""
ARGS=$ARGS" target_strip=\"$STRIP_BIN\"" #
ARGS=$ARGS" target_sysroot=\"${RECIPE_SYSROOT}\""
- ARGS=$ARGS" target_linker=\"$CC_BIN ${FLOAT_ABI} ${LDFLAGS}\""
+ ARGS=$ARGS" target_linker=\"$CC_BIN ${TUNE_CCARGS} ${LDFLAGS}\""
ARGS=$ARGS" target_ar=\"$AR\""
ARGS="'$ARGS'"
cmd="tools/gn gen --args=$ARGS ${B}"
@@ -100,7 +90,6 @@ do_configure () {
# Eliminate a few incompatible build flags
REPLACES="s/-Wl,--icf=all//g"
REPLACES=$REPLACES";s/-Werror//g"
- REPLACES=$REPLACES";s/-mfpu=neon//g"
REPLACES=$REPLACES";s/-fcolor-diagnostics//g"
REPLACES=$REPLACES";s/=format-security//g"
REPLACES=$REPLACES";s/-fdiagnostics-show-template-tree//g"
@@ -111,12 +100,12 @@ do_configure () {

# If using the clang toolchain: use the clang host-side binaries built by Bitbake
if [ "${TOOLCHAIN}" = "clang" ]; then
- BB_CLANGXX="${BUILD_CXX} ${BUILD_LDFLAGS} ${FLOAT_ABI}"
- BB_CLANG="${BUILD_CC} ${FLOAT_ABI}"
+ BB_CLANGXX="${BUILD_CXX} ${BUILD_LDFLAGS} ${TUNE_CCARGS}"
+ BB_CLANG="${BUILD_CC} ${TUNE_CCARGS}"
BB_LLVM_OBJCOPY="${RECIPE_SYSROOT_NATIVE}/usr/bin/llvm-objcopy"

- HOST_CLANGXX="${STAGING_DIR_NATIVE}/usr/bin/clang++ -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc ${FLOAT_ABI}"
- HOST_CLANG="${STAGING_DIR_NATIVE}/usr/bin/clang ${FLOAT_ABI}"
+ HOST_CLANGXX="${STAGING_DIR_NATIVE}/usr/bin/clang++ -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc ${TUNE_CCARGS}"
+ HOST_CLANG="${STAGING_DIR_NATIVE}/usr/bin/clang ${TUNE_CCARGS}"
HOST_LLVM_OBJCOPY="${STAGING_DIR_NATIVE}/usr/bin/llvm-objcopy"

cd gcc_like_host
--
2.25.1