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
diff --git a/libartbase/base/macros.h b/libartbase/base/macros.h
index 5f2100f..2a02d6f 100644
--- a/libartbase/base/macros.h
+++ b/libartbase/base/macros.h
@@ -110,7 +110,17 @@
#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_