From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kTq3GMfVWWFeTgAAWB0awg (envelope-from ) for ; Sun, 03 Oct 2021 12:09:43 -0400 Received: by simark.ca (Postfix, from userid 112) id 52D281EE1A; Sun, 3 Oct 2021 12:09:43 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 390051EDDB for ; Sun, 3 Oct 2021 12:09:42 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A0D3E385701F for ; Sun, 3 Oct 2021 16:09:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0D3E385701F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1633277381; bh=+PGQMaiE4OUHvzjpwN+7vl2fYWhlCDlWvltbNsMBEiE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QbNC++QoTNvF2qAmDyKEpdtnZpUvlzMcqB3Qw6I1/McJ6XoEs8O5nlxI1rOeY9UUo ks0fisWzHnHZNNiQcCGMUzS6iAGBR4MlxHW+/yRKoC0p4eKb35KMbTTY8DJCS1LZQF RxaHD/NVz202Xkbf0FtC86iZgfTeHv6w6HjukWcw= Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 468DA3858D3C for ; Sun, 3 Oct 2021 16:09:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 468DA3858D3C Received: by smtp.gentoo.org (Postfix, from userid 559) id B4130342F20; Sun, 3 Oct 2021 16:09:16 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH] sim: filter out SIGSTKSZ [PR sim/28302] Date: Sun, 3 Oct 2021 12:09:16 -0400 Message-Id: <20211003160916.13080-1-vapier@gentoo.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" We map target signals to host signals so we can propagate signals between the host & simulated worlds. That means we need to know the symbolic names & values of all signals that might be sent. The tools that generate that list use signal.h and include all symbols that start with "SIG" so as to automatically include any new symbols that the C library might add. Unfortunately, this also picks up "SIGSTKSZ" which is not actually a signal itself, but a signal related setting -- it's the size of the stack when a signal is handled. By itself this doesn't super matter as we will never see a signal with that same value (since the range of valid signals tend to be way less than 1024, and the size of the default signal stack will never be that small). But with recent glibc changes that make this into a dynamic value instead of a compile-time constant, some users see build failures when building the sim. As suggested by Adam Sampson, update our scripts to ignore this symbol to simplify everything and avoid the build failure. Bug: https://sourceware.org/PR28302 --- sim/bfin/linux-targ-map.h | 5 +---- sim/common/gennltvals.py | 6 ++++-- sim/common/nltvals.def | 1 - 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sim/bfin/linux-targ-map.h b/sim/bfin/linux-targ-map.h index e9c8c8f273b5..0340ed54764e 100644 --- a/sim/bfin/linux-targ-map.h +++ b/sim/bfin/linux-targ-map.h @@ -30,6 +30,7 @@ echo # XXX: nothing uses this ? echo '#include ' | \ bfin-uclinux-gcc -E -dD -P - | \ +grep -v SIGSTKSZ | \ sed -r -n \ -e '1istatic CB_TARGET_DEFS_MAP cb_linux_signal_map[] = {' \ -e '$i\ \ { 0, -1, -1 }\n};' \ @@ -1987,10 +1988,6 @@ static CB_TARGET_DEFS_MAP cb_linux_signal_map[] = #ifdef SIG_SETMASK # define TARGET_LINUX_SIG_SETMASK 2 { "SIG_SETMASK", SIG_SETMASK, TARGET_LINUX_SIG_SETMASK }, -#endif -#ifdef SIGSTKSZ -# define TARGET_LINUX_SIGSTKSZ 8192 - { "SIGSTKSZ", SIGSTKSZ, TARGET_LINUX_SIGSTKSZ }, #endif { 0, -1, -1 } }; diff --git a/sim/common/gennltvals.py b/sim/common/gennltvals.py index db3ff641d402..955ace343110 100755 --- a/sim/common/gennltvals.py +++ b/sim/common/gennltvals.py @@ -67,6 +67,7 @@ FILE_HEADER = f"""\ def gentvals(output: TextIO, cpp: str, srctype: str, srcdir: Path, headers: Iterable[str], pattern: str, + filter: str = r'^$', target: str = None): """Extract constants from the specified files using a regular expression. @@ -94,12 +95,13 @@ def gentvals(output: TextIO, cpp: str, srctype: str, srcdir: Path, srcfile = ''.join(f'#include <{x}>\n' for x in headers) syms = set() define_pattern = re.compile(r'^#\s*define\s+(' + pattern + ')') + filter_pattern = re.compile(filter) for header in headers: with open(srcdir / header, 'r', encoding='utf-8') as fp: data = fp.read() for line in data.splitlines(): m = define_pattern.match(line) - if m: + if m and not filter_pattern.search(line): syms.add(m.group(1)) for sym in sorted(syms): srcfile += f'#ifdef {sym}\nDEFVAL {{ "{sym}", {sym} }},\n#endif\n' @@ -129,7 +131,7 @@ def gen_common(output: TextIO, newlib: Path, cpp: str): ('errno.h', 'sys/errno.h'), 'E[A-Z0-9]*') gentvals(output, cpp, 'signal', newlib / 'newlib/libc/include', - ('signal.h', 'sys/signal.h'), r'SIG[A-Z0-9]*') + ('signal.h', 'sys/signal.h'), r'SIG[A-Z0-9]*', filter=r'SIGSTKSZ') gentvals(output, cpp, 'open', newlib / 'newlib/libc/include', ('fcntl.h', 'sys/fcntl.h', 'sys/_default_fcntl.h'), r'O_[A-Z0-9]*') diff --git a/sim/common/nltvals.def b/sim/common/nltvals.def index 8ae88397249c..8bc6ae59026d 100644 --- a/sim/common/nltvals.def +++ b/sim/common/nltvals.def @@ -116,7 +116,6 @@ { "SIGPROF", 27 }, { "SIGQUIT", 3 }, { "SIGSEGV", 11 }, - { "SIGSTKSZ", 8192 }, { "SIGSTOP", 17 }, { "SIGSYS", 12 }, { "SIGTERM", 15 }, -- 2.33.0