From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Ross Lagerwall <ross.lagerwall@citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v2 2/3] livepatch-build-tools: remove usage of gawk
Date: Tue, 28 Nov 2023 10:21:51 +0100 [thread overview]
Message-ID: <20231128092152.35039-3-roger.pau@citrix.com> (raw)
In-Reply-To: <20231128092152.35039-1-roger.pau@citrix.com>
And instead use plain awk.
Since plain awk cannot do the conversion from hex to decimal, use the shell
(bash) printf to convert the (maybe) hexadecimal output of readelf.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Changes since v1:
- Use shell printf to convert.
---
livepatch-build | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/livepatch-build b/livepatch-build
index 305644037ee7..e2ccce4f7fd7 100755
--- a/livepatch-build
+++ b/livepatch-build
@@ -423,14 +423,15 @@ if [ "${SKIP}" != "build" ]; then
echo "Reading special section data"
# Using xen-syms built in the previous step by build_full().
SPECIAL_VARS=$(readelf -wi "$OUTPUT/xen-syms" |
- gawk --non-decimal-data '
+ awk '
BEGIN { a = b = e = 0 }
a == 0 && /DW_AT_name.* alt_instr/ {a = 1; next}
b == 0 && /DW_AT_name.* bug_frame/ {b = 1; next}
e == 0 && /DW_AT_name.* exception_table_entry/ {e = 1; next}
- a == 1 {printf("export ALT_STRUCT_SIZE=%d\n", $4); a = 2}
- b == 1 {printf("export BUG_STRUCT_SIZE=%d\n", $4); b = 2}
- e == 1 {printf("export EX_STRUCT_SIZE=%d\n", $4); e = 2}
+ # Use shell printf to (possibly) convert from hex to decimal
+ a == 1 {printf("export ALT_STRUCT_SIZE=`printf \"%%d\" \"%s\"`\n", $4); a = 2}
+ b == 1 {printf("export BUG_STRUCT_SIZE=`printf \"%%d\" \"%s\"`\n", $4); b = 2}
+ e == 1 {printf("export EX_STRUCT_SIZE=`printf \"%%d\" \"%s\"`\n", $4); e = 2}
a == 2 && b == 2 && e == 2 {exit}')
[[ -n $SPECIAL_VARS ]] && eval "$SPECIAL_VARS"
if [[ -z $ALT_STRUCT_SIZE ]] || [[ -z $BUG_STRUCT_SIZE ]] || [[ -z $EX_STRUCT_SIZE ]]; then
--
2.43.0
next prev parent reply other threads:[~2023-11-28 9:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 9:21 [PATCH v2 0/3] livepatch-build-tools: fixes for non GNU tools and alignment Roger Pau Monne
2023-11-28 9:21 ` [PATCH v2 1/3] livepatch-build-tools: do not use readlink -m option Roger Pau Monne
2023-11-28 9:21 ` Roger Pau Monne [this message]
2023-11-28 9:21 ` [PATCH v2 3/3] livepatch-build-tools: account for section alignment when calculating function size Roger Pau Monne
2023-12-06 14:46 ` [PATCH v2 0/3] livepatch-build-tools: fixes for non GNU tools and alignment Ross Lagerwall
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=20231128092152.35039-3-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=ross.lagerwall@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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.