From 3d011acd3231f45648f6bf9eab9748bb4d9357be Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Thu, 8 Oct 2020 10:14:36 +0200 Subject: icecc: handle older icecc versions Older icecc versions can only add gcc or clang to the envronment. So add the gcc arguments first. This way it will always be added but the clang arguments may be ignored. Check the resulting environment to see if clang is present. Skip icecc in the wrapper if clang is not available. Signed-off-by: Michael Olbrich --- scripts/lib/ptxd_lib_icecc.sh | 16 +++++++++++----- scripts/wrapper/clang++-wrapper | 1 + scripts/wrapper/clang-wrapper | 1 + scripts/wrapper/host-clang++-wrapper | 1 + scripts/wrapper/host-clang-wrapper | 1 + scripts/wrapper/libwrapper.sh | 15 ++++++++++++--- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/scripts/lib/ptxd_lib_icecc.sh b/scripts/lib/ptxd_lib_icecc.sh index 06ca99183..98fdd8f42 100644 --- a/scripts/lib/ptxd_lib_icecc.sh +++ b/scripts/lib/ptxd_lib_icecc.sh @@ -39,9 +39,10 @@ ptxd_lib_setup_host_icecc() { args[${#args[@]}]="--clang" args[${#args[@]}]="${wrapper_dir}/real/clang" fi - "${PTXDIST_ICECC_CREATE_ENV}" "${args[@]}" --gcc \ + "${PTXDIST_ICECC_CREATE_ENV}" --gcc \ "${wrapper_dir}/real/gcc" \ - "${wrapper_dir}/real/g++" > "${PTXDIST_TEMPDIR}/icecc.log" 2>&1 || \ + "${wrapper_dir}/real/g++" \ + "${args[@]}" > "${PTXDIST_TEMPDIR}/icecc.log" 2>&1 || \ { cat "${PTXDIST_TEMPDIR}/icecc.log" ptxd_bailout "Failed to create icecc host environment!" @@ -51,6 +52,11 @@ ptxd_lib_setup_host_icecc() { mv "${PTXDIST_TEMPDIR}/host-gcc-version" "${icecc_dir}/" fi && + ptxd_get_path "${icecc_dir}/host"/*.tar.gz && + if tar -tf "${ptxd_reply}" | grep -q clang; then + export PTXDIST_ICECC_HOST_CLANG=1 + fi + export PTXDIST_ICECC_DIR="${icecc_dir}" && if "${PTXDIST_ICECC}" --help | grep -q ICECC_REMOTE_CPP; then @@ -94,9 +100,9 @@ ptxd_lib_setup_target_icecc() { args[${#args[@]}]="--clang" args[${#args[@]}]="${wrapper_dir}/real/${compiler_prefix}clang" fi - "${PTXDIST_ICECC_CREATE_ENV}" "${args[@]}" --gcc \ - "${wrapper_dir}/real/${compiler_prefix}gcc" "${gxx}" > \ - "${PTXDIST_TEMPDIR}/icecc.log" 2>&1 || \ + "${PTXDIST_ICECC_CREATE_ENV}" --gcc \ + "${wrapper_dir}/real/${compiler_prefix}gcc" "${gxx}" \ + "${args[@]}" > "${PTXDIST_TEMPDIR}/icecc.log" 2>&1 || \ { cat "${PTXDIST_TEMPDIR}/icecc.log" ptxd_bailout "Failed to create icecc target environment!" diff --git a/scripts/wrapper/clang++-wrapper b/scripts/wrapper/clang++-wrapper index ae5f97bb0..0aeec2510 100755 --- a/scripts/wrapper/clang++-wrapper +++ b/scripts/wrapper/clang++-wrapper @@ -11,6 +11,7 @@ cc_add_target_ld_args cc_add_fortify cc_add_pie cc_add_glibcxx +clang_check_target_icecc cxx_add_target_icecc clang wrapper_exec "$@" diff --git a/scripts/wrapper/clang-wrapper b/scripts/wrapper/clang-wrapper index bc4fde9b7..9a9ff6da6 100755 --- a/scripts/wrapper/clang-wrapper +++ b/scripts/wrapper/clang-wrapper @@ -11,6 +11,7 @@ cc_add_target_ld_args cc_add_fortify cc_add_pie cc_add_glibcxx +clang_check_target_icecc cc_add_target_icecc clang wrapper_exec "$@" diff --git a/scripts/wrapper/host-clang++-wrapper b/scripts/wrapper/host-clang++-wrapper index f45cc1c83..f8142462c 100755 --- a/scripts/wrapper/host-clang++-wrapper +++ b/scripts/wrapper/host-clang++-wrapper @@ -9,6 +9,7 @@ cc_check_args "${@}" cc_add_host_clang cc_add_host_ld_args cxx_add_host_extra +clang_check_host_icecc cxx_add_host_icecc clang wrapper_exec "$@" diff --git a/scripts/wrapper/host-clang-wrapper b/scripts/wrapper/host-clang-wrapper index 1242cc7e4..e1fa8f297 100755 --- a/scripts/wrapper/host-clang-wrapper +++ b/scripts/wrapper/host-clang-wrapper @@ -9,6 +9,7 @@ cc_check_args "${@}" cc_add_host_clang cc_add_host_ld_args cc_add_host_extra +clang_check_host_icecc cc_add_host_icecc clang wrapper_exec "$@" diff --git a/scripts/wrapper/libwrapper.sh b/scripts/wrapper/libwrapper.sh index 1eb418699..d86425ac8 100644 --- a/scripts/wrapper/libwrapper.sh +++ b/scripts/wrapper/libwrapper.sh @@ -297,9 +297,6 @@ add_icecc_args() { if [ "${1}" != clang ]; then add_late_arg "-fno-diagnostics-show-caret" add_late_arg "-gno-record-gcc-switches" - elif [ "${PTXDIST_ICECC_CLANG}" != 1 ]; then - unset PTXDIST_ICECC - return fi if [ "${PTXDIST_ICECC_REMOTE_CPP}" != 1 -o "${ICECC_REMOTE_CPP}" = "0" ]; then add_late_arg "-Wno-implicit-fallthrough" @@ -307,6 +304,18 @@ add_icecc_args() { fi } +clang_check_target_icecc() { + if [ "${PTXDIST_ICECC_CLANG}" != 1 ]; then + unset PTXDIST_ICECC + fi +} + +clang_check_host_icecc() { + if [ "${PTXDIST_ICECC_HOST_CLANG}" != 1 ]; then + unset PTXDIST_ICECC + fi +} + cc_add_target_icecc() { add_icecc_args "${@}" export ICECC_VERSION="$(echo ${PTXDIST_ICECC_DIR}/target/*.tar.gz)" -- cgit v1.2.3