diff options
Diffstat (limited to 'lib/spack/env/cc')
-rwxr-xr-x | lib/spack/env/cc | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc index 8246539a00..2d6fe9998a 100755 --- a/lib/spack/env/cc +++ b/lib/spack/env/cc @@ -33,6 +33,9 @@ parameters=( SPACK_F77_RPATH_ARG SPACK_FC_RPATH_ARG SPACK_TARGET_ARGS + SPACK_DTAGS_TO_ADD + SPACK_DTAGS_TO_STRIP + SPACK_LINKER_ARG SPACK_SHORT_SPEC SPACK_SYSTEM_DIRS ) @@ -167,6 +170,25 @@ if [[ -z $mode ]]; then done fi +# This is needed to ensure we set RPATH instead of RUNPATH +# (or the opposite, depending on the configuration in config.yaml) +# +# Documentation on this mechanism is lacking at best. A few sources +# of information are (note that some of them take explicitly the +# opposite stance that Spack does): +# +# http://blog.qt.io/blog/2011/10/28/rpath-and-runpath/ +# https://wiki.debian.org/RpathIssue +# +# The only discussion I could find on enabling new dynamic tags by +# default on ld is the following: +# +# https://sourceware.org/ml/binutils/2013-01/msg00307.html +# +dtags_to_add="${SPACK_DTAGS_TO_ADD}" +dtags_to_strip="${SPACK_DTAGS_TO_STRIP}" +linker_arg="${SPACK_LINKER_ARG}" + # Set up rpath variable according to language. eval rpath=\$SPACK_${comp}_RPATH_ARG @@ -293,6 +315,8 @@ while [ -n "$1" ]; do die "-Wl,-rpath was not followed by -Wl,*" fi rp="${arg#-Wl,}" + elif [[ "$arg" = "$dtags_to_strip" ]] ; then + : # We want to remove explicitly this flag else other_args+=("-Wl,$arg") fi @@ -319,12 +343,18 @@ while [ -n "$1" ]; do fi shift 3; rp="$1" + elif [[ "$2" = "$dtags_to_strip" ]] ; then + shift # We want to remove explicitly this flag else other_args+=("$1") fi ;; *) - other_args+=("$1") + if [[ "$1" = "$dtags_to_strip" ]] ; then + : # We want to remove explicitly this flag + else + other_args+=("$1") + fi ;; esac @@ -462,10 +492,12 @@ for dir in "${system_libdirs[@]}"; do args+=("-L$dir"); done # RPATHs arguments case "$mode" in ccld) + if [ ! -z "$dtags_to_add" ] ; then args+=("$linker_arg$dtags_to_add") ; fi for dir in "${rpaths[@]}"; do args+=("$rpath$dir"); done for dir in "${system_rpaths[@]}"; do args+=("$rpath$dir"); done ;; ld) + if [ ! -z "$dtags_to_add" ] ; then args+=("$dtags_to_add") ; fi for dir in "${rpaths[@]}"; do args+=("-rpath" "$dir"); done for dir in "${system_rpaths[@]}"; do args+=("-rpath" "$dir"); done ;; |