From patchwork Tue Nov 26 14:22:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 101915 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 827133858C50 for ; Tue, 26 Nov 2024 14:22:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 827133858C50 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xkGdl7Fp; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=tkMeyJwl; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xkGdl7Fp; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=tkMeyJwl X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id A5AB33858D33 for ; Tue, 26 Nov 2024 14:21:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A5AB33858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A5AB33858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732630887; cv=none; b=Ll/MlmEZiyfCw1T/MoQfjj08h9sDSqkV1/G7BPv/fD6PMEQ7Is3C7/QJuqcs+bnMjRA2nekO3ja2pc8cSE4aC74fGWSSTzKYmJPItn9rfKfcX3xhtp466BdpbXADnyhoXYYwCT6CD39FpWDKVNJ8CQ2wzDe1K2mLKGYDgDMXgZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732630887; c=relaxed/simple; bh=AVMFpZbuINOohd2r+Cyk3pPJS9lR7jyzaTRKEY/pJMY=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=WKlyEfSOCtgnkRQmq8+hqaGIRUxilpXR1hl2xTQZEuJKaztyHwYks9A3r1LA+AWLMLTM8fb+n8z5L3dKlvW1GDfSiz00aVAdGUSp35YtOP0RmHpgo1CXzJArLek1vMwmVdHcBc3XVT26CDc3hVM7JaFkfoTtBQD51WI/r9e4sTU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A5AB33858D33 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9D6012116E for ; Tue, 26 Nov 2024 14:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1732630886; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=eOrxxULLfLbzJAhReHpVnTyzZfY/+iBOfzcbBBHF9W0=; b=xkGdl7FpG/oeK+NkiOtazregoKghqPrQKM/orgwhDPeB2lma0+qSwUZW7x6GHKVHtJcXMo 7JTJALUQ5Twgh4lFdn2gudKSokKzRqI60yPLRRK7v7sXQ4k6Opju+STDxZv2WVZ+zbD1om 6uCcjy42zovTM0f/BF3B9ufANnnZHAU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1732630886; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=eOrxxULLfLbzJAhReHpVnTyzZfY/+iBOfzcbBBHF9W0=; b=tkMeyJwle8/KLVjaX07PQBUBjR/BW69Sic7g4Mnm3KCZVkVb47dES52sIIuH04pjNu09z2 27jE+L+IV2iCVPCQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xkGdl7Fp; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=tkMeyJwl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1732630886; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=eOrxxULLfLbzJAhReHpVnTyzZfY/+iBOfzcbBBHF9W0=; b=xkGdl7FpG/oeK+NkiOtazregoKghqPrQKM/orgwhDPeB2lma0+qSwUZW7x6GHKVHtJcXMo 7JTJALUQ5Twgh4lFdn2gudKSokKzRqI60yPLRRK7v7sXQ4k6Opju+STDxZv2WVZ+zbD1om 6uCcjy42zovTM0f/BF3B9ufANnnZHAU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1732630886; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=eOrxxULLfLbzJAhReHpVnTyzZfY/+iBOfzcbBBHF9W0=; b=tkMeyJwle8/KLVjaX07PQBUBjR/BW69Sic7g4Mnm3KCZVkVb47dES52sIIuH04pjNu09z2 27jE+L+IV2iCVPCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 86677139AA for ; Tue, 26 Nov 2024 14:21:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id nLBoH2bZRWfTdQAAD6G6ig (envelope-from ) for ; Tue, 26 Nov 2024 14:21:26 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH] [gdb/syscalls] Generate aarch64-linux.xml.in in update-linux-from-src.sh Date: Tue, 26 Nov 2024 15:22:24 +0100 Message-Id: <20241126142224.2399-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Rspamd-Queue-Id: 9D6012116E X-Spam-Level: X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_NONE(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; ASN(0.00)[asn:25478, ipnet:::/0, country:RU]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim, suse.de:mid, imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -3.01 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org Currently aarch64-linux.xml.in is skipped by update-linux-from-src.sh: ... $ ./update-linux-from-src.sh ~/upstream/linux-stable.git/ Skipping aarch64-linux.xml.in, no syscall.tbl ... $ ... and instead we use update-linux.sh. This works fine, but requires an aarch64 system with recent system headers, which makes it harder to pick up the latest changes in the linux kernel. Fix this by updating ./update-linux-from-src.sh to: - build the linux kernel headers for aarch64 - use update-linux.sh with those headers to generate aarch64-linux.xml.in. Regenerating aarch64-linux.xml.in using current trunk of linux-stable gives me these changes: ... + + + + ... which are the same changes I see for the other architectures. Note that the first step, building the linux kernel headers is a cross build and should work on any architecture. But the second step, update-linux.sh uses plain gcc rather than a cross-gcc, so there is scope for problems, but we seem to get away with this on x86_64-linux. So, while we could constrain this to only generate aarch64-linux.xml.in on aarch64-linux, I'm leaving this unconstrained. For aarch64-linux.xml.in, this doesn't matter much to me because I got an aarch64-linux system. But I don't have a longaarch system, and the same approach seems to work there. I'm leaving this for follow-up patch though. Tested on aarch64-linux and x86_64-linux. Verified with shellcheck. --- gdb/syscalls/update-linux-from-src.sh | 50 ++++++++++++++++++++++++++- gdb/syscalls/update-linux.sh | 2 +- 2 files changed, 50 insertions(+), 2 deletions(-) base-commit: dfc65d0579444ec020b309637654cbe17cb9dc60 diff --git a/gdb/syscalls/update-linux-from-src.sh b/gdb/syscalls/update-linux-from-src.sh index d07cbbd9b44..35d78995eaa 100755 --- a/gdb/syscalls/update-linux-from-src.sh +++ b/gdb/syscalls/update-linux-from-src.sh @@ -20,6 +20,8 @@ # Used to generate .xml.in files, like so: # $ ./update-linux-from-src.sh ~/linux-stable.git +pwd=$(pwd -P) + parse_args () { if [ $# -lt 1 ]; then @@ -36,6 +38,51 @@ parse_args () fi } +gen_from_kernel_headers () +{ + local f + f="$1" + local arch + arch="$2" + + echo "Generating $f" + + local tmpdir + tmpdir=$(mktemp -d) + trap 'rm -Rf $tmpdir/*' EXIT + + local build + build="$tmpdir"/build + local install + install="$tmpdir"/install + local usr + usr="$install"/usr + local include + include="$usr"/include + + mkdir -p "$build" "$usr" + + ( + cd "$build" || exit 1 + + make \ + -f "$d"/Makefile \ + ARCH="$arch" \ + INSTALL_HDR_PATH="$usr" \ + headers_install \ + > "$build"/header_install.log \ + 2>&1 + + "$pwd"/update-linux.sh \ + "$pwd"/"$f" \ + -nostdinc \ + -isystem "$include" + ) + + trap '' EXIT + rm -Rf "$tmpdir" +} + pre () { local f @@ -274,7 +321,8 @@ regen () return ;; aarch64-linux.xml.in) - echo "Skipping $f, no syscall.tbl" + # No syscall.tbl. + gen_from_kernel_headers "$f" arm64 return ;; arm-linux.xml.in) diff --git a/gdb/syscalls/update-linux.sh b/gdb/syscalls/update-linux.sh index 066572cbec9..127d92192d1 100755 --- a/gdb/syscalls/update-linux.sh +++ b/gdb/syscalls/update-linux.sh @@ -67,7 +67,7 @@ EOF echo '' - echo '#include ' \ + echo '#include ' \ | gcc -E - -dD "$@" \ | grep -E '#define __NR_' \ | while read -r line; do