Use a GNU ld version script to hide all symbols
authorMatt Mullins <mmullins@mmlx.us>
Mon, 26 May 2014 01:24:50 +0000 (18:24 -0700)
committerMatt Mullins <mmullins@mmlx.us>
Mon, 26 May 2014 02:21:10 +0000 (19:21 -0700)
Without this, running clang (or anything else that uses LLVM) will crash
because we might LD_PRELOAD the wrong symbol versions into its binary.

We don't need to export any symbols at all, since everything is done via the
.init section.  This library just needs to be mapped in memory somewhere so our
function pointers don't disappear.

Makefile.am
version [new file with mode: 0644]

index a050475..4c319b5 100644 (file)
@@ -2,5 +2,5 @@ ACLOCAL_AMFLAGS = -Im4
 lib_LTLIBRARIES = libfuckit.la
 
 libfuckit_la_CXXFLAGS = @LLVM_CFLAGS@ $(AM_CFLAGS)
-libfuckit_la_LDFLAGS = $(shell @LLVM_CONFIG@ --ldflags) @LLVM_LIBS@
+libfuckit_la_LDFLAGS = $(shell @LLVM_CONFIG@ --ldflags) @LLVM_LIBS@ -Wl,--version-script=@srcdir@/version
 libfuckit_la_SOURCES = fuckit.cpp
diff --git a/version b/version
new file mode 100644 (file)
index 0000000..7c1db4c
--- /dev/null
+++ b/version
@@ -0,0 +1,3 @@
+VERSION_0.1 {
+       local: *;
+};