[libunwind] Fix linker flag handling in the tests.

--export-dynamic is not always available on all targets.
-funwind-tables was a duplicate in the lit.site.cfg.in.

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D90202

GitOrigin-RevId: 05598e3d3047cf028cc3e61f3268ff7d999e5f26
diff --git a/test/libunwind/test/config.py b/test/libunwind/test/config.py
index 977f9a0..9231860 100644
--- a/test/libunwind/test/config.py
+++ b/test/libunwind/test/config.py
@@ -43,6 +43,9 @@
         # Stack unwinding tests need unwinding tables and these are not
         # generated by default on all Targets.
         self.cxx.compile_flags += ['-funwind-tables']
+        # Make symbols available in the tests.
+        if 'linux' in self.config.target_triple:
+            self.cxx.link_flags += ['-Wl,--export-dynamic']
         if not self.get_lit_bool('enable_threads', True):
             self.cxx.compile_flags += ['-D_LIBUNWIND_HAS_NO_THREADS']
             self.config.available_features.add('libunwind-no-threads')
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 84dae3c..8ff770f 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -44,10 +44,6 @@
 # Allow expanding substitutions that are based on other substitutions
 config.recursiveExpansionLimit = 10
 
-# Make symbols available in the tests.
-config.test_compiler_flags += " -funwind-tables "
-config.test_linker_flags += " -Wl,--export-dynamic "
-
 # Infer the test_exec_root from the build directory.
 config.test_exec_root = os.path.join(config.libunwind_obj_root, 'test')