Skip to content

Clean up use of function wrapping

Michał Kępień requested to merge 1725-clean-up-use-of-function-wrapping into v9_16

Currently, building BIND using "--without-dlopen" universally breaks building unit tests which employ the --wrap linker option (because the replacement functions are put in a shared library and building shared objects requires "--with-dlopen"). Fix by moving the overridden symbol, isc_nmhandle_unref(), to lib/ns/tests/nstest.c and dropping lib/ns/tests/wrap.c altogether. This simplifies Makefiles a lot and prevents --without-dlopen from messing with the process of building unit tests.

Remove related bits of code from which are made redundant by the above changes.

Put the replacement definition of isc_nmhandle_unref() inside an #ifdef block, so that the build does not break for non-libtool builds (see below).

These changes allow the broadest possible set of build variants to work while also simplifying the build process:

  • for libtool builds, overriding isc_nmhandle_unref() is done by placing that symbol directly in lib/ns/tests/nstest.c and relying on the dynamic linker to perform symbol resolution properly when the test binary is run,

  • for non-libtool builds, overriding isc_nmhandle_unref() is done using the --wrap linker option (the libtool approach cannot be used in this case as multiple strong symbols with the same name cannot coexist in the same binary),

  • the "--without-dlopen" option no longer affects building unit tests.

Closes #1725 (closed)

Merge request reports