From a8a3c79930e4720ae57d1b598d3ad19e4de635af Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 23 Apr 2004 00:43:15 +0000 Subject: [PATCH] Use more flexible command substitution for shared library generation, so we can dump makeshlib.sh. Use the new saved export list files for AIX. * aclocal.m4 (KRB5_BUILD_LIBRARY_WITH_DEPS): Substitute MAKE_SHLIB_COMMAND, not LDCOMBINE and LDCOMBINE_TAIL. * pre.in (DO_MAKE_SHLIB, SHLIB_STATIC_TARGET, LDCOMBINE, LDCOMBINE_TAIL): Delete unused variables. (SHLIB_EXPORT_FILE, SHLIB_EXPORT_FILE_DEP, MAKE_SHLIB_COMMAND): New variables. * config/lib.in (lib$(LIB)$(SHLIBVEXT)): Set objlist to the list of object files before invoking MAKE_SHLIB_COMMAND, instead of wrapping the list with LDCOMBINE and LDCOMBINE_TAIL. Depend on SHLIB_EXPORT_FILE_DEP. * config/shlib.conf: Set MAKE_SHLIB_COMMAND, using LDCOMBINE and LDCOMBINE_TAIL in the common case. (case *-*-aix*): Specify new commands, taken from makeshlib.sh, but assume the export list is provided externally. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16263 dc483132-0cff-0310-8789-dd5450dbe970 --- src/ChangeLog | 5 +++++ src/aclocal.m4 | 3 +-- src/config/ChangeLog | 15 +++++++++++++++ src/config/lib.in | 10 +++++----- src/config/pre.in | 18 ++++++++++++------ src/config/shlib.conf | 14 +++++++++++++- 6 files changed, 51 insertions(+), 14 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index fd4ebf844..4851b0250 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-04-22 Ken Raeburn + + * aclocal.m4 (KRB5_BUILD_LIBRARY_WITH_DEPS): Substitute + MAKE_SHLIB_COMMAND, not LDCOMBINE and LDCOMBINE_TAIL. + 2004-03-23 Ken Raeburn * aclocal.m4 (KRB5_AC_MAINTAINER_MODE, KRB5_AC_ENABLE_THREADS, diff --git a/src/aclocal.m4 b/src/aclocal.m4 index 427a65491..e163dc29d 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -1044,8 +1044,7 @@ AC_REQUIRE([AC_PROG_INSTALL])dnl AC_CHECK_PROG(AR, ar, ar, false) AC_SUBST(LIBLIST) AC_SUBST(LIBLINKS) -AC_SUBST(LDCOMBINE) -AC_SUBST(LDCOMBINE_TAIL) +AC_SUBST(MAKE_SHLIB_COMMAND) AC_SUBST(SHLIB_EXPFLAGS) AC_SUBST(INSTALL_SHLIB) AC_SUBST(STLIBEXT) diff --git a/src/config/ChangeLog b/src/config/ChangeLog index 87c5a5ef5..2328beb8e 100644 --- a/src/config/ChangeLog +++ b/src/config/ChangeLog @@ -1,3 +1,18 @@ +2004-04-22 Ken Raeburn + + * pre.in (DO_MAKE_SHLIB, SHLIB_STATIC_TARGET, LDCOMBINE, + LDCOMBINE_TAIL): Delete unused variables. + (SHLIB_EXPORT_FILE, SHLIB_EXPORT_FILE_DEP, MAKE_SHLIB_COMMAND): + New variables. + * lib.in (lib$(LIB)$(SHLIBVEXT)): Depend on + SHLIB_EXPORT_FILE_DEP. Set objlist to the list of object files + before invoking MAKE_SHLIB_COMMAND, instead of wrapping the list + with LDCOMBINE and LDCOMBINE_TAIL. + * shlib.conf: Set MAKE_SHLIB_COMMAND, using LDCOMBINE and + LDCOMBINE_TAIL in the common case. + (case *-*-aix*): Specify new commands, taken from makeshlib.sh, + but assume the export list is provided externally. + 2004-03-23 Ken Raeburn * shlib.conf (default_static, default_shared): New variables to diff --git a/src/config/lib.in b/src/config/lib.in index 95d938fd2..30c0f499d 100644 --- a/src/config/lib.in +++ b/src/config/lib.in @@ -39,16 +39,16 @@ lib$(LIB)$(STLIBEXT): $(STOBJLISTS) $$d/OBJS.ST; done` $(RANLIB) $@ -lib$(LIB)$(SHLIBVEXT): $(SHOBJLISTS) $(SHLIB_EXPDEPS) +lib$(LIB)$(SHLIBVEXT): $(SHOBJLISTS) $(SHLIB_EXPDEPS) $(SHLIB_EXPORT_FILE_DEP) $(RM) $@ @echo "building shared $(LIB) library ($(LIBMAJOR).$(LIBMINOR))" @dirs=`echo $(SHOBJLISTS) | \ sed -e 's%/OBJS.SH%%g' -e 's%OBJS.SH%.%'`; \ - $(LDCOMBINE) -o $@ `for d in $$dirs; do \ + objlist=`for d in $$dirs; do \ sed -e '/^$$/d' -e "s%^%$$d/%" -e "s% % $$d/%g" \ - $$d/OBJS.SH; done` \ - $(SHLIB_EXPFLAGS) \ - $(LDCOMBINE_TAIL) + $$d/OBJS.SH; done` ; \ + set -x ; $(MAKE_SHLIB_COMMAND) + lib$(LIB)$(SHLIBSEXT): lib$(LIB)$(SHLIBVEXT) $(RM) $@ $(LN_S) lib$(LIB)$(SHLIBVEXT) $@ diff --git a/src/config/pre.in b/src/config/pre.in index 63cf8c576..c0d002c1b 100644 --- a/src/config/pre.in +++ b/src/config/pre.in @@ -258,8 +258,6 @@ HOST_TYPE = @HOST_TYPE@ SHEXT = @SHEXT@ STEXT=@STEXT@ VEXT=@VEXT@ -DO_MAKE_SHLIB = @DO_MAKE_SHLIB@ -SHLIB_STATIC_TARGET=@SHLIB_STATIC_TARGET@ TOPLIBD = $(BUILDTOP)/lib @@ -482,11 +480,19 @@ SHLIBEXT=@SHLIBEXT@ # usually _p.a PFLIBEXT=@PFLIBEXT@ -# "cc -G", "ld -Bshareable", etc. -LDCOMBINE=@LDCOMBINE@ +# File with symbol names to be exported, both functions and data, +# currently not distinguished. +SHLIB_EXPORT_FILE=$(srcdir)/lib$(LIB).exports + +# File that needs to be current for building the shared library, +# usually SHLIB_EXPORT_FILE, but not always, if we have to convert +# it to another, intermediate form for the linker. +SHLIB_EXPORT_FILE_DEP=$(SHLIB_EXPORT_FILE) -# Misc args to tack on the tail of LDCOMBINE -LDCOMBINE_TAIL=@LDCOMBINE_TAIL@ +# Command to run to build a shared library. +# In systems that require multiple commands, like AIX, it may need +# to change to rearrange where the various parameters fit in. +MAKE_SHLIB_COMMAND=@MAKE_SHLIB_COMMAND@ # flags for explicit libraries depending on this one, # e.g. "-R$(SHLIB_RPATH) $(SHLIB_SHLIB_DIRFLAGS) $(SHLIB_EXPLIBS)" diff --git a/src/config/shlib.conf b/src/config/shlib.conf index e3d853662..64ac7c1b5 100644 --- a/src/config/shlib.conf +++ b/src/config/shlib.conf @@ -16,6 +16,11 @@ SHOBJEXT=.so PFOBJEXT=.po # Default for systems w/o shared libraries CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(CFLAGS) $(LDFLAGS)' +# This will do for most platforms, and we'll substitute for +# LDCOMBINE, SHLIB_EXPFLAGS, and LDCOMBINE_TAIL below. +# ** Perhaps we should drop LDCOMBINE* as separate substitutions? +#MAKE_SHLIB_COMMAND='$(LDCOMBINE) -o $@ $$objlist $(SHLIB_EXPFLAGS) $(LDCOMBINE_TAIL)' +MAKE_SHLIB_COMMAND=x # Default to static or shared libraries? default_static=no @@ -289,6 +294,7 @@ mips-*-netbsd*) # Linux ld doesn't default to stuffing the SONAME field... # Use objdump -x to examine the fields of the library LDCOMBINE='$(CC) -shared -fPIC -Wl,-h,lib$(LIB)$(SHLIBSEXT)' + # -Wl,--retain-symbols-file,$(SHLIB_EXPORT_FILE) LDCOMBINE_TAIL='' # For cases where we do have dependencies on other libraries # built in this tree... @@ -316,14 +322,16 @@ mips-*-netbsd*) SHLIBEXT=.a # AIX doesn't need separate PIC objects SHOBJEXT=.o - LDCOMBINE='$(BUILDTOP)/util/makeshlib $(LIBMAJOR).$(LIBMINOR)' SHLIB_EXPFLAGS=' $(SHLIB_DIRS) $(SHLIB_EXPLIBS)' PROFFLAGS=-pg if test "$krb5_cv_prog_gcc" = "yes" ; then RPATH_FLAG='-Wl,-blibpath:' + LDCOMBINE='$(CC) -shared -v -o shr.o.$(LIBMAJOR).$(LIBMINOR) $$objlist -nostartfiles -Xlinker -bgcbypass:1 -Xlinker -bfilelist -Xlinker -bM:SRE -Xlinker -bE:$(SHLIB_EXPORT_FILE) -Xlinker -berok $(SHLIB_EXPFLAGS) -lc' else RPATH_FLAG=-blibpath: + LDCOMBINE='/bin/ld -o shr.o.$(LIBMAJOR).$(LIBMINOR) $$objlist -H512 -T512 -bnoentry -bgcbypass:1 -bnodelcsect -bfilelist -bM:SRE -bE:$(SHLIB_EXPORT_FILE) -berok $(SHLIB_EXPFLAGS) -lc' fi + MAKE_SHLIB_COMMAND="${LDCOMBINE}"' && ar cq $@ shr.o.$(LIBMAJOR).$(LIBMINOR) && chmod +x $@ && rm -f shr.o.$(LIBMAJOR).$(LIBMINOR)' RPATH_TAIL=:/usr/lib:/lib CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH):'"$RPATH_TAIL"' $(CFLAGS) $(LDFLAGS)' CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(CFLAGS) $(LDFLAGS)' @@ -331,3 +339,7 @@ mips-*-netbsd*) RUN_ENV='LIBPATH=`echo $(PROG_LIBPATH) | sed -e "s/-L//g" -e "s/ /:/g"`:$(PROG_RPATH):/usr/lib:/usr/local/lib; export LIBPATH; ' esac + +if test "${MAKE_SHLIB_COMMAND}" = "x" ; then + MAKE_SHLIB_COMMAND="${LDCOMBINE} -o \$@ \$\$objlist \$(SHLIB_EXPFLAGS) ${LDCOMBINE_TAIL}" +fi -- 2.26.2