This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Don't require dc in final_layout.sh
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Mon, 21 Mar 2011 16:12:32 -0700
- Subject: gold patch committed: Don't require dc in final_layout.sh
This gold patch changes a test script to not require the dc program to
be installed. There is still another use of dc in the testsuite,
though. Committed to mainline.
Ian
2011-03-21 Ian Lance Taylor <iant@google.com>
* testsuite/final_layout.sh: Rewrite to not use dc.
Index: testsuite/final_layout.sh
===================================================================
RCS file: /cvs/src/src/gold/testsuite/final_layout.sh,v
retrieving revision 1.2
diff -u -r1.2 final_layout.sh
--- testsuite/final_layout.sh 2 Aug 2010 07:41:04 -0000 1.2
+++ testsuite/final_layout.sh 21 Mar 2011 23:11:18 -0000
@@ -25,17 +25,34 @@
# The goal of this program is to verify if --section-ordering-file works as
# intended. File final_layout.cc is in this test.
+set -e
+
check()
{
- func_addr_1=`grep $2 $1 | awk '{print $1}' | tr 'abcdef' 'ABCDEF'`
- func_addr_1=`echo 16i${func_addr_1}p | dc`
- func_addr_2=`grep $3 $1 | awk '{print $1}' | tr 'abcdef' 'ABCDEF'`
- func_addr_2=`echo 16i${func_addr_2}p | dc`
- if [ $func_addr_1 -gt $func_addr_2 ]
- then
- echo "final layout of" $2 "and" $3 "is not right."
- exit 1
- fi
+ awk "
+BEGIN { saw1 = 0; saw2 = 0; err = 0; }
+/.*$2\$/ { saw1 = 1; }
+/.*$3\$/ {
+ saw2 = 1;
+ if (!saw1)
+ {
+ printf \"layout of $2 and $3 is not right\\n\";
+ err = 1;
+ exit 1;
+ }
+ }
+END {
+ if (!saw1 && !err)
+ {
+ printf \"did not see $2\\n\";
+ exit 1;
+ }
+ if (!saw2 && !err)
+ {
+ printf \"did not see $3\\n\";
+ exit 1;
+ }
+ }" $1
}
check final_layout.stdout "_Z3barv" "_Z3bazv"