Skip to content

Commit

Permalink
Fix symbol visibility (#26)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
PeterJohnson authored Oct 14, 2022
1 parent 419a681 commit c8511de
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion makes/src/30-binutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions makes/src/utils/funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions utils/test-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit c8511de

Please sign in to comment.