From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76])
	by passt.top (Postfix) with ESMTPS id 6FE385A021E
	for <passt-dev@passt.top>; Wed,  1 Mar 2023 06:17:51 +0100 (CET)
Received: by gandalf.ozlabs.org (Postfix, from userid 1007)
	id 4PRMtz6rQfz4x8x; Wed,  1 Mar 2023 16:17:47 +1100 (AEDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=gibson.dropbear.id.au; s=201602; t=1677647867;
	bh=iguv4eGIfdUxuinS/HdkLF5EIsr3TxvYe0bR7k5ioks=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
	b=AMIgEDnUiZkDg4tdvHgFkHe6ENo1ORZOx5JTqkotQo8IN/KjAb1OdMCKlJEOEpuUG
	 HCMvD+Yurg1BUbJPymWYK08LBkwaaWQyPJyqGzJuvbvk9Ggf5RatrBThT0ryGwryvz
	 oKQ5JXSqhoMxajY/1WfwNNg9Da8ArQmzf0DzPDSI=
Date: Wed, 1 Mar 2023 14:24:50 +1100
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Subject: Re: [PATCH] Makefile, seccomp.sh: Fix cross-builds, adjust syscalls
 list to compiler
Message-ID: <Y/7FgvWAyT9E4x/Q@yekko>
References: <20230228101727.1605503-1-sbrivio@redhat.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature"; boundary="vpy8c9xuJ5Z2i1p5"
Content-Disposition: inline
In-Reply-To: <20230228101727.1605503-1-sbrivio@redhat.com>
Message-ID-Hash: BFH7KNSUZIHSG6COMNQF7VHUPWAMEH6Y
X-Message-ID-Hash: BFH7KNSUZIHSG6COMNQF7VHUPWAMEH6Y
X-MailFrom: dgibson@gandalf.ozlabs.org
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: passt-dev@passt.top
X-Mailman-Version: 3.3.8
Precedence: list
List-Id: Development discussion and patches for passt <passt-dev.passt.top>
Archived-At: <https://archives.passt.top/passt-dev/Y/7FgvWAyT9E4x/Q@yekko/>
Archived-At: <https://passt.top/hyperkitty/list/passt-dev@passt.top/message/BFH7KNSUZIHSG6COMNQF7VHUPWAMEH6Y/>
List-Archive: <https://archives.passt.top/passt-dev/>
List-Archive: <https://passt.top/hyperkitty/list/passt-dev@passt.top/>
List-Help: <mailto:passt-dev-request@passt.top?subject=help>
List-Owner: <mailto:passt-dev-owner@passt.top>
List-Post: <mailto:passt-dev@passt.top>
List-Subscribe: <mailto:passt-dev-join@passt.top>
List-Unsubscribe: <mailto:passt-dev-leave@passt.top>


--vpy8c9xuJ5Z2i1p5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Feb 28, 2023 at 11:17:27AM +0100, Stefano Brivio wrote:
> Debian cross-building automatic checks:
>=20
>   http://crossqa.debian.net/src/passt
>=20
> currently fail because we don't use the right target architecture and
> compiler while building the system call lists and resolving their
> numbers in seccomp.sh. Pass ARCH and CC to seccomp.sh and use them.
>=20
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  Makefile   | 2 +-
>  seccomp.sh | 7 +++++--
>  2 files changed, 6 insertions(+), 3 deletions(-)
>=20
> diff --git a/Makefile b/Makefile
> index 667ddfb..e5723a7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -105,7 +105,7 @@ static: FLAGS +=3D -static -DGLIBC_NO_STATIC_NSS
>  static: clean all
> =20
>  seccomp.h: seccomp.sh $(PASST_SRCS) $(PASST_HEADERS)
> -	@ EXTRA_SYSCALLS=3D"$(EXTRA_SYSCALLS)" ./seccomp.sh $(PASST_SRCS) $(PAS=
ST_HEADERS)
> +	@ EXTRA_SYSCALLS=3D"$(EXTRA_SYSCALLS)" ARCH=3D"$(TARGET_ARCH)" CC=3D"$(=
CC)" ./seccomp.sh $(PASST_SRCS) $(PASST_HEADERS)
> =20
>  passt: $(PASST_SRCS) $(HEADERS)
>  	$(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) $(PASST_SRCS) -o passt $(LDFLAGS)
> diff --git a/seccomp.sh b/seccomp.sh
> index 31ea8da..b075efd 100755
> --- a/seccomp.sh
> +++ b/seccomp.sh
> @@ -17,6 +17,9 @@ TMP=3D"$(mktemp)"
>  IN=3D"$@"
>  OUT=3D"seccomp.h"
> =20
> +[ -z "${ARCH}" ] && ARCH=3D"$(uname -m)"
> +[ -z "${CC}" ] && CC=3D"cc"
> +
>  HEADER=3D"/* This file was automatically generated by $(basename ${0}) */
> =20
>  #ifndef AUDIT_ARCH_PPC64LE
> @@ -110,7 +113,7 @@ log2() {
>  # $1:	Name of syscall
>  syscall_nr() {
>  	__in=3D"$(printf "#include <asm-generic/unistd.h>\n#include <sys/syscal=
l.h>\n__NR_%s" ${1})"
> -	__out=3D"$(echo "${__in}" | cc -E -xc - -o - | tail -1)"
> +	__out=3D"$(echo "${__in}" | ${CC} -E -xc - -o - | tail -1)"
>  	[ "${__out}" =3D "__NR_$1" ] && return 1
> =20
>  	# Output might be in the form "(x + y)" (seen on armv6l, armv7l)
> @@ -125,7 +128,7 @@ filter() {
>  		case ${__c} in
>  		*:*)
>  			case ${__c} in
> -			$(uname -m):*)
> +			${ARCH}:*)
>  				__arch_match=3D1
>  				__c=3D${__c##*:}
>  				;;

--=20
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

--vpy8c9xuJ5Z2i1p5
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmP+xXwACgkQzQJF27ox
2GehIg/7BPql+7tns/XnHgYqAZLipKgj3mg3p6CTHaCpHTrn/zvoCXvDaOyvHzxK
mwpbkgU1HMM/p0VODQdkhiNabSXi0USwoy614QDWiJxjuEC/ni7twvg7N7IoSKe8
p4uOn+jwWDBVtqkFjHY7O5wV31ACO3xY4+40vErdANETnvL91jXvqy558Vd1EZcE
Hgtcpz/xTF5v76PvdmIO7dntK7Xyzyxe63PZmbz7oSvNA/vLnFtMUxXfKyTSt2P3
8ilWKpqehg8C5f1Mbuem7Y+Ig+TvOE5uGHFyVsNMhR1oW/TJT7cqa+sqlll+Pqsm
wIp4paxsTj5EwNsls9mMbR6Hh2GQdDjNwCESBm7xB+cMVNRTqJitQaZU1nQZN3r9
a/kPWjkpnxTSsdTAbHU65zt6l6CO0hm4xZYMU9srKz2rIlM/7tE5hd/Jr2qsBfox
5ZqL+tT3WnBjMfVh7ty5to0+RRLvEgbtkyf2Z+y8rdM9PvbzNxcG02K1Wicu+y/G
hYdaRJ0czbQHErX2hYlgbp8OWyupisbfYlQP9Tqku+QN1J0CiOT/kjFYnFO9ZXS6
kAKORM2fJldMVjsP3gSgi/KoBcbXyRBbUmlAZoGq1BtvQyt3WGdt8g3NOdSt68sU
ZtNkXO0gGkob2rfSSLYnDKJd/t0RmVxvRSU6aJfCe4xSi8DrpQ8=
=kbuL
-----END PGP SIGNATURE-----

--vpy8c9xuJ5Z2i1p5--