summaryrefslogtreecommitdiff
path: root/libartbase/base/macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'libartbase/base/macros.h')
-rw-r--r--libartbase/base/macros.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/libartbase/base/macros.h b/libartbase/base/macros.h
index ee2801825a..3b8b8ff89e 100644
--- a/libartbase/base/macros.h
+++ b/libartbase/base/macros.h
@@ -117,12 +117,24 @@ template<typename T> ART_FRIEND_TEST(test_set_name, individual_test)
// when changing the exported symbols.
#ifdef NDEBUG
#define HIDDEN __attribute__((visibility("hidden")))
+#define PROTECTED __attribute__((visibility("protected")))
#define EXPORT __attribute__((visibility("default")))
#else
#define HIDDEN
+#define PROTECTED
#define EXPORT
#endif
+// Protected symbols must be declared with "protected" visibility attribute when
+// building the library and "default" visibility when referred to from external
+// libraries/binaries. Otherwise, the external code will expect the symbol to be
+// defined locally and fail to link.
+#ifdef BUILDING_LIBART
+#define LIBART_PROTECTED PROTECTED
+#else
+#define LIBART_PROTECTED EXPORT
+#endif
+
// Some global variables shouldn't be visible outside libraries declaring them.
// The attribute allows hiding them, so preventing direct access.
#define ALWAYS_HIDDEN __attribute__((visibility("hidden")))