summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/spack/env/cc8
-rw-r--r--lib/spack/spack/test/cc.py9
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index 4d8c4644cb..bd479f05ec 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -319,11 +319,13 @@ while [ $# -ne 0 ]; do
fi
;;
-l*)
- # -loopopt=0 is passed to the linker erroneously in
- # autoconf <= 2.69. Filter it out.
+ # -loopopt=0 is generated erroneously in autoconf <= 2.69,
+ # and passed by ifx to the linker, which confuses it with a
+ # library. Filter it out.
# TODO: generalize filtering of args with an env var, so that
# TODO: we do not have to special case this here.
- if [ "$mode" = "ld" ] && [ "$1" != "${1#-loopopt}" ]; then
+ if { [ "$mode" = "ccld" ] || [ $mode = "ld" ]; } \
+ && [ "$1" != "${1#-loopopt}" ]; then
shift
continue
fi
diff --git a/lib/spack/spack/test/cc.py b/lib/spack/spack/test/cc.py
index fa61a5e9e6..20ec946835 100644
--- a/lib/spack/spack/test/cc.py
+++ b/lib/spack/spack/test/cc.py
@@ -632,7 +632,14 @@ def test_linker_strips_loopopt(wrapper_flags):
result = result.strip().split('\n')
assert '-loopopt=0' not in result
- # ensure that -loopopt=0 is present in compile mode
+ # ensure that -loopopt=0 is not present in ccld mode
result = cc(*(test_args + ["-loopopt=0"]), output=str)
result = result.strip().split('\n')
+ assert '-loopopt=0' not in result
+
+ # ensure that -loopopt=0 *is* present in cc mode
+ # The "-c" argument is needed for cc to be detected
+ # as compile only (cc) mode.
+ result = cc(*(test_args + ["-loopopt=0", "-c", "x.c"]), output=str)
+ result = result.strip().split('\n')
assert '-loopopt=0' in result