Signed-Off-by: Suzuki K P Issues fixed: 1) Consistency with the names used for object files in Makefile vs. script 2) Better method for finding the version of "ld" --- ld01 2006-04-10 23:09:50.000000000 +0530 +++ ld01.new 2010-01-05 01:01:03.000000000 +0530 @@ -140,11 +140,11 @@ fi ## echo "Assertion 5 .................." # Check for ppc64 architecture - file f1.o | grep PowerPC | grep 64-bit >/dev/null 2>&1 + file f1.obj | grep PowerPC | grep 64-bit >/dev/null 2>&1 if [ $? -eq 0 ]; then - ld -m elf64ppc -shared $TCdat/f1.o $TCdat/d1.o -o $TCtmp/test.lib + ld -m elf64ppc -shared $TCdat/f1.obj $TCdat/d1.obj -o $TCtmp/test.lib else - ld -shared $TCdat/f1.o $TCdat/d1.o -o $TCtmp/test.lib + ld -shared $TCdat/f1.obj $TCdat/d1.obj -o $TCtmp/test.lib fi file $TCtmp/test.lib | grep -q shared if [ $? -eq 0 ] @@ -164,23 +164,29 @@ fi echo "Assertion 6 .................." # Check for ppc64 architecture - file f1.o | grep PowerPC | grep 64-bit >/dev/null 2>&1 + file f1.obj | grep PowerPC | grep 64-bit >/dev/null 2>&1 if [ $? -eq 0 ]; then - ld -m elf64ppc -Bdynamic -shared $TCdat/f1.o $TCdat/d1.o -o $TCtmp/lola 2>$TCtmp/errmsg.out - ld -m elf64ppc -Bstatic -L. $TCdat/ldmain.o $TCdat/rd1.o $TCtmp/lola -o $TCtmp/a.out 2> $TCtmp/errmsg.out + ld -m elf64ppc -Bdynamic -shared $TCdat/f1.obj $TCdat/d1.obj -o $TCtmp/lola 2>$TCtmp/errmsg.out + ld -m elf64ppc -Bstatic -L. $TCdat/ldmain.obj $TCdat/rd1.obj $TCtmp/lola -o $TCtmp/a.out 2> $TCtmp/errmsg.out else - ld -Bdynamic -shared $TCdat/f1.o $TCdat/d1.o -o $TCtmp/lola 2>$TCtmp/errmsg.out - ld -Bstatic -L. $TCdat/ldmain.o $TCdat/rd1.o $TCtmp/lola -o $TCtmp/a.out 2> $TCtmp/errmsg.out + ld -Bdynamic -shared $TCdat/f1.obj $TCdat/d1.obj -o $TCtmp/lola 2>$TCtmp/errmsg.out + + ld -Bstatic -L. $TCdat/ldmain.obj $TCdat/rd1.obj $TCtmp/lola -o $TCtmp/a.out 2> $TCtmp/errmsg.out fi #nm $TCtmp/a.out | grep -q DYNAMIC rc_code=$? - version_num=`ld --version | grep version | \ - awk -F ' ' '{ print $4 }' | cut -d '.' -f 1` - - version_num_level2=`ld --version | grep version |\ - awk -F ' ' '{ print $4 }' | cut -d '.' -f 2` - +# This method doesn't work on all distro. +# version_num=`ld --version | grep version | \ +# awk -F ' ' '{ print $4 }' | cut -d '.' -f 1` +# +# version_num_level2=`ld --version | grep version |\ +# awk -F ' ' '{ print $4 }' | cut -d '.' -f 2` +# +# Better way to get the version of ld +# Search for a pattern that starts with +version_num=`ld -v | sed "s/.*\ \([0-9]\+\)\.\([0-9]\+\).*/\1/"` +version_num_level2=`ld -v | sed "s/.*\ \([0-9]\+\)\.\([0-9]\+\).*/\2/"` if [ "$version_num" -le "2" -a "$version_num_level2" -le "15" ]; then if [ $rc_code -eq 0 ] then @@ -214,8 +220,8 @@ if [ "$version_num" -le "2" -a "$versio echo "Assertion 7 .................." -ld -Bdynamic -shared $TCdat/ldmain.o $TCdat/f1.o $TCdat/rf1.o -o $TCtmp/lola -L/usr/lib/ -ld -Bstatic -r $TCdat/ldmain.o $TCdat/f1.o $TCdat/rf1.o $TCtmp/lola -L/usr/lib/ 2> $TCtmp/errmsg.out +ld -Bdynamic -shared $TCdat/ldmain.obj $TCdat/f1.obj $TCdat/rf1.obj -o $TCtmp/lola -L/usr/lib/ +ld -Bstatic -r $TCdat/ldmain.obj $TCdat/f1.obj $TCdat/rf1.obj $TCtmp/lola -L/usr/lib/ 2> $TCtmp/errmsg.out cat < $TCtmp/errmsg.exp $TCtmp/lola: could not read symbols: Invalid operation EOF