summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dmitrii Ishcheikin <ishcheikin@google.com> 2023-11-15 00:16:51 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2023-11-15 17:10:04 +0000
commit5668bf62c6029b9539297a50e61a2a91d651143f (patch)
treea92a8ce44888dcf42f90651c3dfb795b1dbb8382
parent5542aafff67bfa5e53cfe31298d3ccb519b145f5 (diff)
Enable symbol visibility attributes only for non-debug targets
This will simplify the process of finding the symbols which need to be exported and also reduce the number of exported symbols. As a trade-off, libartd.so will not receive the size benefits of hiding symbols. Bug: 260881207 Test: art/test.py -b --host -r Change-Id: I8fd391def4fc75b66c1a6dae74ff8c6076aa2d85
-rw-r--r--libartbase/base/macros.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/libartbase/base/macros.h b/libartbase/base/macros.h
index 5f2100f9e8..2a02d6f9c4 100644
--- a/libartbase/base/macros.h
+++ b/libartbase/base/macros.h
@@ -110,7 +110,17 @@ template<typename T> ART_FRIEND_TEST(test_set_name, individual_test)
#define LOCKABLE CAPABILITY("mutex")
#define SHARED_LOCKABLE SHARED_CAPABILITY("mutex")
+// Some of the libs (e.g. libarttest(d)) require more public symbols when built
+// in debug configuration.
+// Using symbol visibility only for release builds allows to reduce the list of
+// exported symbols and eliminates the need to check debug build configurations
+// when changing the exported symbols.
+#ifdef NDEBUG
#define HIDDEN __attribute__((visibility("hidden")))
#define EXPORT __attribute__((visibility("default")))
+#else
+#define HIDDEN
+#define EXPORT
+#endif
#endif // ART_LIBARTBASE_BASE_MACROS_H_