summaryrefslogtreecommitdiff
path: root/extra/scripts/get-needed-libgcc-objects.sh
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2001-03-18 22:23:51 +0000
committerManuel Novoa III <mjn3@codepoet.org>2001-03-18 22:23:51 +0000
commit8b53f66ebeb76790148ffb9ea762d6ec37f50a05 (patch)
treead865cec8f835c27b84ed60941e4685a37d28178 /extra/scripts/get-needed-libgcc-objects.sh
parentf74579802391f5feaebbc87713b9daabb04fd77d (diff)
Part of the shared lib build rework.
Diffstat (limited to 'extra/scripts/get-needed-libgcc-objects.sh')
-rwxr-xr-xextra/scripts/get-needed-libgcc-objects.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/extra/scripts/get-needed-libgcc-objects.sh b/extra/scripts/get-needed-libgcc-objects.sh
index e4fa96a78..4bbbb328b 100755
--- a/extra/scripts/get-needed-libgcc-objects.sh
+++ b/extra/scripts/get-needed-libgcc-objects.sh
@@ -17,9 +17,9 @@ 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
+ld -r -o libc.ldr ../crt0.o --whole-archive ../libc.a
-if nm -s libc.ldr | grep -v " main$" | grep " U " > sym.need ; then
+if nm --undefined-only libc.ldr | grep -v "^main$" > sym.need ; then
rm -f obj.need
touch obj.need
for SYM in `cat sym.need | sed -e 's/ U //g'` ; do
@@ -37,7 +37,7 @@ fi
rm -rf tmp-gcc
mkdir tmp-gcc
(cd tmp-gcc ; ar -x $LIBGCC)
-rm libgcc.ldr
+rm -f libgcc.ldr
echo Extracting referenced libgcc.a objects ...
@@ -46,7 +46,7 @@ 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
+ if nm --undefined-only libgcc.ldr > 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
@@ -58,8 +58,13 @@ 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 obj.need.0 ] ; then
+ echo Objects added from $LIBGCC:
+ cat obj.need.0
+ (cd tmp-gcc ; cat ../obj.need | xargs ar r ../libgcc-need.a)
+else
+ echo No objects added from $LIBGCC.
+fi
if [ -s sym.need ] ; then
echo Symbols missing from libgcc.a: