From c8511de39566dc159b9eaf53bcfd5ae3b7ea9b62 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 14 Oct 2022 13:29:23 -0700 Subject: [PATCH] Fix symbol visibility (#26) This was broken as binutils wasn't being installed in the frontend in non-cross builds. * Check if frontend for tuple compare in binutils build * Add test for symbol visibility * funcs: Use TARGET_PREFIX --- makes/src/30-binutils.sh | 2 +- makes/src/utils/funcs.sh | 4 ++-- utils/test-toolchain.sh | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/makes/src/30-binutils.sh b/makes/src/30-binutils.sh index 8ab991e..4b8fc04 100644 --- a/makes/src/30-binutils.sh +++ b/makes/src/30-binutils.sh @@ -44,7 +44,7 @@ process_background "Building binutils" \ process_background "Installing binutils" \ make DESTDIR="${BUILD_DIR}/binutils-install" \ install-strip || die "binutils install failed" -if is_step_backend; then +if is_step_backend || (is_step_frontend && [ "$WPI_BUILD_TUPLE" == "$WPI_HOST_TUPLE" ]); then # GCC needs binutils in prefix path while building # the target libraries. Previously this required # the build user to have root access, but now diff --git a/makes/src/utils/funcs.sh b/makes/src/utils/funcs.sh index dbb8387..25dbc13 100644 --- a/makes/src/utils/funcs.sh +++ b/makes/src/utils/funcs.sh @@ -61,11 +61,11 @@ configure_host_vars() { } configure_target_vars() { - env_exists TARGET_TUPLE + env_exists TARGET_PREFIX define_target_export() { local var="${1}_FOR_TARGET" - local tool="${TARGET_TUPLE}-$2" + local tool="${TARGET_PREFIX}$2" if [ "${!var}" ]; then die "$var is already set with '${!var}'" else diff --git a/utils/test-toolchain.sh b/utils/test-toolchain.sh index 1bbe69d..be7da95 100644 --- a/utils/test-toolchain.sh +++ b/utils/test-toolchain.sh @@ -76,6 +76,8 @@ echo "[INFO]: Testing C Compiler with libasan" "$CC" "${TEST_DIR}/hello.c" -o /dev/null -fsanitize=address || exit echo "[INFO]: Testing C Compiler with libubsan" "$CC" "${TEST_DIR}/hello.c" -o /dev/null -fsanitize=undefined || exit +echo "[INFO]: Testing C Compiler with symbol visibility" +"$CC" "${TEST_DIR}/hello.c" -o /dev/null -fvisibility=hidden -Werror || exit if [ "${TARGET_ENABLE_CXX}" = "true" ]; then echo "[INFO]: Testing C++ Compiler" @@ -84,6 +86,8 @@ if [ "${TARGET_ENABLE_CXX}" = "true" ]; then "$CXX" "${TEST_DIR}/hello.cpp" -o /dev/null -fsanitize=address || exit echo "[INFO]: Testing C++ Compiler with libubsan" "$CXX" "${TEST_DIR}/hello.cpp" -o /dev/null -fsanitize=undefined || exit + echo "[INFO]: Testing C++ Compiler with symbol visibility" + "$CXX" "${TEST_DIR}/hello.cpp" -o /dev/null -fvisibility=hidden -Werror || exit fi if [ "${TARGET_ENABLE_FORTRAN}" = "true" ]; then