base-files: relink uclibc and libgcc libraries to remove leftovers of the statically linked initial libgcc saves a few kb and gets rid of unused not exported functions as well should also improve the reliability of mklibs

SVN-Revision: 25800
This commit is contained in:
Felix Fietkau
2011-03-01 05:40:38 +00:00
parent 15a014c13a
commit 1cc0bcfffc
2 changed files with 73 additions and 5 deletions

14
scripts/relink-lib.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
[ $# -lt 4 -o -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" ] && {
echo "Usage: $0 <cross> <reference> <pic .a> <destination>"
exit 1
}
cross="$1"; shift
ref="$1"; shift
pic="$1"; shift
dest="$1"; shift
SYMBOLS="$(${cross}nm "$ref" | grep -E '........ [TW] ' | awk '$3 {printf "-u%s ", $3}')"
set -x
${cross}gcc -nostdlib -nostartfiles -shared -Wl,--gc-sections -o "$dest" $SYMBOLS "$pic" "$@"