Fix bug in -Xlinker argument handling

- also update test to match.
This commit is contained in:
Todd Gamblin 2016-03-07 01:08:08 -08:00
parent f2bcc6cc35
commit 547933e7e4
2 changed files with 9 additions and 8 deletions

15
lib/spack/env/cc vendored
View File

@ -199,19 +199,20 @@ while [ -n "$1" ]; do
other_args+=("-Wl,$arg") other_args+=("-Wl,$arg")
fi fi
;; ;;
-Xlinker,*) -Xlinker)
arg="${1#-Xlinker,}" shift; arg="$1";
if [ -z "$arg" ]; then shift; arg="$1"; fi
if [[ $arg = -rpath=* ]]; then if [[ $arg = -rpath=* ]]; then
rpaths+=("${arg#-rpath=}") rpaths+=("${arg#-rpath=}")
elif [[ $arg = -rpath ]]; then elif [[ $arg = -rpath ]]; then
shift; arg="$1" shift; arg="$1"
if [[ $arg != -Xlinker,* ]]; then if [[ $arg != -Xlinker ]]; then
die "-Xlinker,-rpath was not followed by -Xlinker,*" die "-Xlinker -rpath was not followed by -Xlinker <arg>"
fi fi
rpaths+=("${arg#-Xlinker,}") shift; arg="$1"
rpaths+=("$arg")
else else
other_args+=("-Xlinker,$arg") other_args+=("-Xlinker")
other_args+=("$arg")
fi fi
;; ;;
*) *)

View File

@ -43,7 +43,7 @@
'-llib1', '-llib2', '-llib1', '-llib2',
'arg4', 'arg4',
'-Wl,--end-group', '-Wl,--end-group',
'-Xlinker,-rpath', '-Xlinker,/third/rpath', '-Xlinker,-rpath', '-Xlinker,/fourth/rpath', '-Xlinker', '-rpath', '-Xlinker', '/third/rpath', '-Xlinker', '-rpath', '-Xlinker', '/fourth/rpath',
'-llib3', '-llib4', '-llib3', '-llib4',
'arg5', 'arg6'] 'arg5', 'arg6']