#!/bin/csh # # Usage: remapLibs libdir prog-name [additional-libs] # # This script runs the program 'prog-name' once with no arguments, and, # using rld.debug, extracts the list of all shared objects loaded by the # program. These share dobjects are then copied to the directory 'libdir', # where they are remapped to reside in the upper end of the address space. # Running the program again, using the remapped libraries (LD_LIBRARY_PATH), # will allow a much larget shared arena. # This script is written to run N32 programs. To run O32 programs, you # should modify the appropriate environment variables. # if $#argv == 0 then echo "Usage: remapLibs libdir prog-name [additional-libs]" exit endif echo remapLibs $argv setenv LIBDIR $1 shift setenv BIN $1 shift setenv LIBLIST /tmp/libList setenv RLDLOG /tmp/rldLog setenv _RLDN32_PATH /usr/lib32/rld.debug setenv _RLD_ARGS "-v -log $RLDLOG"; $BIN ; unsetenv _RLDN32_PATH grep mapped $RLDLOG | awk '{print $5}' | sort -u > $LIBLIST mkdir $LIBDIR echo '$start_address=0xe0000000' > ./so_loc chmod a+w ./so_loc echo "\n\n\nCopy libraries to $LIBDIR ... " foreach f (`cat $LIBLIST`) if $f != $BIN then echo "$f \c\r" /bin/cp $f $LIBDIR endif end if $#argv > 0 then foreach f ($argv) /bin/cp $f $LIBDIR end endif echo "Remap libraries - pass 1 ... " foreach i ($LIBDIR/*.so*) echo "$i \c\r" chmod a+w $i /usr/etc/rqs32 -l e0000000 -f -m $i end echo "Remap libraries - pass 2 ... " foreach i ($LIBDIR/*.so*) echo "$i \c\r" /usr/etc/rqs32 -u ./so_loc -f -m $i end # remove the temp files if you so desire /bin/rm -f $RLDLOG # /bin/rm -f $LIBLIST echo "done remapLibs "