summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-03-23 16:51:54 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-03-25 11:07:30 -0700
commit3cf6e62ae32870d16b2cfc45a37e54a6fb3a1fbe (patch)
tree3c19b3219d8d2640beadd3a6bf3c7cf5c41620b7 /bin
parentc10df26a31b6af5a720fbfd06411d580cd38a2c8 (diff)
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 <alan.coopersmith@sun.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mklib28
1 files changed, 27 insertions, 1 deletions
diff --git a/bin/mklib b/bin/mklib
index d7b740f8e3..a3e826abac 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
;;