gold patch committed: Make relro_test fail if dc is not present
Cary Coutant
ccoutant@google.com
Wed Mar 23 01:19:00 GMT 2011
More information about the Binutils mailing list
Wed Mar 23 01:19:00 GMT 2011
- Previous message (by thread): gold patch committed: Make relro_test fail if dc is not present
- Next message (by thread): gold patch committed: Make relro_test fail if dc is not present
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Not OK, I switched final_layout.sh to use dc because somebody had a
> shell which didn't support hex constants in $((...)).
Ugh. How about this? Is strtonum() supported in all versions of awk
that we care about?
-cary
Index: testsuite/relro_test.sh
===================================================================
RCS file: /cvs/src/src/gold/testsuite/relro_test.sh,v
retrieving revision 1.2
diff -u -p -r1.2 relro_test.sh
--- testsuite/relro_test.sh 22 Mar 2011 00:19:14 -0000 1.2
+++ testsuite/relro_test.sh 23 Mar 2011 01:17:05 -0000
@@ -25,18 +25,11 @@
# This test checks that the PT_GNU_RELRO segment is properly
# aligned and is coincident with the beginning of the data segment.
-
-# Cleans a hexadecimal number for input to dc.
-clean_hex()
-{
- echo "$1" | sed -e 's/0x//' -e 'y/abcdef/ABCDEF/'
-}
-
check()
{
# Get the address and length of the PT_GNU_RELRO segment.
- RELRO_START=`grep GNU_RELRO "$1" | awk '{ print $3; }'`
- RELRO_LEN=`grep GNU_RELRO "$1" | awk '{ print $6; }'`
+ RELRO_START=`grep GNU_RELRO "$1" | awk '{ print strtonum($3); }'`
+ RELRO_LEN=`grep GNU_RELRO "$1" | awk '{ print strtonum($6); }'`
if test -z "$RELRO_START"
then
@@ -46,8 +39,8 @@ check()
# Get the address and alignment of the PT_LOAD segment whose address
# matches the PT_GNU_RELRO segment.
- LOAD_ALIGN=`grep LOAD "$1" | awk -v A=$RELRO_START '$3 == A { print $NF; }'`
- LOAD_LEN=`grep LOAD "$1" | awk -v A=$RELRO_START '$3 == A { print $6; }'`
+ LOAD_ALIGN=`grep LOAD "$1" | awk -v A=$RELRO_START 'strtonum($3) ==
A { print strtonum($NF); }'`
+ LOAD_LEN=`grep LOAD "$1" | awk -v A=$RELRO_START 'strtonum($3) == A
{ print strtonum($6); }'`
if test -z "$LOAD_LEN"
then
@@ -57,15 +50,10 @@ check()
# Compute the address of the end of the PT_GNU_RELRO segment,
# modulo the alignment of the PT_LOAD segment.
- RELRO_START=`clean_hex "$RELRO_START"`
- RELRO_LEN=`clean_hex "$RELRO_LEN"`
- LOAD_ALIGN=`clean_hex "$LOAD_ALIGN"`
- RELRO_END=`echo "16o 16i $RELRO_START $RELRO_LEN + p" | dc`
- REM=`echo "16i $RELRO_END $LOAD_ALIGN % p" | dc`
-
- if test "$REM" -eq 0; then
- :
- else
+ RELRO_END=`expr $RELRO_START + $RELRO_LEN`
+ REM=`expr $RELRO_END % $LOAD_ALIGN`
+
+ if test "$REM" -ne 0; then
echo "PT_GNU_RELRO segment does not end at page boundary."
exit 1
fi
- Previous message (by thread): gold patch committed: Make relro_test fail if dc is not present
- Next message (by thread): gold patch committed: Make relro_test fail if dc is not present
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list