diff options
author | Alan Coopersmith <[email protected]> | 2009-03-23 16:51:54 -0700 |
---|---|---|
committer | Alan Coopersmith <[email protected]> | 2009-03-25 11:07:30 -0700 |
commit | 3cf6e62ae32870d16b2cfc45a37e54a6fb3a1fbe (patch) | |
tree | 3c19b3219d8d2640beadd3a6bf3c7cf5c41620b7 /bin/mklib | |
parent | c10df26a31b6af5a720fbfd06411d580cd38a2c8 (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 <[email protected]>
Diffstat (limited to 'bin/mklib')
-rwxr-xr-x | bin/mklib | 28 |
1 files changed, 27 insertions, 1 deletions
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 ;; |