summaryrefslogtreecommitdiff
path: root/lib/spack/env/cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/env/cc')
-rwxr-xr-xlib/spack/env/cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index eee39e7f35..a647602cad 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -434,8 +434,6 @@ wl_expect_rpath=no
xlinker_expect_rpath=no
parse_Wl() {
- # drop -Wl
- shift
while [ $# -ne 0 ]; do
if [ "$wl_expect_rpath" = yes ]; then
if system_dir "$1"; then
@@ -448,7 +446,9 @@ parse_Wl() {
case "$1" in
-rpath=*)
arg="${1#-rpath=}"
- if system_dir "$arg"; then
+ if [ -z "$arg" ]; then
+ shift; continue
+ elif system_dir "$arg"; then
append system_rpath_dirs_list "$arg"
else
append rpath_dirs_list "$arg"
@@ -456,7 +456,9 @@ parse_Wl() {
;;
--rpath=*)
arg="${1#--rpath=}"
- if system_dir "$arg"; then
+ if [ -z "$arg" ]; then
+ shift; continue
+ elif system_dir "$arg"; then
append system_rpath_dirs_list "$arg"
else
append rpath_dirs_list "$arg"
@@ -467,6 +469,11 @@ parse_Wl() {
;;
"$dtags_to_strip")
;;
+ -Wl)
+ # Nested -Wl,-Wl means we're in NAG compiler territory, we don't support
+ # it.
+ return 1
+ ;;
*)
append other_args_list "-Wl,$1"
;;
@@ -576,7 +583,9 @@ while [ $# -ne 0 ]; do
;;
-Wl,*)
IFS=,
- parse_Wl $1
+ if ! parse_Wl ${1#-Wl,}; then
+ append other_args_list "$1"
+ fi
unset IFS
;;
-Xlinker)