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")
fi
;;
-Xlinker,*)
arg="${1#-Xlinker,}"
if [ -z "$arg" ]; then shift; arg="$1"; fi
-Xlinker)
shift; arg="$1";
if [[ $arg = -rpath=* ]]; then
rpaths+=("${arg#-rpath=}")
elif [[ $arg = -rpath ]]; then
shift; arg="$1"
if [[ $arg != -Xlinker,* ]]; then
die "-Xlinker,-rpath was not followed by -Xlinker,*"
if [[ $arg != -Xlinker ]]; then
die "-Xlinker -rpath was not followed by -Xlinker <arg>"
fi
rpaths+=("${arg#-Xlinker,}")
shift; arg="$1"
rpaths+=("$arg")
else
other_args+=("-Xlinker,$arg")
other_args+=("-Xlinker")
other_args+=("$arg")
fi
;;
*)

View file

@ -43,7 +43,7 @@
'-llib1', '-llib2',
'arg4',
'-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',
'arg5', 'arg6']