[libcxx-commits] [PATCH] D147638: [libcxxabi] [test] Fix the mingw test config

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 5 10:02:17 PDT 2023


mstorsjo created this revision.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: libc++abi.
Herald added a reviewer: libc++abi.

Don't link libc++abi separately in addition to the main -lc++; in
mingw build configs, libc++abi is always bundled into libc++
(via LIBCXX_ENABLE_STATIC_ABI_LIBRARY).

In the case of a shared linked libc++, linking a separate static
libc++abi leads to linker errors.

Define _LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS while building tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147638

Files:
  libcxxabi/test/configs/llvm-libc++abi-mingw.cfg.in


Index: libcxxabi/test/configs/llvm-libc++abi-mingw.cfg.in
===================================================================
--- libcxxabi/test/configs/llvm-libc++abi-mingw.cfg.in
+++ libcxxabi/test/configs/llvm-libc++abi-mingw.cfg.in
@@ -3,12 +3,17 @@
 
 lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
 
+# Define _LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS; when tests include
+# libcxxabi sources (some tests do #include "../src/<file>") we can't
+# have the visibility attributes expand to dllimport as they would by
+# default. Also, when linking statically we must refer to functions
+# without dllimport.
 config.substitutions.append(('%{flags}', ''))
 config.substitutions.append(('%{compile_flags}',
-    '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS'
+    '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS'
 ))
 config.substitutions.append(('%{link_flags}',
-    '-nostdlib++ -L %{lib} -lc++ -lc++abi'
+    '-nostdlib++ -L %{lib} -lc++'
 ))
 config.substitutions.append(('%{exec}',
     '%{executor} --execdir %T --env PATH=%{lib} -- '


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147638.511143.patch
Type: text/x-patch
Size: 1408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230405/82ccd339/attachment.bin>


More information about the libcxx-commits mailing list