[libcxx-commits] [PATCH] D120162: [libcxx][test] Test visibility option before using it
Jinsong Ji via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Feb 18 13:28:51 PST 2022
jsji created this revision.
jsji added reviewers: PowerPC, daltenty, Quuxplusone, ldionne, Mordante, sfertile.
Herald added a subscriber: arichardson.
jsji requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
On some platform visibility option might be unsupported. eg: AIX.
The error 'unsupported option '-fvisibility=hidden'' will prevent us
from running the intended test.
This patch propose that we set the substition according to compiler
support.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D120162
Files:
libcxx/test/libcxx/debug/extern-templates.sh.cpp
libcxx/utils/libcxx/test/features.py
Index: libcxx/utils/libcxx/test/features.py
===================================================================
--- libcxx/utils/libcxx/test/features.py
+++ libcxx/utils/libcxx/test/features.py
@@ -85,6 +85,13 @@
}
""")),
+ # Substitue the hidden visibility to empty string if unsupported.
+ Feature(name='hidden-visibility-if-support',
+ actions=lambda cfg:
+ [AddSubstitution('%{hiddenvisibility}', '-fvisibility=hidden')]
+ if hasCompileFlag(cfg, '-fvisibility=hidden') else
+ [AddSubstitution('%{hiddenvisibility}', '')]),
+
# Whether Bash can run on the executor.
# This is not always the case, for example when running on embedded systems.
#
Index: libcxx/test/libcxx/debug/extern-templates.sh.cpp
===================================================================
--- libcxx/test/libcxx/debug/extern-templates.sh.cpp
+++ libcxx/test/libcxx/debug/extern-templates.sh.cpp
@@ -21,10 +21,8 @@
// option which clang doesn't accept on Windows.)
// UNSUPPORTED: windows
-// XFAIL: LIBCXX-AIX-FIXME
-
-// RUN: %{cxx} %{flags} %{compile_flags} %s %{link_flags} -fPIC -DTU1 -D_LIBCPP_DEBUG=1 -fvisibility=hidden -shared -o %t.lib
-// RUN: cd %T && %{cxx} %{flags} %{compile_flags} %s ./%basename_t.tmp.lib %{link_flags} -DTU2 -D_LIBCPP_DEBUG=1 -fvisibility=hidden -o %t.exe
+// RUN: %{cxx} %{flags} %{compile_flags} %s %{link_flags} -fPIC -DTU1 -D_LIBCPP_DEBUG=1 %{hiddenvisibility} -shared -o %t.lib
+// RUN: cd %T && %{cxx} %{flags} %{compile_flags} %s ./%basename_t.tmp.lib %{link_flags} -DTU2 -D_LIBCPP_DEBUG=1 %{hiddenvisibility} -o %t.exe
// RUN: %{exec} %t.exe
#include <cassert>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120162.410011.patch
Type: text/x-patch
Size: 1664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220218/998d8046/attachment-0001.bin>
More information about the libcxx-commits
mailing list