git » libfiu » commit f16b8a8

libfiu: Filter the list of exported symbols

author Alberto Bertogli
2015-08-02 23:50:47 UTC
committer Alberto Bertogli
2015-08-03 00:04:36 UTC
parent d4239ee4a5f8c4a5e199fb462b25e4415a4c5d95

libfiu: Filter the list of exported symbols

The library currently exports some symbols, like hash_create, which are not
meant to be exported and can cause collisions with other libraries.

This patch introduces a list of explicitly exported symbols used by the linker
to generate the shared library accordingly.

Thanks to Tim Cuthbertson for reporting the problem and sending a patch.

libfiu/Makefile +2 -1
libfiu/symbols.map +17 -0

diff --git a/libfiu/Makefile b/libfiu/Makefile
index 7d5d7d1..901371a 100644
--- a/libfiu/Makefile
+++ b/libfiu/Makefile
@@ -66,9 +66,10 @@ libfiu.pc: build-flags libfiu.pc.in
 
 libs: libfiu.so libfiu.a
 
-libfiu.so: build-flags fiu.h $(OBJS)
+libfiu.so: build-flags symbols.map fiu.h $(OBJS)
 	$(NICE_CC) $(ALL_CFLAGS) -shared -fPIC \
 		-Wl,-soname,libfiu.so.$(LIB_SO_VER) \
+		-Wl,--version-script=symbols.map \
 		$(OBJS) -lpthread $(USE_LIBDL) -o libfiu.so.$(LIB_VER)
 	ln -fs libfiu.so.$(LIB_VER) libfiu.so
 	ln -fs libfiu.so.$(LIB_VER) libfiu.so.$(LIB_SO_VER)
diff --git a/libfiu/symbols.map b/libfiu/symbols.map
new file mode 100644
index 0000000..204acc1
--- /dev/null
+++ b/libfiu/symbols.map
@@ -0,0 +1,17 @@
+# Map of publicly exported symbols.
+{
+	global:
+		fiu_disable;
+		fiu_enable;
+		fiu_enable_external;
+		fiu_enable_random;
+		fiu_enable_stack;
+		fiu_enable_stack_by_name;
+		fiu_fail;
+		fiu_failinfo;
+		fiu_init;
+		fiu_rc_fifo;
+		fiu_rc_string;
+
+	local: *;
+};