krb5 commit: Block library unloading on HP-UX

ghudson at mit.edu ghudson at mit.edu
Fri Sep 26 16:57:42 EDT 2025


https://github.com/krb5/krb5/commit/340253cac7cbb249d8d859eae0ea0c44fd62025a
commit 340253cac7cbb249d8d859eae0ea0c44fd62025a
Author: Michael Osipov <michael.osipov at innomotics.com>
Date:   Thu Sep 18 22:04:28 2025 +0200

    Block library unloading on HP-UX

 src/config/lib.in         |  6 ------
 src/config/libnover.in    |  6 ------
 src/config/shlib.conf     | 12 ++++--------
 src/include/k5-platform.h | 26 --------------------------
 4 files changed, 4 insertions(+), 46 deletions(-)

diff --git a/src/config/lib.in b/src/config/lib.in
index 774e120a0..25215eb05 100644
--- a/src/config/lib.in
+++ b/src/config/lib.in
@@ -75,12 +75,6 @@ osf1.exports: $(SHLIB_EXPORT_FILE) Makefile
 hpux.exports: $(SHLIB_EXPORT_FILE) Makefile
 	$(RM) hpux.tmp hpux.exports
 	sed "s/^/+e /" < $(SHLIB_EXPORT_FILE) > hpux.tmp
-	a=""; \
-	for f in . $(LIBFINIFUNC); do \
-	  if test "$$f" != .; then \
-	    a="+I $${f}__auxfini $$a"; \
-	  else :; fi; \
-	done; echo "$$a" >> hpux.tmp
 	echo "+e errno" >> hpux.tmp
 	base=`echo "$(LIBBASE)" | sed -e 's/-/_/'`; \
 	echo "+e _GLOBAL__FD_lib$${base}_$(LIBMAJOR)_$(LIBMINOR)" >> hpux.tmp; \
diff --git a/src/config/libnover.in b/src/config/libnover.in
index ab6baea82..bbac0cd17 100644
--- a/src/config/libnover.in
+++ b/src/config/libnover.in
@@ -64,12 +64,6 @@ osf1.exports: $(SHLIB_EXPORT_FILE) Makefile
 hpux.exports: $(SHLIB_EXPORT_FILE) Makefile
 	$(RM) hpux.tmp hpux.exports
 	sed "s/^/+e /" < $(SHLIB_EXPORT_FILE) > hpux.tmp
-	a=""; \
-	for f in . $(LIBFINIFUNC); do \
-	  if test "$$f" != .; then \
-	    a="+I $${f}__auxfini $$a"; \
-	  else :; fi; \
-	done; echo "$$a" >> hpux.tmp
 	echo "+e errno" >> hpux.tmp
 	mv -f hpux.tmp hpux.exports
 
diff --git a/src/config/shlib.conf b/src/config/shlib.conf
index f838c2536..d14ededab 100644
--- a/src/config/shlib.conf
+++ b/src/config/shlib.conf
@@ -93,12 +93,12 @@ case $krb5_cv_host in
 		PICFLAGS=-fPIC
 		SHLIB_RPATH_FLAGS='-Wl,+b,$(SHLIB_RDIRS)'
 		SHLIB_EXPFLAGS='-Wl,+s $(SHLIB_RPATH_FLAGS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
-		LDCOMBINE='gcc -fPIC -shared -Wl,+h,$(LIBPREFIX)$(LIBBASE)$(SHLIBSEXT) -Wl,-c,hpux.exports'
+		LDCOMBINE='gcc -fPIC -shared -Wl,+h,$(LIBPREFIX)$(LIBBASE)$(SHLIBSEXT) -Wl,-c,hpux.exports -Wl,-B,nodelete'
 	else
 		PICFLAGS=+z
 		SHLIB_RPATH_FLAGS='+b $(SHLIB_RDIRS)'
 		SHLIB_EXPFLAGS='$(SHLIB_RPATH_FLAGS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
-		LDCOMBINE='ld -b +h $(LIBPREFIX)$(LIBBASE)$(SHLIBSEXT) -c hpux.exports'
+		LDCOMBINE='ld -b +h $(LIBPREFIX)$(LIBBASE)$(SHLIBSEXT) -c hpux.exports -B nodelete'
 	fi
 	MAKE_SHLIB_COMMAND="${LDCOMBINE} -o \$@ \$\$objlist \$(LDFLAGS) \$(SHLIB_EXPFLAGS) ${LDCOMBINE_TAIL}"
 	PROG_RPATH_FLAGS='$(RPATH_FLAG)$(PROG_RPATH)'
@@ -112,12 +112,8 @@ case $krb5_cv_host in
 	# Do *not* set use_linker_init_option=yes here, because in the
 	# case where the library is specified at program link time, the
 	# initialization function appears not to get called, only for
-	# shl_load.  But for finalization functions, the shl_load case
-	# is the one we care about.
-	#
-	# Not setting use_linker_init_option here should cause compilation
-	# failures if the user tries to disable delayed initialization.
-	use_linker_fini_option=yes
+	# shl_load.
+	lib_unload_prevented=yes
 	;;
 
 mips-*-netbsd*)
diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h
index 0a19b3668..18119f891 100644
--- a/src/include/k5-platform.h
+++ b/src/include/k5-platform.h
@@ -376,35 +376,9 @@ typedef struct { int error; unsigned char did_run; } k5_init_t;
    matter what compiler we're using.  Do it the same way
    regardless.  */
 
-# ifdef __hpux
-
-     /* On HP-UX, we need this auxiliary function.  At dynamic load or
-        unload time (but *not* program startup and termination for
-        link-time specified libraries), the linker-indicated function
-        is called with a handle on the library and a flag indicating
-        whether it's being loaded or unloaded.
-
-        The "real" fini function doesn't need to be exported, so
-        declare it static.
-
-        As usual, the final declaration is just for syntactic
-        convenience, so the top-level invocation of this macro can be
-        followed by a semicolon.  */
-
-#  include <dl.h>
-#  define MAKE_FINI_FUNCTION(NAME)                                          \
-        static void NAME(void);                                             \
-        void JOIN__2(NAME, auxfini)(shl_t, int); /* silence gcc warnings */ \
-        void JOIN__2(NAME, auxfini)(shl_t h, int l) { if (!l) NAME(); }     \
-        static void NAME(void)
-
-# else /* not hpux */
-
 #  define MAKE_FINI_FUNCTION(NAME)      \
         void NAME(void)
 
-# endif
-
 #elif !defined(SHARED) || defined(LIB_UNLOAD_PREVENTED)
 
 /*


More information about the cvs-krb5 mailing list