* [PATCH 0/5] darwin: expand cross-builds to also support x86 and testing
@ 2026-02-11 10:46 Roger Pau Monne
2026-02-11 10:46 ` [PATCH 1/5] xen/x86: always consider '/' as a division in assembly Roger Pau Monne
` (4 more replies)
0 siblings, 5 replies; 16+ messages in thread
From: Roger Pau Monne @ 2026-02-11 10:46 UTC (permalink / raw)
To: xen-devel
Cc: Roger Pau Monne, Andrew Cooper, Anthony PERARD, Michal Orzel,
Jan Beulich, Julien Grall, Stefano Stabellini
Hello,
This series expands the recently introduced Darwin hypervisor build
support to also allow cross-building an x86 hypervisor, that's done in
patches 1 to 3. Patches 4 and 5 introduce some Cirrus-CI testing to do
cross-builds from macOS, plus it also introduces some basic smoke
testing of the x86 builds using the XTF selftest, just like it's
currently done for the FreeBSD builds.
A result of the updated Cirrus-CI pipeline can be seen at:
https://cirrus-ci.com/build/6723050642604032
Thanks, Roger.
Roger Pau Monne (5):
xen/x86: always consider '/' as a division in assembly
xen/tools: remove usages of `stat -s` in check-endbr.sh
xen/tools: fix grep reporting 'illegal byte sequence' in
check-endbr.sh
cirrus-ci: add x86 and arm64 macOS hypervisor builds
cirrus-ci: add x86 XTF self-tests for macOS build
.cirrus.yml | 51 ++++++++++++++++++++++++++++++++++------
xen/Makefile | 7 ++++++
xen/tools/check-endbr.sh | 18 +++++++-------
3 files changed, 61 insertions(+), 15 deletions(-)
--
2.51.0
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/5] xen/x86: always consider '/' as a division in assembly
2026-02-11 10:46 [PATCH 0/5] darwin: expand cross-builds to also support x86 and testing Roger Pau Monne
@ 2026-02-11 10:46 ` Roger Pau Monne
2026-02-11 11:01 ` Bertrand Marquis
2026-02-11 11:11 ` Jan Beulich
2026-02-11 10:46 ` [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh Roger Pau Monne
` (3 subsequent siblings)
4 siblings, 2 replies; 16+ messages in thread
From: Roger Pau Monne @ 2026-02-11 10:46 UTC (permalink / raw)
To: xen-devel
Cc: Roger Pau Monne, Andrew Cooper, Anthony PERARD, Michal Orzel,
Jan Beulich, Julien Grall, Stefano Stabellini
On x86 GNU assembler will consider '/' as the start of comment marker for
some ELF targets. This is incorrect with Xen's usage, which does use '/'
in assembly files as a mathematical operator.
The behavior of the assembler can be altered by passing the --divide
option; unconditionally pass this option when available to force the
expected behavior.
Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Changes since v1:
- Guard option setting to x86 only.
- Adjust comment.
---
xen/Makefile | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/xen/Makefile b/xen/Makefile
index a054315fa4a2..4c83e2a46477 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -413,6 +413,13 @@ ifneq ($(CONFIG_CC_IS_CLANG),y)
CFLAGS += -Wa,--strip-local-absolute
endif
+ifeq ($(CONFIG_X86),y)
+# The GNU assembler will interpret '/' as a comment start marker instead of a
+# divide for some ELF targets. Pass --divide when when available to signal '/'
+# is always used as an operator in assembly.
+$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--divide)
+endif
+
$(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack)
LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments
--
2.51.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh
2026-02-11 10:46 [PATCH 0/5] darwin: expand cross-builds to also support x86 and testing Roger Pau Monne
2026-02-11 10:46 ` [PATCH 1/5] xen/x86: always consider '/' as a division in assembly Roger Pau Monne
@ 2026-02-11 10:46 ` Roger Pau Monne
2026-02-11 11:08 ` Bertrand Marquis
2026-02-11 11:40 ` Jan Beulich
2026-02-11 10:46 ` [PATCH 3/5] xen/tools: fix grep reporting 'illegal byte sequence' " Roger Pau Monne
` (2 subsequent siblings)
4 siblings, 2 replies; 16+ messages in thread
From: Roger Pau Monne @ 2026-02-11 10:46 UTC (permalink / raw)
To: xen-devel
Cc: Roger Pau Monne, Andrew Cooper, Anthony PERARD, Michal Orzel,
Jan Beulich, Julien Grall, Stefano Stabellini, Bertrand Marquis
The `-s` option to stat is not POSIX compatible, and hence prevents the
check-endbr.sh script from running reliably.
The first instance of `stat -s` can be removed by fetching the section size
from the output of objdump itself, which the script already parses to get
the VMA values.
The other two instances can be replaced by counting the lines in the
respective files. Those files contain list of addresses, so the size in
bytes is not strictly needed, we can count the number of lines instead.
Suggested-by: Bertrand Marquis <bertrand.marquis@arm.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
xen/tools/check-endbr.sh | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/xen/tools/check-endbr.sh b/xen/tools/check-endbr.sh
index bf153a570db4..383d7e710a53 100755
--- a/xen/tools/check-endbr.sh
+++ b/xen/tools/check-endbr.sh
@@ -92,14 +92,15 @@ ${OBJDUMP} -j .text $1 -d -w | grep ' endbr64 *$' | cut -f 1 -d ':' > $VALID &
# check nevertheless.
#
eval $(${OBJDUMP} -j .text $1 -h |
- $AWK '$2 == ".text" {printf "vma_hi=%s\nvma_lo=%s\n", substr($4, 1, 9), substr($4, 10, 16)}')
+ $AWK '$2 == ".text" {printf "bin_sz=%s\nvma_hi=%s\nvma_lo=%s\n", "0x" $3, substr($4, 1, 9), substr($4, 10, 16)}')
-${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
-
-bin_sz=$(stat -c '%s' $TEXT_BIN)
+# Convert objdump hex reported .text size to decimal
+bin_sz=$(printf %u $bin_sz)
[ "$bin_sz" -ge $(((1 << 28) - $vma_lo)) ] &&
{ echo "$MSG_PFX Error: .text offsets must not exceed 256M" >&2; exit 1; }
+${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
+
# instruction: hex: oct:
# endbr64 f3 0f 1e fa 363 017 036 372
# endbr32 f3 0f 1e fb 363 017 036 373
@@ -116,8 +117,8 @@ fi | $AWK -F':' '{printf "%s%07x\n", "'$vma_hi'", int('$((0x$vma_lo))') + $1}' >
wait
# Sanity check $VALID and $ALL, in case the string parsing bitrots
-val_sz=$(stat -c '%s' $VALID)
-all_sz=$(stat -c '%s' $ALL)
+val_sz=$(wc -l < $VALID)
+all_sz=$(wc -l < $ALL)
[ "$val_sz" -eq 0 ] && { echo "$MSG_PFX Error: Empty valid-addrs" >&2; exit 1; }
[ "$all_sz" -eq 0 ] && { echo "$MSG_PFX Error: Empty all-addrs" >&2; exit 1; }
[ "$all_sz" -lt "$val_sz" ] && { echo "$MSG_PFX Error: More valid-addrs than all-addrs" >&2; exit 1; }
--
2.51.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/5] xen/tools: fix grep reporting 'illegal byte sequence' in check-endbr.sh
2026-02-11 10:46 [PATCH 0/5] darwin: expand cross-builds to also support x86 and testing Roger Pau Monne
2026-02-11 10:46 ` [PATCH 1/5] xen/x86: always consider '/' as a division in assembly Roger Pau Monne
2026-02-11 10:46 ` [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh Roger Pau Monne
@ 2026-02-11 10:46 ` Roger Pau Monne
2026-02-11 11:10 ` Bertrand Marquis
2026-02-11 10:46 ` [PATCH 4/5] cirrus-ci: add x86 and arm64 macOS hypervisor builds Roger Pau Monne
2026-02-11 10:46 ` [PATCH 5/5] cirrus-ci: add x86 XTF self-tests for macOS build Roger Pau Monne
4 siblings, 1 reply; 16+ messages in thread
From: Roger Pau Monne @ 2026-02-11 10:46 UTC (permalink / raw)
To: xen-devel
Cc: Roger Pau Monne, Andrew Cooper, Anthony PERARD, Michal Orzel,
Jan Beulich, Julien Grall, Stefano Stabellini, Bertrand Marquis
On macOS the default encoding is UTF-8. The binary encoding used by the
grep matching pattern is not valid when processed as UTF-8. Switch the
local to C just for the grep invocation to use the binary match pattern
correctly.
Suggested-by: Bertrand Marquis <bertrand.marquis@arm.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
xen/tools/check-endbr.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/xen/tools/check-endbr.sh b/xen/tools/check-endbr.sh
index 383d7e710a53..0be9986dd356 100755
--- a/xen/tools/check-endbr.sh
+++ b/xen/tools/check-endbr.sh
@@ -109,8 +109,9 @@ if $perl_re
then
LC_ALL=C grep -aobP '\xf3\x0f\x1e(\xfa|\xfb)|\x66\x0f\x1f\x01' $TEXT_BIN
else
- grep -aob -e "$(printf '\363\17\36\372')" -e "$(printf '\363\17\36\373')" \
- -e "$(printf '\146\17\37\1')" $TEXT_BIN
+ LC_ALL=C 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%07x\n", "'$vma_hi'", int('$((0x$vma_lo))') + $1}' > $ALL
# Wait for $VALID to become complete
--
2.51.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 4/5] cirrus-ci: add x86 and arm64 macOS hypervisor builds
2026-02-11 10:46 [PATCH 0/5] darwin: expand cross-builds to also support x86 and testing Roger Pau Monne
` (2 preceding siblings ...)
2026-02-11 10:46 ` [PATCH 3/5] xen/tools: fix grep reporting 'illegal byte sequence' " Roger Pau Monne
@ 2026-02-11 10:46 ` Roger Pau Monne
2026-02-11 10:46 ` [PATCH 5/5] cirrus-ci: add x86 XTF self-tests for macOS build Roger Pau Monne
4 siblings, 0 replies; 16+ messages in thread
From: Roger Pau Monne @ 2026-02-11 10:46 UTC (permalink / raw)
To: xen-devel
Cc: Roger Pau Monne, Andrew Cooper, Anthony PERARD, Michal Orzel,
Jan Beulich, Julien Grall, Stefano Stabellini
Introduce two new build that run on macOS Cirrus-CI instances. Those build
the hypervisor using the elf cross-toolchain from Homebrew for both x86 and
arm64.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
I haven't added any randconfig jobs, we can consider adding those later on
if the builds are stable.
---
.cirrus.yml | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index 7bbb4f1c5c6c..b9608e71cca7 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,3 +1,5 @@
+## FreeBSD Build Jobs
+
# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
freebsd_versions: &FREEBSD_VERSIONS
env:
@@ -122,7 +124,41 @@ task:
path: xtf/tests/selftest/test-*-selftest
type: application/octet-stream
-# Test jobs
+## macOS Build Jobs
+
+task:
+ name: 'macOS: hypervisor build'
+
+ env:
+ matrix:
+ ARCH: x86_64
+ ARCH: aarch64
+
+ alias: macos-$ARCH
+ macos_instance:
+ image: ghcr.io/cirruslabs/macos-runner:sonoma
+
+ environment:
+ CIRRUS_CLONE_DEPTH: 1
+ CIRRUS_LOG_TIMESTAMP: true
+
+ install_script:
+ - brew install $ARCH-elf-gcc $ARCH-elf-binutils
+
+ build_script:
+ - make -j`sysctl -n hw.ncpu`
+ XEN_TARGET_ARCH=`echo $ARCH | sed -e s/aarch64/arm64/`
+ CROSS_COMPILE=$ARCH-elf- HOSTCC=clang -C xen
+
+ xen_artifacts:
+ path: xen/xen
+ type: application/octet-stream
+
+ debug_artifacts:
+ path: xen/xen-syms
+ type: application/octet-stream
+
+## Test Jobs
task:
name: 'FreeBSD: XTF selftest'
--
2.51.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 5/5] cirrus-ci: add x86 XTF self-tests for macOS build
2026-02-11 10:46 [PATCH 0/5] darwin: expand cross-builds to also support x86 and testing Roger Pau Monne
` (3 preceding siblings ...)
2026-02-11 10:46 ` [PATCH 4/5] cirrus-ci: add x86 and arm64 macOS hypervisor builds Roger Pau Monne
@ 2026-02-11 10:46 ` Roger Pau Monne
4 siblings, 0 replies; 16+ messages in thread
From: Roger Pau Monne @ 2026-02-11 10:46 UTC (permalink / raw)
To: xen-devel
Cc: Roger Pau Monne, Andrew Cooper, Anthony PERARD, Michal Orzel,
Jan Beulich, Julien Grall, Stefano Stabellini
Like we do for the FreeBSD builds, introduce some basic smoke testing of
the built binary using the XTF selftest image.
Note this is only done for the x86 build, there's no ARM support in XTF
yet.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
.cirrus.yml | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index b9608e71cca7..839c25149c9e 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -161,18 +161,19 @@ task:
## Test Jobs
task:
- name: 'FreeBSD: XTF selftest'
+ name: 'XTF selftest'
<< : *FREEBSD_ENV_PRODUCTION
env:
matrix:
- FREEBSD_BUILD: $FREEBSD_LEGACY
- FREEBSD_BUILD: $FREEBSD_PRODUCTION
- FREEBSD_BUILD: $FREEBSD_CURRENT
+ BUILD: freebsd_full_$FREEBSD_LEGACY
+ BUILD: freebsd_full_$FREEBSD_PRODUCTION
+ BUILD: freebsd_full_$FREEBSD_CURRENT
+ BUILD: macos-x86_64
depends_on:
- - freebsd_full_$FREEBSD_BUILD
+ - $BUILD
- xtf
install_script: pkg install -y qemu-nox11 expect
@@ -187,7 +188,7 @@ task:
fetch_script:
- fetch https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/xtf/xtf.zip
- - fetch https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/freebsd_full_$FREEBSD_BUILD/xen.zip
+ - fetch https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/$BUILD/xen.zip
- unzip xtf.zip
- unzip xen.zip
--
2.51.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 1/5] xen/x86: always consider '/' as a division in assembly
2026-02-11 10:46 ` [PATCH 1/5] xen/x86: always consider '/' as a division in assembly Roger Pau Monne
@ 2026-02-11 11:01 ` Bertrand Marquis
2026-02-11 11:11 ` Jan Beulich
1 sibling, 0 replies; 16+ messages in thread
From: Bertrand Marquis @ 2026-02-11 11:01 UTC (permalink / raw)
To: Roger Pau Monne
Cc: xen-devel@lists.xenproject.org, Andrew Cooper, Anthony PERARD,
Michal Orzel, Jan Beulich, Julien Grall, Stefano Stabellini
Hi Roger,
> On 11 Feb 2026, at 11:46, Roger Pau Monne <roger.pau@citrix.com> wrote:
>
> On x86 GNU assembler will consider '/' as the start of comment marker for
> some ELF targets. This is incorrect with Xen's usage, which does use '/'
> in assembly files as a mathematical operator.
>
> The behavior of the assembler can be altered by passing the --divide
> option; unconditionally pass this option when available to force the
> expected behavior.
Works to build x86 and arm still working on Mac OS.
>
> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Cheers
Bertrand
> ---
> Changes since v1:
> - Guard option setting to x86 only.
> - Adjust comment.
> ---
> xen/Makefile | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/xen/Makefile b/xen/Makefile
> index a054315fa4a2..4c83e2a46477 100644
> --- a/xen/Makefile
> +++ b/xen/Makefile
> @@ -413,6 +413,13 @@ ifneq ($(CONFIG_CC_IS_CLANG),y)
> CFLAGS += -Wa,--strip-local-absolute
> endif
>
> +ifeq ($(CONFIG_X86),y)
> +# The GNU assembler will interpret '/' as a comment start marker instead of a
> +# divide for some ELF targets. Pass --divide when when available to signal '/'
> +# is always used as an operator in assembly.
> +$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--divide)
> +endif
> +
> $(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack)
>
> LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments
> --
> 2.51.0
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh
2026-02-11 10:46 ` [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh Roger Pau Monne
@ 2026-02-11 11:08 ` Bertrand Marquis
2026-02-11 11:40 ` Jan Beulich
1 sibling, 0 replies; 16+ messages in thread
From: Bertrand Marquis @ 2026-02-11 11:08 UTC (permalink / raw)
To: Roger Pau Monne
Cc: xen-devel@lists.xenproject.org, Andrew Cooper, Anthony PERARD,
Michal Orzel, Jan Beulich, Julien Grall, Stefano Stabellini
Hi Roger,
> On 11 Feb 2026, at 11:46, Roger Pau Monne <roger.pau@citrix.com> wrote:
>
> The `-s` option to stat is not POSIX compatible, and hence prevents the
> check-endbr.sh script from running reliably.
>
> The first instance of `stat -s` can be removed by fetching the section size
> from the output of objdump itself, which the script already parses to get
> the VMA values.
>
> The other two instances can be replaced by counting the lines in the
> respective files. Those files contain list of addresses, so the size in
> bytes is not strictly needed, we can count the number of lines instead.
I can confirm compilation works on my side and changes seem coherent
but i would like an x86 maintainer to review/ack this one to confirm that
functionally it is ok.
>
> Suggested-by: Bertrand Marquis <bertrand.marquis@arm.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
Cheers
Bertrand
> ---
> xen/tools/check-endbr.sh | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/xen/tools/check-endbr.sh b/xen/tools/check-endbr.sh
> index bf153a570db4..383d7e710a53 100755
> --- a/xen/tools/check-endbr.sh
> +++ b/xen/tools/check-endbr.sh
> @@ -92,14 +92,15 @@ ${OBJDUMP} -j .text $1 -d -w | grep ' endbr64 *$' | cut -f 1 -d ':' > $VALID &
> # check nevertheless.
> #
> eval $(${OBJDUMP} -j .text $1 -h |
> - $AWK '$2 == ".text" {printf "vma_hi=%s\nvma_lo=%s\n", substr($4, 1, 9), substr($4, 10, 16)}')
> + $AWK '$2 == ".text" {printf "bin_sz=%s\nvma_hi=%s\nvma_lo=%s\n", "0x" $3, substr($4, 1, 9), substr($4, 10, 16)}')
>
> -${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
> -
> -bin_sz=$(stat -c '%s' $TEXT_BIN)
> +# Convert objdump hex reported .text size to decimal
> +bin_sz=$(printf %u $bin_sz)
> [ "$bin_sz" -ge $(((1 << 28) - $vma_lo)) ] &&
> { echo "$MSG_PFX Error: .text offsets must not exceed 256M" >&2; exit 1; }
>
> +${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
> +
> # instruction: hex: oct:
> # endbr64 f3 0f 1e fa 363 017 036 372
> # endbr32 f3 0f 1e fb 363 017 036 373
> @@ -116,8 +117,8 @@ fi | $AWK -F':' '{printf "%s%07x\n", "'$vma_hi'", int('$((0x$vma_lo))') + $1}' >
> wait
>
> # Sanity check $VALID and $ALL, in case the string parsing bitrots
> -val_sz=$(stat -c '%s' $VALID)
> -all_sz=$(stat -c '%s' $ALL)
> +val_sz=$(wc -l < $VALID)
> +all_sz=$(wc -l < $ALL)
> [ "$val_sz" -eq 0 ] && { echo "$MSG_PFX Error: Empty valid-addrs" >&2; exit 1; }
> [ "$all_sz" -eq 0 ] && { echo "$MSG_PFX Error: Empty all-addrs" >&2; exit 1; }
> [ "$all_sz" -lt "$val_sz" ] && { echo "$MSG_PFX Error: More valid-addrs than all-addrs" >&2; exit 1; }
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/5] xen/tools: fix grep reporting 'illegal byte sequence' in check-endbr.sh
2026-02-11 10:46 ` [PATCH 3/5] xen/tools: fix grep reporting 'illegal byte sequence' " Roger Pau Monne
@ 2026-02-11 11:10 ` Bertrand Marquis
0 siblings, 0 replies; 16+ messages in thread
From: Bertrand Marquis @ 2026-02-11 11:10 UTC (permalink / raw)
To: Roger Pau Monne
Cc: xen-devel@lists.xenproject.org, Andrew Cooper, Anthony PERARD,
Michal Orzel, Jan Beulich, Julien Grall, Stefano Stabellini
Hi Roger,
> On 11 Feb 2026, at 11:46, Roger Pau Monne <roger.pau@citrix.com> wrote:
>
> On macOS the default encoding is UTF-8. The binary encoding used by the
> grep matching pattern is not valid when processed as UTF-8. Switch the
> local to C just for the grep invocation to use the binary match pattern
> correctly.
>
> Suggested-by: Bertrand Marquis <bertrand.marquis@arm.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Works and makes sense.
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Cheers
Bertrand
> ---
> xen/tools/check-endbr.sh | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/xen/tools/check-endbr.sh b/xen/tools/check-endbr.sh
> index 383d7e710a53..0be9986dd356 100755
> --- a/xen/tools/check-endbr.sh
> +++ b/xen/tools/check-endbr.sh
> @@ -109,8 +109,9 @@ if $perl_re
> then
> LC_ALL=C grep -aobP '\xf3\x0f\x1e(\xfa|\xfb)|\x66\x0f\x1f\x01' $TEXT_BIN
> else
> - grep -aob -e "$(printf '\363\17\36\372')" -e "$(printf '\363\17\36\373')" \
> - -e "$(printf '\146\17\37\1')" $TEXT_BIN
> + LC_ALL=C 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%07x\n", "'$vma_hi'", int('$((0x$vma_lo))') + $1}' > $ALL
>
> # Wait for $VALID to become complete
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/5] xen/x86: always consider '/' as a division in assembly
2026-02-11 10:46 ` [PATCH 1/5] xen/x86: always consider '/' as a division in assembly Roger Pau Monne
2026-02-11 11:01 ` Bertrand Marquis
@ 2026-02-11 11:11 ` Jan Beulich
2026-02-11 11:22 ` Roger Pau Monné
1 sibling, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2026-02-11 11:11 UTC (permalink / raw)
To: Roger Pau Monne
Cc: Andrew Cooper, Anthony PERARD, Michal Orzel, Julien Grall,
Stefano Stabellini, xen-devel
On 11.02.2026 11:46, Roger Pau Monne wrote:
> --- a/xen/Makefile
> +++ b/xen/Makefile
> @@ -413,6 +413,13 @@ ifneq ($(CONFIG_CC_IS_CLANG),y)
> CFLAGS += -Wa,--strip-local-absolute
> endif
>
> +ifeq ($(CONFIG_X86),y)
> +# The GNU assembler will interpret '/' as a comment start marker instead of a
> +# divide for some ELF targets. Pass --divide when when available to signal '/'
> +# is always used as an operator in assembly.
> +$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--divide)
> +endif
As said before, I don't think this should be put here. Not even with the
new ifeq(,) around it. It should go in x86/arch.mk, or a reason should be
given why it can't.
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/5] xen/x86: always consider '/' as a division in assembly
2026-02-11 11:11 ` Jan Beulich
@ 2026-02-11 11:22 ` Roger Pau Monné
0 siblings, 0 replies; 16+ messages in thread
From: Roger Pau Monné @ 2026-02-11 11:22 UTC (permalink / raw)
To: Jan Beulich
Cc: Andrew Cooper, Anthony PERARD, Michal Orzel, Julien Grall,
Stefano Stabellini, xen-devel
On Wed, Feb 11, 2026 at 12:11:32PM +0100, Jan Beulich wrote:
> On 11.02.2026 11:46, Roger Pau Monne wrote:
> > --- a/xen/Makefile
> > +++ b/xen/Makefile
> > @@ -413,6 +413,13 @@ ifneq ($(CONFIG_CC_IS_CLANG),y)
> > CFLAGS += -Wa,--strip-local-absolute
> > endif
> >
> > +ifeq ($(CONFIG_X86),y)
> > +# The GNU assembler will interpret '/' as a comment start marker instead of a
> > +# divide for some ELF targets. Pass --divide when when available to signal '/'
> > +# is always used as an operator in assembly.
> > +$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--divide)
> > +endif
>
> As said before, I don't think this should be put here. Not even with the
> new ifeq(,) around it. It should go in x86/arch.mk, or a reason should be
> given why it can't.
My bad. I've attempted to put it there but got complains from the
build in x86/boot/. I think that was because I had leftover stale
objects in there, and nothing do to with the patch itself. I can
confirm it works when the chunk is placed in x86/arch.mk.
Thanks, Roger.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh
2026-02-11 10:46 ` [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh Roger Pau Monne
2026-02-11 11:08 ` Bertrand Marquis
@ 2026-02-11 11:40 ` Jan Beulich
2026-02-11 12:24 ` Roger Pau Monné
1 sibling, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2026-02-11 11:40 UTC (permalink / raw)
To: Roger Pau Monne
Cc: Andrew Cooper, Anthony PERARD, Michal Orzel, Julien Grall,
Stefano Stabellini, Bertrand Marquis, xen-devel
On 11.02.2026 11:46, Roger Pau Monne wrote:
> The `-s` option to stat is not POSIX compatible, and hence prevents the
> check-endbr.sh script from running reliably.
>
> The first instance of `stat -s` can be removed by fetching the section size
> from the output of objdump itself, which the script already parses to get
> the VMA values.
In both paragraphs, s/-s/-c/ ?
> The other two instances can be replaced by counting the lines in the
> respective files. Those files contain list of addresses, so the size in
> bytes is not strictly needed, we can count the number of lines instead.
Hmm, indeed, just that ...
> --- a/xen/tools/check-endbr.sh
> +++ b/xen/tools/check-endbr.sh
> @@ -92,14 +92,15 @@ ${OBJDUMP} -j .text $1 -d -w | grep ' endbr64 *$' | cut -f 1 -d ':' > $VALID &
> # check nevertheless.
> #
> eval $(${OBJDUMP} -j .text $1 -h |
> - $AWK '$2 == ".text" {printf "vma_hi=%s\nvma_lo=%s\n", substr($4, 1, 9), substr($4, 10, 16)}')
> + $AWK '$2 == ".text" {printf "bin_sz=%s\nvma_hi=%s\nvma_lo=%s\n", "0x" $3, substr($4, 1, 9), substr($4, 10, 16)}')
>
> -${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
> -
> -bin_sz=$(stat -c '%s' $TEXT_BIN)
> +# Convert objdump hex reported .text size to decimal
> +bin_sz=$(printf %u $bin_sz)
(Alternatively without this line, but ...
> [ "$bin_sz" -ge $(((1 << 28) - $vma_lo)) ] &&
[ "$(($bin_sz))" -ge $(((1 << 28) - $vma_lo)) ] &&
?)
> { echo "$MSG_PFX Error: .text offsets must not exceed 256M" >&2; exit 1; }
>
> +${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
> +
> # instruction: hex: oct:
> # endbr64 f3 0f 1e fa 363 017 036 372
> # endbr32 f3 0f 1e fb 363 017 036 373
> @@ -116,8 +117,8 @@ fi | $AWK -F':' '{printf "%s%07x\n", "'$vma_hi'", int('$((0x$vma_lo))') + $1}' >
> wait
>
> # Sanity check $VALID and $ALL, in case the string parsing bitrots
> -val_sz=$(stat -c '%s' $VALID)
> -all_sz=$(stat -c '%s' $ALL)
> +val_sz=$(wc -l < $VALID)
> +all_sz=$(wc -l < $ALL)
> [ "$val_sz" -eq 0 ] && { echo "$MSG_PFX Error: Empty valid-addrs" >&2; exit 1; }
> [ "$all_sz" -eq 0 ] && { echo "$MSG_PFX Error: Empty all-addrs" >&2; exit 1; }
> [ "$all_sz" -lt "$val_sz" ] && { echo "$MSG_PFX Error: More valid-addrs than all-addrs" >&2; exit 1; }
... the variables' _sz suffixes then end up a little misleading. Not sure
in how far we care. Perhaps not enough to warrant the bigger churn:
Reviewed-by: Jan Beulich <jbeulich@suse.com>
(with the description adjustment).
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh
2026-02-11 11:40 ` Jan Beulich
@ 2026-02-11 12:24 ` Roger Pau Monné
2026-02-11 13:07 ` Jan Beulich
0 siblings, 1 reply; 16+ messages in thread
From: Roger Pau Monné @ 2026-02-11 12:24 UTC (permalink / raw)
To: Jan Beulich
Cc: Andrew Cooper, Anthony PERARD, Michal Orzel, Julien Grall,
Stefano Stabellini, Bertrand Marquis, xen-devel
On Wed, Feb 11, 2026 at 12:40:58PM +0100, Jan Beulich wrote:
> On 11.02.2026 11:46, Roger Pau Monne wrote:
> > The `-s` option to stat is not POSIX compatible, and hence prevents the
> > check-endbr.sh script from running reliably.
> >
> > The first instance of `stat -s` can be removed by fetching the section size
> > from the output of objdump itself, which the script already parses to get
> > the VMA values.
>
> In both paragraphs, s/-s/-c/ ?
Bah, yes.
> > The other two instances can be replaced by counting the lines in the
> > respective files. Those files contain list of addresses, so the size in
> > bytes is not strictly needed, we can count the number of lines instead.
>
> Hmm, indeed, just that ...
>
> > --- a/xen/tools/check-endbr.sh
> > +++ b/xen/tools/check-endbr.sh
> > @@ -92,14 +92,15 @@ ${OBJDUMP} -j .text $1 -d -w | grep ' endbr64 *$' | cut -f 1 -d ':' > $VALID &
> > # check nevertheless.
> > #
> > eval $(${OBJDUMP} -j .text $1 -h |
> > - $AWK '$2 == ".text" {printf "vma_hi=%s\nvma_lo=%s\n", substr($4, 1, 9), substr($4, 10, 16)}')
> > + $AWK '$2 == ".text" {printf "bin_sz=%s\nvma_hi=%s\nvma_lo=%s\n", "0x" $3, substr($4, 1, 9), substr($4, 10, 16)}')
> >
> > -${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
> > -
> > -bin_sz=$(stat -c '%s' $TEXT_BIN)
> > +# Convert objdump hex reported .text size to decimal
> > +bin_sz=$(printf %u $bin_sz)
>
> (Alternatively without this line, but ...
>
> > [ "$bin_sz" -ge $(((1 << 28) - $vma_lo)) ] &&
>
> [ "$(($bin_sz))" -ge $(((1 << 28) - $vma_lo)) ] &&
>
> ?)
Isn't that bash-specific functionality? The script interpreter is set
as /bin/sh.
> > { echo "$MSG_PFX Error: .text offsets must not exceed 256M" >&2; exit 1; }
> >
> > +${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
> > +
> > # instruction: hex: oct:
> > # endbr64 f3 0f 1e fa 363 017 036 372
> > # endbr32 f3 0f 1e fb 363 017 036 373
> > @@ -116,8 +117,8 @@ fi | $AWK -F':' '{printf "%s%07x\n", "'$vma_hi'", int('$((0x$vma_lo))') + $1}' >
> > wait
> >
> > # Sanity check $VALID and $ALL, in case the string parsing bitrots
> > -val_sz=$(stat -c '%s' $VALID)
> > -all_sz=$(stat -c '%s' $ALL)
> > +val_sz=$(wc -l < $VALID)
> > +all_sz=$(wc -l < $ALL)
> > [ "$val_sz" -eq 0 ] && { echo "$MSG_PFX Error: Empty valid-addrs" >&2; exit 1; }
> > [ "$all_sz" -eq 0 ] && { echo "$MSG_PFX Error: Empty all-addrs" >&2; exit 1; }
> > [ "$all_sz" -lt "$val_sz" ] && { echo "$MSG_PFX Error: More valid-addrs than all-addrs" >&2; exit 1; }
>
> ... the variables' _sz suffixes then end up a little misleading. Not sure
> in how far we care. Perhaps not enough to warrant the bigger churn:
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> (with the description adjustment).
I could rename to _lines or some such, but I didn't see much benefit.
If you don't have a strong opinion towards renaming I will leave
as-is.
Thanks, Roger.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh
2026-02-11 12:24 ` Roger Pau Monné
@ 2026-02-11 13:07 ` Jan Beulich
2026-02-11 13:34 ` Roger Pau Monné
0 siblings, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2026-02-11 13:07 UTC (permalink / raw)
To: Roger Pau Monné
Cc: Andrew Cooper, Anthony PERARD, Michal Orzel, Julien Grall,
Stefano Stabellini, Bertrand Marquis, xen-devel
On 11.02.2026 13:24, Roger Pau Monné wrote:
> On Wed, Feb 11, 2026 at 12:40:58PM +0100, Jan Beulich wrote:
>> On 11.02.2026 11:46, Roger Pau Monne wrote:
>>> --- a/xen/tools/check-endbr.sh
>>> +++ b/xen/tools/check-endbr.sh
>>> @@ -92,14 +92,15 @@ ${OBJDUMP} -j .text $1 -d -w | grep ' endbr64 *$' | cut -f 1 -d ':' > $VALID &
>>> # check nevertheless.
>>> #
>>> eval $(${OBJDUMP} -j .text $1 -h |
>>> - $AWK '$2 == ".text" {printf "vma_hi=%s\nvma_lo=%s\n", substr($4, 1, 9), substr($4, 10, 16)}')
>>> + $AWK '$2 == ".text" {printf "bin_sz=%s\nvma_hi=%s\nvma_lo=%s\n", "0x" $3, substr($4, 1, 9), substr($4, 10, 16)}')
>>>
>>> -${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
>>> -
>>> -bin_sz=$(stat -c '%s' $TEXT_BIN)
>>> +# Convert objdump hex reported .text size to decimal
>>> +bin_sz=$(printf %u $bin_sz)
>>
>> (Alternatively without this line, but ...
>>
>>> [ "$bin_sz" -ge $(((1 << 28) - $vma_lo)) ] &&
>>
>> [ "$(($bin_sz))" -ge $(((1 << 28) - $vma_lo)) ] &&
>>
>> ?)
>
> Isn't that bash-specific functionality? The script interpreter is set
> as /bin/sh.
I, too, would have thought so, but then the rhs of the -ge already used $((...)).
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh
2026-02-11 13:07 ` Jan Beulich
@ 2026-02-11 13:34 ` Roger Pau Monné
2026-02-11 13:43 ` Jan Beulich
0 siblings, 1 reply; 16+ messages in thread
From: Roger Pau Monné @ 2026-02-11 13:34 UTC (permalink / raw)
To: Jan Beulich
Cc: Andrew Cooper, Anthony PERARD, Michal Orzel, Julien Grall,
Stefano Stabellini, Bertrand Marquis, xen-devel
On Wed, Feb 11, 2026 at 02:07:13PM +0100, Jan Beulich wrote:
> On 11.02.2026 13:24, Roger Pau Monné wrote:
> > On Wed, Feb 11, 2026 at 12:40:58PM +0100, Jan Beulich wrote:
> >> On 11.02.2026 11:46, Roger Pau Monne wrote:
> >>> --- a/xen/tools/check-endbr.sh
> >>> +++ b/xen/tools/check-endbr.sh
> >>> @@ -92,14 +92,15 @@ ${OBJDUMP} -j .text $1 -d -w | grep ' endbr64 *$' | cut -f 1 -d ':' > $VALID &
> >>> # check nevertheless.
> >>> #
> >>> eval $(${OBJDUMP} -j .text $1 -h |
> >>> - $AWK '$2 == ".text" {printf "vma_hi=%s\nvma_lo=%s\n", substr($4, 1, 9), substr($4, 10, 16)}')
> >>> + $AWK '$2 == ".text" {printf "bin_sz=%s\nvma_hi=%s\nvma_lo=%s\n", "0x" $3, substr($4, 1, 9), substr($4, 10, 16)}')
> >>>
> >>> -${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
> >>> -
> >>> -bin_sz=$(stat -c '%s' $TEXT_BIN)
> >>> +# Convert objdump hex reported .text size to decimal
> >>> +bin_sz=$(printf %u $bin_sz)
> >>
> >> (Alternatively without this line, but ...
> >>
> >>> [ "$bin_sz" -ge $(((1 << 28) - $vma_lo)) ] &&
> >>
> >> [ "$(($bin_sz))" -ge $(((1 << 28) - $vma_lo)) ] &&
> >>
> >> ?)
> >
> > Isn't that bash-specific functionality? The script interpreter is set
> > as /bin/sh.
>
> I, too, would have thought so, but then the rhs of the -ge already used $((...)).
OK, yes, I didn't realize those existing usages. Now that I look at
it it does seem to have a bunch of other bashisms, for example
parameter expansion.
I will adjust that plus the commit message and take your RB.
Thanks, Roger.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh
2026-02-11 13:34 ` Roger Pau Monné
@ 2026-02-11 13:43 ` Jan Beulich
0 siblings, 0 replies; 16+ messages in thread
From: Jan Beulich @ 2026-02-11 13:43 UTC (permalink / raw)
To: Roger Pau Monné
Cc: Andrew Cooper, Anthony PERARD, Michal Orzel, Julien Grall,
Stefano Stabellini, Bertrand Marquis, xen-devel
On 11.02.2026 14:34, Roger Pau Monné wrote:
> On Wed, Feb 11, 2026 at 02:07:13PM +0100, Jan Beulich wrote:
>> On 11.02.2026 13:24, Roger Pau Monné wrote:
>>> On Wed, Feb 11, 2026 at 12:40:58PM +0100, Jan Beulich wrote:
>>>> On 11.02.2026 11:46, Roger Pau Monne wrote:
>>>>> --- a/xen/tools/check-endbr.sh
>>>>> +++ b/xen/tools/check-endbr.sh
>>>>> @@ -92,14 +92,15 @@ ${OBJDUMP} -j .text $1 -d -w | grep ' endbr64 *$' | cut -f 1 -d ':' > $VALID &
>>>>> # check nevertheless.
>>>>> #
>>>>> eval $(${OBJDUMP} -j .text $1 -h |
>>>>> - $AWK '$2 == ".text" {printf "vma_hi=%s\nvma_lo=%s\n", substr($4, 1, 9), substr($4, 10, 16)}')
>>>>> + $AWK '$2 == ".text" {printf "bin_sz=%s\nvma_hi=%s\nvma_lo=%s\n", "0x" $3, substr($4, 1, 9), substr($4, 10, 16)}')
>>>>>
>>>>> -${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
>>>>> -
>>>>> -bin_sz=$(stat -c '%s' $TEXT_BIN)
>>>>> +# Convert objdump hex reported .text size to decimal
>>>>> +bin_sz=$(printf %u $bin_sz)
>>>>
>>>> (Alternatively without this line, but ...
>>>>
>>>>> [ "$bin_sz" -ge $(((1 << 28) - $vma_lo)) ] &&
>>>>
>>>> [ "$(($bin_sz))" -ge $(((1 << 28) - $vma_lo)) ] &&
>>>>
>>>> ?)
>>>
>>> Isn't that bash-specific functionality? The script interpreter is set
>>> as /bin/sh.
>>
>> I, too, would have thought so, but then the rhs of the -ge already used $((...)).
>
> OK, yes, I didn't realize those existing usages. Now that I look at
> it it does seem to have a bunch of other bashisms, for example
> parameter expansion.
Then perhaps in another patch we want to properly mark it as a bash script.
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2026-02-11 13:43 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-11 10:46 [PATCH 0/5] darwin: expand cross-builds to also support x86 and testing Roger Pau Monne
2026-02-11 10:46 ` [PATCH 1/5] xen/x86: always consider '/' as a division in assembly Roger Pau Monne
2026-02-11 11:01 ` Bertrand Marquis
2026-02-11 11:11 ` Jan Beulich
2026-02-11 11:22 ` Roger Pau Monné
2026-02-11 10:46 ` [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh Roger Pau Monne
2026-02-11 11:08 ` Bertrand Marquis
2026-02-11 11:40 ` Jan Beulich
2026-02-11 12:24 ` Roger Pau Monné
2026-02-11 13:07 ` Jan Beulich
2026-02-11 13:34 ` Roger Pau Monné
2026-02-11 13:43 ` Jan Beulich
2026-02-11 10:46 ` [PATCH 3/5] xen/tools: fix grep reporting 'illegal byte sequence' " Roger Pau Monne
2026-02-11 11:10 ` Bertrand Marquis
2026-02-11 10:46 ` [PATCH 4/5] cirrus-ci: add x86 and arm64 macOS hypervisor builds Roger Pau Monne
2026-02-11 10:46 ` [PATCH 5/5] cirrus-ci: add x86 XTF self-tests for macOS build Roger Pau Monne
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.