summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-08-18 13:06:36 +0200
committerMark Wielaard <mark@klomp.org>2017-08-18 22:32:44 +0200
commit1127470a3ebf507981af5d2864bfe57ee67e868a (patch)
treeddc7c4eb260bdb5cc677d7af958618f5a779d0ae /lib
parent07737584e73714eff3481fcf17f9f0331c8a5b88 (diff)
Check if gcc complains about __attribute__ (visibility(..))
If so, define attribute_hidden to be empty. Also, use attribute_hidden in all places where we hide symbols. If this attribute is missing, it simply means that we cannot hide private symbols in the binary using attributes. This disables some optimizations and may increase the risk of symbol name clashes with other libraries, but is not fatal. However, we still employ linker version scripts to explicitly define the exported symbols. This serves much of the same purpose. Also, as all our symbols are prefixed with the library name, and "__" for private ones, the chance of clashes is low anyway. Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog5
-rw-r--r--lib/eu-config.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 67ef2792..23c0f41b 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,10 @@
2017-04-27 Ulf Hermann <ulf.hermann@qt.io>
+ * eu-config.h: Define attribute_hidden to be empty if the compiler
+ doesn't support it.
+
+2017-04-27 Ulf Hermann <ulf.hermann@qt.io>
+
* Makefile.am: Use fpic_CFLAGS.
2017-07-18 Mark Wielaard <mark@klomp.org>
diff --git a/lib/eu-config.h b/lib/eu-config.h
index 400cdc6e..07098282 100644
--- a/lib/eu-config.h
+++ b/lib/eu-config.h
@@ -68,8 +68,12 @@
#define internal_strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
+#ifdef HAVE_VISIBILITY
#define attribute_hidden \
__attribute__ ((visibility ("hidden")))
+#else
+#define attribute_hidden /* empty */
+#endif
/* Define ALLOW_UNALIGNED if the architecture allows operations on
unaligned memory locations. */