aboutsummaryrefslogtreecommitdiff
path: root/lib/gen-version-script.sh
diff options
context:
space:
mode:
authorJani Nikula <jani@nikula.org>2017-05-10 22:42:11 +0300
committerDavid Bremner <david@tethera.net>2017-05-12 07:17:18 -0300
commitbc11759dd1fd198661657b741bc0143c9af309a4 (patch)
tree9d6d31715d1b9f07c31fd62a2ab804c1e9fe11ec /lib/gen-version-script.sh
parent544b8ec90e54e3921beb26823e255fed6707bc12 (diff)
build: switch to hiding libnotmuch symbols by default
The dynamic generation of the linker version script for libnotmuch exports has grown rather complicated. Reverse the visibility control by hiding symbols by default using -fvisibility=hidden, and explicitly exporting symbols in notmuch.h using #pragma GCC visibility. (We could also use __attribute__ ((visibility ("default"))) for each exported function, but the pragma is more convenient.) The above is not quite enough alone, as it would "leak" a number of weak symbols from Xapian and C++ standard library. Combine it with a small static version script that filters out everything except the notmuch_* symbols that we explicitly exposed, and the C++ RTTI typeinfo symbols for exception handling. Finally, as the symbol hiding test can no longer look at the generated symbol table, switch the test to parse the functions from notmuch.h.
Diffstat (limited to 'lib/gen-version-script.sh')
-rw-r--r--lib/gen-version-script.sh28
1 files changed, 0 insertions, 28 deletions
diff --git a/lib/gen-version-script.sh b/lib/gen-version-script.sh
deleted file mode 100644
index c98a07b0..00000000
--- a/lib/gen-version-script.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-set -eu
-
-# we go through a bit of work to get the unmangled names of the
-# typeinfo symbols because of
-# https://sourceware.org/bugzilla/show_bug.cgi?id=10326
-
-if [ $# -lt 2 ]; then
- echo Usage: $0 header obj1 obj2 obj3
- exit 1;
-fi
-
-HEADER=$1
-shift
-
-printf '{\nglobal:\n'
-nm $* | awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $3 ~ "Xapian.*Error" {print $3}' | sort | uniq | \
-while read sym; do
- demangled=$(c++filt $sym)
- case $demangled in
- typeinfo*)
- printf "\t$sym;\n"
- ;;
- *)
- ;;
- esac
-done
-sed -n 's/^[[:space:]]*\(notmuch_[a-z_]*\)[[:space:]]*(.*/ \1;/p' $HEADER
-printf "local: *;\n};\n"