1
0
mirror of https://passt.top/passt synced 2024-09-28 10:05:47 +00:00

Makefile, seccomp.sh: Fix cross-builds, adjust syscalls list to compiler

Debian cross-building automatic checks:

  http://crossqa.debian.net/src/passt

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.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Stefano Brivio 2023-02-28 00:53:01 +01:00
parent c538ee8d69
commit 0d8c114aa2
2 changed files with 6 additions and 3 deletions

View File

@ -105,7 +105,7 @@ static: FLAGS += -static -DGLIBC_NO_STATIC_NSS
static: clean all static: clean all
seccomp.h: seccomp.sh $(PASST_SRCS) $(PASST_HEADERS) seccomp.h: seccomp.sh $(PASST_SRCS) $(PASST_HEADERS)
@ EXTRA_SYSCALLS="$(EXTRA_SYSCALLS)" ./seccomp.sh $(PASST_SRCS) $(PASST_HEADERS) @ EXTRA_SYSCALLS="$(EXTRA_SYSCALLS)" ARCH="$(TARGET_ARCH)" CC="$(CC)" ./seccomp.sh $(PASST_SRCS) $(PASST_HEADERS)
passt: $(PASST_SRCS) $(HEADERS) passt: $(PASST_SRCS) $(HEADERS)
$(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) $(PASST_SRCS) -o passt $(LDFLAGS) $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) $(PASST_SRCS) -o passt $(LDFLAGS)

View File

@ -17,6 +17,9 @@ TMP="$(mktemp)"
IN="$@" IN="$@"
OUT="seccomp.h" OUT="seccomp.h"
[ -z "${ARCH}" ] && ARCH="$(uname -m)"
[ -z "${CC}" ] && CC="cc"
HEADER="/* This file was automatically generated by $(basename ${0}) */ HEADER="/* This file was automatically generated by $(basename ${0}) */
#ifndef AUDIT_ARCH_PPC64LE #ifndef AUDIT_ARCH_PPC64LE
@ -110,7 +113,7 @@ log2() {
# $1: Name of syscall # $1: Name of syscall
syscall_nr() { syscall_nr() {
__in="$(printf "#include <asm-generic/unistd.h>\n#include <sys/syscall.h>\n__NR_%s" ${1})" __in="$(printf "#include <asm-generic/unistd.h>\n#include <sys/syscall.h>\n__NR_%s" ${1})"
__out="$(echo "${__in}" | cc -E -xc - -o - | tail -1)" __out="$(echo "${__in}" | ${CC} -E -xc - -o - | tail -1)"
[ "${__out}" = "__NR_$1" ] && return 1 [ "${__out}" = "__NR_$1" ] && return 1
# Output might be in the form "(x + y)" (seen on armv6l, armv7l) # Output might be in the form "(x + y)" (seen on armv6l, armv7l)
@ -125,7 +128,7 @@ filter() {
case ${__c} in case ${__c} in
*:*) *:*)
case ${__c} in case ${__c} in
$(uname -m):*) ${ARCH}:*)
__arch_match=1 __arch_match=1
__c=${__c##*:} __c=${__c##*:}
;; ;;