Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid unnecessary zlib DT_NEEDED entries
31fc193 removed multiple superfluous DT_NEEDED entries, but left zlib alone. At the time, I only paid attention to libraries that were absent from `DT_NEEDED` when `-Wl,--as-needed` was passed to CPPFLAGS and zlib was not one of them (as libuutil linked to it). A `DT_NEEDED` entry on zlib from libuutil makes absolutely no sense, but I had assumed that the toolchain would be smart enough to catch all cases. That turned out to be untrue (maybe because `USER_ASM` is used?), so I missed zlib. I noticed during code review of openzfs#4385 that the author of a commit had peppered the various Makefile.am files with `$(TIRPC_LIBS)` when putting it into lib/libspl/Makefile.am would have sufficed. Upon further examination, it seems that he had copied what we do with `$(ZLIB)`. Autoconf is designed to propagate link dependencies to the binary into which the static object is incorporated and the ELF interpreter will load it for that binary without a problem. If we specify it multiple times, we end up with the situation where unless `LDFLAGS` contains `-Wl,--as-needed`, the ELF interpreter is told to load the same library multiple times, which is serves to load down ELF intialization at best and will lead to unnecessary libraries being loaded at worst. We should clean this up to provide a better example of how the code should be written to future contributors. Otherwise, they will be inclined to make the same mistake (for consistency) and we will end up loading libraries that we do not need. Signed-off-by: Richard Yao <[email protected]>
- Loading branch information