[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[XEN PATCH 1/2] xen: Fix check-endbr with mawk
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
- Date: Thu, 14 Jul 2022 15:39:06 +0100
- Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
- Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Luca Fancellu <Luca.Fancellu@xxxxxxx>, Mathieu Tarral <mathieu.tarral@xxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Thu, 14 Jul 2022 14:39:29 +0000
- Ironport-data: A9a23:gN8p9qD3SjtKExVW//Xjw5YqxClBgxIJ4kV8jS/XYbTApDoggz0Bz moXXj2EPq2La2v3Kd0jbtu09EIPvcXXx9EyQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMZiaA4E3ratANlFEkvYmQXL3wFeXYDS54QA5gWU8JhAlq3uU0meaEu/Dga++2k Y608pe31GONgWYuaDpLsv7b8nuDgdyp0N8mlg1mDRx0lAe2e0k9VPo3Oay3Jn3kdYhYdsbSq zHrlezREsvxpn/BO/v9+lrJWhRiro36ZGBivkF+Sam66iWukwRpukoN2FjwXm8M49mBt4gZJ NygLvVcQy9xVkHHsLx1vxW1j0iSlECJkVPKCSHXjCCd86HJW3S9ztlIHkQ5BIcn2MpcGCZh8 OEjCC9YO3hvh8ruqF66Yuxlh8BlJ8j3JoIP/HpnyFk1D95/H8qFGf+To4YFgnFg3aiiHt6HD yYdQTNpcBTHZQwJIloNAYgytOypmmP+Y3tTr1f9Sa8fvDaJl1criOKF3Nz9J8yEX9l2tHijp F3Uo1zCGUEnBN2D1m/Qmp6rrrCWxn6qMG4IL5W66/prjVu71mEVThoMWjOTuuKlg0SzX9ZeL U08+Sc0q6U2skuxQbHVQBmQsHOC+BkGVLJ4Eec39QWMwar8+BuCCy4PSTspQMwrsoo6SCIn0 neNnsj1Hnp/vbuNU3Wf+7yI6zSoNkA9CXIJbGkqRA0O7t3nvak6lBeJRdFmeIawh8H1GDzth SyDtjI3g50Ll8kX0KO+9FHDxTmro/D0ohUdv1uNGDj/t0UgOdDjN9fABUXnAehoI9eUYn+Tu Xc9kfe8wMsXSr6IiRetX7BYdF223MppIAEwkHY2QcR+qmX1pif7FWxDyGogfRk0a67obResO RaO4l0Jufe/KVPwNcdKj5SN59PGJEQKPfDsTbjqY9VHefCdnyfXrXg1NSZ8M40A+XXAcJ3T2 r/BKK5A9V5AVcxaIMOeHo/xK4MDyCEk3n/0Tpvm1Rmh2rf2TCfLFOhaawTSNr9jtPjsTODpH zF3bpHi9vmieLemPnm/HXA7dzjm0kTX9bip8pcKJ4Zv0yJtGX07Cu+5/I7Nj7dNxvwP/s+Rp ynVchYBmDLX2CycQS3XOy8LVV8adcsmxZ7NFXd3ZgjANrlKSdvH0ZrzgLNtIeJ+rrUznaQrJ xTHEu3Zaslypv3802x1RfHAQEZKLnxHWSrm0/KZXQUC
- Ironport-hdrordr: A9a23:RDxlcaFXdJliAEVtpLqE7seALOsnbusQ8zAXP0AYc3Nom6uj5q eTdZUgpGbJYVkqOU3I9ersBEDEewK/yXcX2/h0AV7BZmnbUQKTRekIh7cKgQeQfhEWntQts5 uIGJIRNDSfNzRHZL7BkWqFL+o=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
check-endbr.sh works well with gawk, but fails with mawk. The produced
$ALL file is smaller, it is missing 0x$vma_lo on every line. On mawk,
int(0x2A) just produce 0, instead of the expected value.
The use of hexadecimal-constant in awk is an optional part of the
posix spec, and mawk doesn't seems to implemented.
There is a way to convert an hexadecimal to a number be putting it in
a string, and awk as I understand is supposed to use strtod() to
convert the string to a number when needed. The expression
'int("0x15") + 21' would produce the expected value in `mawk` but now
`gawk` won't convert the string to a number unless we use the option
"--non-decimal-data".
So let's convert the hexadecimal number before using it in the awk
script. The shell as no issue with dealing with hexadecimal-constant
so we'll simply use the expression "$(( 0x15 ))" to convert the value
before using it in awk.
Fixes: 4d037425dc ("x86: Build check for embedded endbr64 instructions")
Reported-by: Luca Fancellu <Luca.Fancellu@xxxxxxx>
Reported-by: Mathieu Tarral <mathieu.tarral@xxxxxxxxxxxxxx>
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
xen/tools/check-endbr.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/tools/check-endbr.sh b/xen/tools/check-endbr.sh
index 552f233912..64fa9a56b7 100755
--- a/xen/tools/check-endbr.sh
+++ b/xen/tools/check-endbr.sh
@@ -78,7 +78,7 @@ then
else
grep -aob -e "$(printf '\363\17\36\372')" -e "$(printf '\363\17\36\373')" \
-e "$(printf '\146\17\37\1')" $TEXT_BIN
-fi | awk -F':' '{printf "%s%x\n", "'$vma_hi'", int(0x'$vma_lo') + $1}' > $ALL
+fi | awk -F':' '{printf "%s%x\n", "'$vma_hi'", int('$((0x$vma_lo))') + $1}' >
$ALL
# Wait for $VALID to become complete
wait
--
Anthony PERARD
|