diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2001-01-25 21:19:46 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2001-01-25 21:19:46 +0000 |
commit | cc07f2350dc260a2a4eaf4ff05f32939c55a9893 (patch) | |
tree | b898aa05768dfd221f31c489d0d01cc2d80be868 /extra/scripts/get-needed-libgcc-objects.sh | |
parent | c4685a5c3c6cef896b3ba7ccb5b628e4489fcb34 (diff) |
Clean up atexit.c; make sure sysconf and atexit agree; link in ref'd libgcc.a
objects with shared uClibc; allow disabling long long support.
Diffstat (limited to 'extra/scripts/get-needed-libgcc-objects.sh')
-rwxr-xr-x | extra/scripts/get-needed-libgcc-objects.sh | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/extra/scripts/get-needed-libgcc-objects.sh b/extra/scripts/get-needed-libgcc-objects.sh new file mode 100755 index 000000000..e4fa96a78 --- /dev/null +++ b/extra/scripts/get-needed-libgcc-objects.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Manuel Novoa III Jan 2001 +# +# The purpose of this script is to extract the object files from libgcc.a +# that are needed by the shared uClibc so that they won't be linked with +# each application. +# +# I'm sure people with better shell programming skills can improve this. +# Feel free! ;-) At this point though, it gets the job done for me. +# +# Possible problems (paranioa mode): Are any of the objects in libgcc.a +# needed to actually load the shared library on any archs? + +LIBGCC=`$CC -print-libgcc-file-name` + +echo Finding missing symbols in libc.a ... +echo " partial linking..." +rm -f libc.ldr +ld -r -o libc.ldr ../crt0.o *.o + +if nm -s libc.ldr | grep -v " main$" | grep " U " > sym.need ; then + rm -f obj.need + touch obj.need + for SYM in `cat sym.need | sed -e 's/ U //g'` ; do + if nm -s $LIBGCC | grep -q $SYM" in " ; then + nm -s $LIBGCC | grep $SYM" in " | cut -d' ' -f3 >> obj.need + else + echo Symbol $SYM needed by libc.a but not found in libgcc.a + fi + done +else + echo No missing symbols found. + exit 0 +fi + +rm -rf tmp-gcc +mkdir tmp-gcc +(cd tmp-gcc ; ar -x $LIBGCC) +rm libgcc.ldr + +echo Extracting referenced libgcc.a objects ... + +rm -f obj.need.0 +touch obj.need.0 +while [ -s obj.need ] && ! cmp -s obj.need obj.need.0 ; do + (cd tmp-gcc ; cat ../obj.need | xargs ld -r -o ../libgcc.ldr) + cp obj.need obj.need.0 + if nm -s libgcc.ldr | grep " U " > sym.need ; then + for SYM in `cat sym.need | sed -e 's/ U //g'` ; do + if nm -s $LIBGCC | grep -q $SYM" in " ; then + nm -s $LIBGCC | grep $SYM" in " | cut -d' ' -f3 >> obj.need + fi + done + fi +done + +cat obj.need | sort | uniq > obj.need.0 +(cd tmp-gcc ; cp `cat ../obj.need` ..) + +echo Objects added from $LIBGCC: +cat obj.need.0 + +if [ -s sym.need ] ; then + echo Symbols missing from libgcc.a: + cat sym.need +else + echo Done +fi +exit 0
\ No newline at end of file |