]> xenbits.xensource.com Git - livepatch-build-tools.git/commitdiff
livepatch-build-tools: remove usage of gawk
authorRoger Pau Monne <roger.pau@citrix.com>
Tue, 28 Nov 2023 09:21:51 +0000 (10:21 +0100)
committerRoss Lagerwall <ross.lagerwall@citrix.com>
Wed, 6 Dec 2023 11:32:42 +0000 (11:32 +0000)
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>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
livepatch-build

index 305644037ee786ac35a42fd8a4f50c280c78d82e..e2ccce4f7fd7a2bc90055aa7a879932e0035660f 100755 (executable)
@@ -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