From 340253cac7cbb249d8d859eae0ea0c44fd62025a Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Thu, 18 Sep 2025 22:04:28 +0200 Subject: [PATCH] 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 774e120a0d..25215eb058 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 ab6baea828..bbac0cd17a 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 f838c2536d..d14ededab7 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 0a19b36687..18119f8918 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 -# 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) /* -- 2.47.3