From: Suzuki Poulose <suzuki@in.ibm.com>
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH] Fix ld01 test
Date: Mon, 04 Jan 2010 19:45:25 +0530 [thread overview]
Message-ID: <4B41F7FD.9040904@in.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1588 bytes --]
Hi,
Please find the patch to fix the "ld" test. I wonder these tests were
ever tested before committing to the suite !
On SLES 11 SP1, I get :
plm66:/ltp-full-20091130/testcases/commands/ade/ld # make
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -fPIC
-I../../../../include -I../../../../include -c -o d1.o d1.c
mv d1.o d1.obj
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -fPIC
-I../../../../include -I../../../../include -c -o f1.o f1.c
mv f1.o f1.obj
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -fPIC
-I../../../../include -I../../../../include -c -o ldmain.o ldmain.c
mv ldmain.o ldmain.obj
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -fPIC
-I../../../../include -I../../../../include -c -o rd1.o rd1.c
mv rd1.o rd1.obj
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -fPIC
-I../../../../include -I../../../../include -c -o rf1.o rf1.c
mv rf1.o rf1.obj
plm66:/ltp-full-20091130/testcases/commands/ade/ld # ./ld01
Assertion 1 ..................
-)
Assertion 2 ..................
-)
Assertion 3 ..................
-)
Assertion 4 ..................
-)
Assertion 5 ..................
ld: /ltp-full-20091130/testcases/commands/ade/ld/f1.o: No such file: No
such file or directory
FAIL - ld failed to build a shared object
The names used for the object files are not consistent across the
Makefile and the script.
Also the method of detecting the ld version is bogus. It will not work
for *all* distros.
./ld01: line 184: [: Public: integer expression expected
-)
Please find the attached patch which fixes the issue.
Thanks
Suzuki
[-- Attachment #2: fix-ld01-script.diff --]
[-- Type: text/plain, Size: 3328 bytes --]
Signed-Off-by: Suzuki K P <suzuki@in.ibm.com>
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 <SPACE><DIGITS><DOT><DIGITS>
+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 <<EOF > $TCtmp/errmsg.exp
$TCtmp/lola: could not read symbols: Invalid operation
EOF
[-- Attachment #3: Type: text/plain, Size: 390 bytes --]
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
[-- Attachment #4: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next reply other threads:[~2010-01-04 14:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-04 14:15 Suzuki Poulose [this message]
2010-01-05 2:04 ` [LTP] [PATCH] Fix ld01 test Garrett Cooper
2010-01-07 11:06 ` Subrata Modak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B41F7FD.9040904@in.ibm.com \
--to=suzuki@in.ibm.com \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.