From: Roger Pau Monne Date: Tue, 28 Nov 2023 09:21:51 +0000 (+0100) Subject: livepatch-build-tools: remove usage of gawk X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e838847498b9667bc83c5ab63275abf8536ba5bd;p=livepatch-build-tools.git livepatch-build-tools: remove usage of gawk 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 --- 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