]> git.notmuchmail.org Git - notmuch/commit
build: switch to hiding libnotmuch symbols by default
authorJani Nikula <jani@nikula.org>
Wed, 10 May 2017 19:42:11 +0000 (22:42 +0300)
committerDavid Bremner <david@tethera.net>
Fri, 12 May 2017 10:17:18 +0000 (07:17 -0300)
commitbc11759dd1fd198661657b741bc0143c9af309a4
tree9d6d31715d1b9f07c31fd62a2ab804c1e9fe11ec
parent544b8ec90e54e3921beb26823e255fed6707bc12
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.
.gitignore
lib/Makefile.local
lib/database-private.h
lib/gen-version-script.sh [deleted file]
lib/notmuch-private.h
lib/notmuch.h
lib/notmuch.sym [new file with mode: 0644]
test/T360-symbol-hiding.sh