From 3cf6e62ae32870d16b2cfc45a37e54a6fb3a1fbe Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 23 Mar 2009 16:51:54 -0700 Subject: mklib improvements for Solaris Move flags for linking standard C/C++ libraries from configure.ac to mklib Use -norunpath flag when linking with Sun C++ compiler Convert mklib -exports list into a linker mapfile Set FINAL_LIBS correctly when -noprefix is used Signed-off-by: Alan Coopersmith --- bin/mklib | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/mklib b/bin/mklib index d7b740f8e34..a3e826abac9 100755 --- a/bin/mklib +++ b/bin/mklib @@ -394,6 +394,30 @@ case $ARCH in fi fi + # If using Sun C++ compiler, need to tell it not to add runpaths + # that are specific to the build machine + if [ ${LINK} = "CC" ] ; then + OPTS="${OPTS} -norunpath" + fi + + # Solaris linker requires explicitly listing the Standard C & C++ + # libraries in the link path when building shared objects + if [ ${LINK} = "CC" ] ; then + DEPS="${DEPS} -lCrun" + fi + DEPS="${DEPS} -lc" + + if [ $EXPORTS ] ; then + # Make the 'mapfile.scope' linker mapfile + echo "{" > mapfile.scope + echo "global:" >> mapfile.scope + sed 's/$/;/' ${EXPORTS} >> mapfile.scope + echo "local:" >> mapfile.scope + echo " *;" >> mapfile.scope + echo "};" >> mapfile.scope + OPTS="${OPTS} -Wl,-Mmapfile.scope" + fi + # Check if objects are SPARC v9 # file says: ELF 64-bit MSB relocatable SPARCV9 Version 1 set ${OBJECTS} @@ -406,17 +430,19 @@ case $ARCH in if [ "${ALTOPTS}" ] ; then OPTS=${ALTOPTS} fi + # for debug: #echo "mklib: linker is" ${LINK} ${OPTS} if [ $NOPREFIX = 1 ] ; then rm -f ${LIBNAME} ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + FINAL_LIBS="${LIBNAME}" else rm -f ${LIBNAME}.${MAJOR} ${LIBNAME} ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} -h ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} ln -s ${LIBNAME}.${MAJOR} ${LIBNAME} + FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}" fi - FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}" fi ;; -- cgit v1.2.3