From e838847498b9667bc83c5ab63275abf8536ba5bd Mon Sep 17 00:00:00 2001 From: Roger Pau Monne Date: Tue, 28 Nov 2023 10:21:51 +0100 Subject: [PATCH] livepatch-build-tools: remove usage of gawk MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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é Reviewed-by: Ross Lagerwall --- livepatch-build | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/livepatch-build b/livepatch-build index 3056440..e2ccce4 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.39.5