summaryrefslogtreecommitdiff
path: root/lib/spack/spack/test/cc.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/test/cc.py')
-rw-r--r--lib/spack/spack/test/cc.py46
1 files changed, 45 insertions, 1 deletions
diff --git a/lib/spack/spack/test/cc.py b/lib/spack/spack/test/cc.py
index a24f2b7d4e..e3c962b9d7 100644
--- a/lib/spack/spack/test/cc.py
+++ b/lib/spack/spack/test/cc.py
@@ -103,7 +103,10 @@ def wrapper_environment():
SPACK_LINK_DIRS=None,
SPACK_INCLUDE_DIRS=None,
SPACK_RPATH_DIRS=None,
- SPACK_TARGET_ARGS=''):
+ SPACK_TARGET_ARGS='',
+ SPACK_LINKER_ARG='-Wl,',
+ SPACK_DTAGS_TO_ADD='--disable-new-dtags',
+ SPACK_DTAGS_TO_STRIP='--enable-new-dtags'):
yield
@@ -180,6 +183,7 @@ def test_ld_flags(wrapper_flags):
spack_ldflags +
test_include_paths +
test_library_paths +
+ ['--disable-new-dtags'] +
test_rpaths +
test_args_without_paths +
spack_ldlibs)
@@ -204,6 +208,7 @@ def test_cc_flags(wrapper_flags):
spack_ldflags +
test_include_paths +
test_library_paths +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
test_args_without_paths +
spack_ldlibs)
@@ -218,6 +223,7 @@ def test_cxx_flags(wrapper_flags):
spack_ldflags +
test_include_paths +
test_library_paths +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
test_args_without_paths +
spack_ldlibs)
@@ -232,6 +238,7 @@ def test_fc_flags(wrapper_flags):
spack_ldflags +
test_include_paths +
test_library_paths +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
test_args_without_paths +
spack_ldlibs)
@@ -244,6 +251,7 @@ def test_dep_rpath():
[real_cc] +
test_include_paths +
test_library_paths +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
test_args_without_paths)
@@ -257,6 +265,7 @@ def test_dep_include():
test_include_paths +
['-Ix'] +
test_library_paths +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
test_args_without_paths)
@@ -271,6 +280,7 @@ def test_dep_lib():
test_include_paths +
test_library_paths +
['-Lx'] +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
['-Wl,-rpath,x'] +
test_args_without_paths)
@@ -285,6 +295,7 @@ def test_dep_lib_no_rpath():
test_include_paths +
test_library_paths +
['-Lx'] +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
test_args_without_paths)
@@ -297,6 +308,7 @@ def test_dep_lib_no_lib():
[real_cc] +
test_include_paths +
test_library_paths +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
['-Wl,-rpath,x'] +
test_args_without_paths)
@@ -318,6 +330,7 @@ def test_ccld_deps():
['-Lxlib',
'-Lylib',
'-Lzlib'] +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
['-Wl,-rpath,xlib',
'-Wl,-rpath,ylib',
@@ -368,6 +381,7 @@ def test_ccld_with_system_dirs():
'-Lzlib'] +
['-L/usr/local/lib',
'-L/lib64/'] +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
['-Wl,-rpath,xlib',
'-Wl,-rpath,ylib',
@@ -389,6 +403,7 @@ def test_ld_deps():
['-Lxlib',
'-Lylib',
'-Lzlib'] +
+ ['--disable-new-dtags'] +
test_rpaths +
['-rpath', 'xlib',
'-rpath', 'ylib',
@@ -408,6 +423,7 @@ def test_ld_deps_no_rpath():
['-Lxlib',
'-Lylib',
'-Lzlib'] +
+ ['--disable-new-dtags'] +
test_rpaths +
test_args_without_paths)
@@ -421,6 +437,7 @@ def test_ld_deps_no_link():
['ld'] +
test_include_paths +
test_library_paths +
+ ['--disable-new-dtags'] +
test_rpaths +
['-rpath', 'xlib',
'-rpath', 'ylib',
@@ -444,6 +461,7 @@ def test_ld_deps_partial():
test_include_paths +
test_library_paths +
['-Lxlib'] +
+ ['--disable-new-dtags'] +
test_rpaths +
['-rpath', 'xlib'] +
['-r'] +
@@ -459,6 +477,7 @@ def test_ld_deps_partial():
test_include_paths +
test_library_paths +
['-Lxlib'] +
+ ['--disable-new-dtags'] +
test_rpaths +
['-r'] +
test_args_without_paths)
@@ -473,6 +492,7 @@ def test_ccache_prepend_for_cc():
[real_cc] +
test_include_paths +
test_library_paths +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
test_args_without_paths)
os.environ['SPACK_SHORT_SPEC'] = "foo@1.2=darwin-x86_64"
@@ -483,6 +503,7 @@ def test_ccache_prepend_for_cc():
lheaderpad +
test_include_paths +
test_library_paths +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
test_args_without_paths)
@@ -495,6 +516,7 @@ def test_no_ccache_prepend_for_fc():
[real_cc] +
test_include_paths +
test_library_paths +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
test_args_without_paths)
os.environ['SPACK_SHORT_SPEC'] = "foo@1.2=darwin-x86_64"
@@ -505,5 +527,27 @@ def test_no_ccache_prepend_for_fc():
lheaderpad +
test_include_paths +
test_library_paths +
+ ['-Wl,--disable-new-dtags'] +
test_wl_rpaths +
test_args_without_paths)
+
+
+@pytest.mark.regression('9160')
+def test_disable_new_dtags(wrapper_flags):
+ with set_env(SPACK_TEST_COMMAND='dump-args'):
+ result = ld(*test_args, output=str).strip().split('\n')
+ assert '--disable-new-dtags' in result
+ result = cc(*test_args, output=str).strip().split('\n')
+ assert '-Wl,--disable-new-dtags' in result
+
+
+@pytest.mark.regression('9160')
+def test_filter_enable_new_dtags(wrapper_flags):
+ with set_env(SPACK_TEST_COMMAND='dump-args'):
+ result = ld(*(test_args + ['--enable-new-dtags']), output=str)
+ result = result.strip().split('\n')
+ assert '--enable-new-dtags' not in result
+
+ result = cc(*(test_args + ['-Wl,--enable-new-dtags']), output=str)
+ result = result.strip().split('\n')
+ assert '-Wl,--enable-new-dtags' not in result