Skip to content

Commit

Permalink
Merge pull request #693 from ucb-bar/smartelf2hex-memsiz
Browse files Browse the repository at this point in the history
Update smartelf2hex to use MemSiz instead of FileSiz
  • Loading branch information
jerryz123 authored Oct 19, 2020
2 parents 46ea900 + d958b8e commit 11fdf69
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/smartelf2hex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ binary=$1
segments=`readelf --segments --wide $binary`
entry_hex=`echo -e "$segments" | grep "Entry point" | cut -f3 -d' ' | sed 's/0x//' | tr [:lower:] [:upper:]`
entry_dec=`bc <<< "ibase=16;$entry_hex"`
length_hex=`echo "$segments" | grep "LOAD\|TLS" | tail -n 1 | tr -s [:space:] | cut -f4,6 -d' '`
length_hex=`echo "$segments" | grep "LOAD\|TLS" | tail -n 1 | tr -s [:space:] | cut -f4,7 -d' '`
length_dec=`echo $length_hex | tr -d x | tr [:lower:] [:upper:] | tr ' ' + | sed 's/^/ibase=16;/' | sed "s/$/-$entry_hex/" | bc`
power_2_length=`echo "x=l($length_dec)/l(2); scale=0; 2^((x+1)/1)" | bc -l`
width=64
Expand Down

0 comments on commit 11fdf69

Please sign in to comment.