Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp265250pxv; Thu, 8 Jul 2021 01:58:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcEUN3kZ1gnu6VAqtUgAIDC27ubPosmErewUUwe4N7otWqOrvCumvh8fZnUYVcN0VON3Vu X-Received: by 2002:a05:6402:88b:: with SMTP id e11mr36811052edy.21.1625734715699; Thu, 08 Jul 2021 01:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625734715; cv=none; d=google.com; s=arc-20160816; b=LNz65rSsUFBi4YWcoCSLc2bYi7f5n3NrILMD1hpzC4EDoZRsEoDFvttss4zN+dJU+f S7/BaB5w46S/RLhmJqc7KlJCrYf4aByzgDP2a14oP/qIkQ+NFyPiNuSZn0KpRmv1wxQq 0Xe5NEiYMUl14hliiv/2Gu2ZyycoLFO3FqMKGBGuP2PkoKncLrPNrW5kKh9JrffdC/ir chDcaR8vvL6kCIKrtqQixJmy0URclDLkq8DaUe+73r705kJUDr1+08WQ71p7kjk/yF7I 8LxeN1kKVko9KinDHqdGtRSotdWKcHAzDft6Tg+QVby0GRUlm+ew1wtb+ZiSt5A+2hrw jP6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XmOoR1X1Fqcmv/RQsq1gQvAxnzNyfmu3YnhqcJqI6Ng=; b=TspHzDPZapvTNtuoVj4VccYCyc8Nf0tj2RjvdiHoHlcRdbyhh3YQobNL3SpF/PumfQ 0qZr85WkWov22bxsA43c5Pm2BCT6QdRJWjwup35VxvodDispOHNygwYhnToaUpJaVDC9 xXymvbCXnz2xjvPMZiWfV7FnduzXFcbRoabrkAmWlRqNezl62j/+0A06NtbiePL3sEtr VG6BmM2yvfvSxkSo7kvz5VB7FMjndtQdDnTAFfPnRdUb8QZYAuXkRS2fepFnQtHP1AmG CcLPW8bASAK+BXkXXRepCZMJqQ5Otkyvqimr4U2DfnWZHD3Bw5PPBaOuVORjIqgBoXSc hukA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b=XBljJ7RN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 5si2240775ejh.535.2021.07.08.01.58.12; Thu, 08 Jul 2021 01:58:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b=XBljJ7RN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231234AbhGHJAC (ORCPT + 99 others); Thu, 8 Jul 2021 05:00:02 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([81.169.146.170]:11908 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231185AbhGHJAC (ORCPT ); Thu, 8 Jul 2021 05:00:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1625734632; s=strato-dkim-0002; d=goldelico.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=XmOoR1X1Fqcmv/RQsq1gQvAxnzNyfmu3YnhqcJqI6Ng=; b=XBljJ7RNGBTlnVb6cHgJ95X7N4wKFz9hMllELD9VWSUBdHFzTSw5z3O6VjxBkQBcCX Cu2dQv0duQdoG3VLpBKAaHkgJgMvMKK8g25k0X8alsuyU68JJJxLhcTncjp4z+w0jgAe gDsPFX8n3GOiKfVVxxwzDfD/mgi+/06x+3l/QaWr8DFsXMIILHiuBTvEqZgpZl7SRwGj pLWERKWm5Jzoj23x9ZDfBhZ3eJvGZra8hUxxDJVcswuuGSFkK5Uig98tNjBHMuMwihmD 7OqP4frMUyK3z46niOGcSIYWTXS+JCJcR5Sbi8xxUlN3ciqbhs7pTn9ctStKdd0iMNXF qszg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMhflhwDubTJ9o1KHeBQyh+ITDDtsZQ==" X-RZG-CLASS-ID: mo00 Received: from iMac.fritz.box by smtp.strato.de (RZmta 47.28.1 DYNA|AUTH) with ESMTPSA id h06665x688vCcEC (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 8 Jul 2021 10:57:12 +0200 (CEST) From: "H. Nikolaus Schaller" To: Thomas Bogendoerfer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Jessica Yu , Miroslav Benes , Emil Velikov , Nick Desaulniers Cc: letux-kernel@openphoenux.org, "H. Peter Anvin" , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pyra-handheld.com, "H. Nikolaus Schaller" Subject: [PATCH 1/2] x86/tools/relocs: Fix non-POSIX regexp Date: Thu, 8 Jul 2021 10:57:09 +0200 Message-Id: <81c6de380d932bfb94d96fb70459dd47afd6ed5d.1625734629.git.hns@goldelico.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Trying to run a cross-compiled x86 relocs tool on a BSD based HOSTCC leads to errors like VOFFSET arch/x86/boot/compressed/../voffset.h - due to: vmlinux CC arch/x86/boot/compressed/misc.o - due to: arch/x86/boot/compressed/../voffset.h OBJCOPY arch/x86/boot/compressed/vmlinux.bin - due to: vmlinux RELOCS arch/x86/boot/compressed/vmlinux.relocs - due to: vmlinux empty (sub)expressionarch/x86/boot/compressed/Makefile:118: recipe for target 'arch/x86/boot/compressed/vmlinux.relocs' failed make[3]: *** [arch/x86/boot/compressed/vmlinux.relocs] Error 1 It turns out that relocs.c uses patterns like "something(|_end)" This is not valid syntax or gives undefined results according to POSIX 9.5.3 ERE Grammar https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html It seems to be silently accepted by the Linux regexp() implementation while a BSD host complains. Such patterns can be replaced by a transformation like "(|p1|p2)" -> "(p1|p2)?" Fixes: fd952815307f ("x86-32, relocs: Whitelist more symbols for ld bug workaround") Signed-off-by: H. Nikolaus Schaller --- arch/x86/tools/relocs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c index 04c5a44b96827..9ba700dc47de4 100644 --- a/arch/x86/tools/relocs.c +++ b/arch/x86/tools/relocs.c @@ -57,12 +57,12 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = { [S_REL] = "^(__init_(begin|end)|" "__x86_cpu_dev_(start|end)|" - "(__parainstructions|__alt_instructions)(|_end)|" - "(__iommu_table|__apicdrivers|__smp_locks)(|_end)|" + "(__parainstructions|__alt_instructions)(_end)?|" + "(__iommu_table|__apicdrivers|__smp_locks)(_end)?|" "__(start|end)_pci_.*|" "__(start|end)_builtin_fw|" - "__(start|stop)___ksymtab(|_gpl)|" - "__(start|stop)___kcrctab(|_gpl)|" + "__(start|stop)___ksymtab(_gpl)?|" + "__(start|stop)___kcrctab(_gpl)?|" "__(start|stop)___param|" "__(start|stop)___modver|" "__(start|stop)___bug_table|" -- 2.31.1