kaleb@redhat.com has uploaded this change for review. ( https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/452909 Change subject: build: (lib)ganesha_nfsd as a DSO ...................................................................... build: (lib)ganesha_nfsd as a DSO Build ganesha as a DSO, i.e. libganesha_nfsd.so. While working on building with -flto (link time optimization) I discovered that libfsalvfs.so was missing vfs_is_dummy_handle(), throwing an unresolved symbol error at run-time. It's unclear why this doesn't happen with non-flto builds. Perhaps building with -flto requires stricter run-time link semantics. The ganesha.nfsd daemon consists of just nfs_main:main() and is linked with the DSO. Then all the FSALs (except FSAL_PSEUDO and FSAL_MDCACHE*) are linked with libganesha_nfsd to resolve functions in ganesha.nfsd itself. This will be required if, e.g., Fedora, decides to require default linking with '-z defs'. They tried to do it for F29 but retreated when they found that too many applications broke. In the end this may all be just an exercise in "truth and beauty." There are other use cases envisioned where ganesha is embedded as a component as part of other software components. *FSAL_PSEUDO and FSAL_MDCACHE are special; they are included in the DSO so should not need to be (and can't be) linked with the DSO. Cmake OBJECT libraries are not actual libraries like .a static or .so shared libs; they just compile the sources to .o files which are collectively referenced with cmake's $<TARGET_OBJECTS:...>. As such it is necessary to use set_target_properties(... COMPILE_FLAGS "-fPIC") everywhere. A few other things that could be done in the future are 1) link libganesha_nfsd.so with a .sym file to explicitly control which symbols are exposed or visible to the outside world. 2) build with -flto (Link Time Optimization) Annecdotes claim a 5-10% speed improvement is typical, and some applications have seen as much as 45-50% boost. Of course we have to do the experiment to see what we can really achieve. 3) don't link ganesha.nfsd with -bdynamic as it's no longer needed Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Change-Id: I7941cbd4ec68f15a3f5514046b2ee40130fb6414 --- M src/FSAL/FSAL_VFS/os/CMakeLists.txt M src/FSAL/FSAL_VFS/vfs/CMakeLists.txt 2 files changed, 2 insertions(+), 3 deletions(-) git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/09/452909/1 -- To view, visit https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/452909 To unsubscribe, or for help writing mail filters, visit https://review.gerrithub.io/settings Gerrit-Project: ffilz/nfs-ganesha Gerrit-Branch: next Gerrit-Change-Id: I7941cbd4ec68f15a3f5514046b2ee40130fb6414 Gerrit-Change-Number: 452909 Gerrit-PatchSet: 1 Gerrit-Owner: kaleb@redhat.com Gerrit-MessageType: newchange