From 9312bb0ad305e6f30ca469d23cbd8a6c849b2d2d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 21 Mar 2011 23:11:45 +0000 Subject: [PATCH] * testsuite/final_layout.sh: Rewrite to not use dc. --- gold/ChangeLog | 4 ++++ gold/testsuite/final_layout.sh | 35 +++++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index dacc36a6299..ca1ae8ce5a1 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,7 @@ +2011-03-21 Ian Lance Taylor + + * testsuite/final_layout.sh: Rewrite to not use dc. + 2011-03-21 Sriraman Tallam * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start. diff --git a/gold/testsuite/final_layout.sh b/gold/testsuite/final_layout.sh index 01b1f1d987b..83f9361b040 100755 --- a/gold/testsuite/final_layout.sh +++ b/gold/testsuite/final_layout.sh @@ -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" -- 2.30.2