Skip to content

Commit

Permalink
fix path to sanitize-ignorelist when running in CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
lalten committed Jan 13, 2024
1 parent a7f195d commit b47cd41
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion toolchain/cc_wrapper.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,18 @@ elif [[ ${BASH_SOURCE[0]} == "/"* ]]; then
# This script is at _execroot_/external/_repo_name_/bin/clang_wrapper.sh
execroot_path="${BASH_SOURCE[0]%/*/*/*/*}"
clang="${execroot_path}/%{toolchain_path_prefix}bin/clang"
exec "${clang}" "${@}"

# If we're compiling with -fsanitize-ignorelist, we need fix that path
args=("$@")
for ((i = 0; i < $#; i++)); do
if [[ ${args[i]} =~ ^-fsanitize-(ignore|black)list=[^/] ]]; then
path="${args[i]#*=}"
args[i]="-fsanitize-blacklist=${execroot_path}/${path}"
break
fi
done

exec "${clang}" "${args[@]}"
else
echo >&2 "ERROR: could not find clang; PWD=\"${PWD}\"; PATH=\"${PATH}\"."
exit 5
Expand Down

0 comments on commit b47cd41

Please sign in to comment.