| Message ID | 20250113202607.3288177-1-keithp@keithp.com |
|---|---|
| Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> 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 1B426385771B for <patchwork@sourceware.org>; Mon, 13 Jan 2025 20:28:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B426385771B Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=keithp.com header.i=@keithp.com header.a=rsa-sha256 header.s=mail header.b=jI8hJq+v; dkim=fail reason="signature verification failed" (2048-bit key) header.d=keithp.com header.i=@keithp.com header.a=rsa-sha256 header.s=mail header.b=YQoy7HLO X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from elaine.keithp.com (home.keithp.com [63.227.221.253]) by sourceware.org (Postfix) with ESMTPS id 93C4E3858D38 for <gcc-patches@gcc.gnu.org>; Mon, 13 Jan 2025 20:26:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 93C4E3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=keithp.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=keithp.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 93C4E3858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=63.227.221.253 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736799972; cv=none; b=lCPZPVkKfTVg/okTrQ6g2NF56aoHFzC2+Bq1NhJ77o9oBuCv4iOzr9HTcr7a5KRVBXGwNmiBGk5xF9imM5jmJHn5gcGXlR2lSD+v8+cVwOIfvrUlahjJjJ6vHw2H4Qa2GBwoMiKbj5kOiPQEMvgGZyKLf/3ovzaKOd1a/S0Uii8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736799972; c=relaxed/simple; bh=Fp4gAKP7zAQ4zB3Qo69YyIvlOmN1yCtvDEWBYUidtw8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=r1hzslJdy5PVrKfADRPWsijhj1thWgBtUkCNdHKhihkMrGuUj+tzZ66jU7NkMQ6VNS9PyLT4OlcWEIlaaAu7hpYGwrgt6eSk915KqaqFd2DvinGCXU/+GBhBCGou7QTx4lW8okrGafrWWq3uzF+NjBbqMp0hRBlgnEYmJArODlo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93C4E3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1736799970; bh=Fp4gAKP7zAQ4zB3Qo69YyIvlOmN1yCtvDEWBYUidtw8=; h=From:To:Cc:Subject:Date:From; b=jI8hJq+vXNqyrmFlCsCQ3/HubAAPcvohEMSgZjWUjC9vX8HPCtCHrtZEl+80muD46 dWNzV3Fjn0B3xxQOktces/SGSRDmNveQ0CtVXZCz54r9IHEttb3zyoBr6HNZOtkZdu 6qq/698ZjS+Vv79XeitFZfAKtzCPaQSHEeNITNtoxO+2ZiZqRu1zchrwhICs+FVx6w XnLRM+GpI+kyJswHEUVOZK1mggcIJ58lkULTe35ETT2QM5U4PEgRdv5w8DEDosVDA2 fe/t/B8eI+ipmEH500Xd+Ea1kKFzXbazziQGBe77f3STHf/fBo0rk02TciHDQUh279 5AlUEESuy6TSA== Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id B8BF13F22AFF for <gcc-patches@gcc.gnu.org>; Mon, 13 Jan 2025 12:26:10 -0800 (PST) X-Virus-Scanned: Debian amavis at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavis, port 10024) with LMTP id FyrmzJmiGboi; Mon, 13 Jan 2025 12:26:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1736799969; bh=Fp4gAKP7zAQ4zB3Qo69YyIvlOmN1yCtvDEWBYUidtw8=; h=From:To:Cc:Subject:Date:From; b=YQoy7HLOAfxGCPVYFIKnsnzXiH9hdiDQzMMY/ti+2OLPp/bKqZQbDsZfcEHTKvyRn SoSGieTkWxqLRMYh9MWpydgULBFyjjqcW0ZYV2cvnJsi5h2a0hGbT6lgGNXg3LsnYJ Xa8opeM1vcnbO78T6pnPyZxVg5LZmYi46uwBuThFm4Kl9FNj961NElZeSnR/XLpjee aAkDttv/iLSFvuQCDAf+uJ0Pyj+vBQgxIOYCWkCfuVpCnTLCUSbMLAFKBf+bAMowEV WiSPo1WYyNRX70GdbJIieDCylkUEVZV7XL8U6JgAiDjw7QPL0cXKR/HO0WzUSY4ZSb Kwm4yO9PCBcvg== Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id EE3013F2060D; Mon, 13 Jan 2025 12:26:09 -0800 (PST) Received: by keithp.com (Postfix, from userid 1000) id 9C8541E6007B; Mon, 13 Jan 2025 12:26:09 -0800 (PST) From: Keith Packard <keithp@keithp.com> To: gcc-patches@gcc.gnu.org Cc: Keith Packard <keithp@keithp.com> Subject: [PATCH 0/4] lm32: varargs patches Date: Mon, 13 Jan 2025 12:08:30 -0800 Message-ID: <20250113202607.3288177-1-keithp@keithp.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
| Series |
lm32: varargs patches
|
|
Message
Keith Packard
Jan. 13, 2025, 8:08 p.m. UTC
In doing picolibc testing for lm32, I discovered that varargs handling had an issue when the set of anonymous arguments spanned register arguments and stack arguments. On lm32, FIRST_PARM_OFFSET is '4', meaning there are four bytes between the stack top and the first non-register parameter. When a varargs function runs, the anonymous parameters in registers get pushed to the stack below this gap. To process the args, this gap needs to be skipped at the right time. This series converts va_list into a struct to add a pointer to the gap and code is added to va_arg to see when an argument spans the gap. While developing this series, I identified a few other related issues which affected this change by comparing the lm32 code to arc, which has a similar implementation for saving the register parameters. Those changes are first in the series with the gap skipping code provided in the final patch.
Comments
On 1/13/25 1:08 PM, Keith Packard wrote: > > In doing picolibc testing for lm32, I discovered that varargs handling > had an issue when the set of anonymous arguments spanned register > arguments and stack arguments. > > On lm32, FIRST_PARM_OFFSET is '4', meaning there are four bytes > between the stack top and the first non-register parameter. When a > varargs function runs, the anonymous parameters in registers get > pushed to the stack below this gap. To process the args, this gap > needs to be skipped at the right time. > > This series converts va_list into a struct to add a pointer to the gap > and code is added to va_arg to see when an argument spans the gap. > > While developing this series, I identified a few other related issues > which affected this change by comparing the lm32 code to arc, which > has a similar implementation for saving the register parameters. Those > changes are first in the series with the gap skipping code provided in > the final patch. Just a couple notes. lm32 is currently scheduled to be deprecated as it hasn't been converted to use LRA instead of reload. Deprecation would happen with the gcc-15 release and removal in gcc-16 if nobody steps forward to do the conversion. The last real change to the lm32 port that wasn't stuff like copyright dates, or other system-wide adjustments was back in 2018, a trivial fix from me. Prior to that 2014. Point being I think it's unlikely anyone will step forward to fix this port. Second, we're in regression bugfixing mode only right now. Essentially all changes should be fixing regressions against prior releases. But given the nature of this change and its narrow potential impact in terms of getting the release made, I'll go ahead and push it through. Thanks, jeff
> lm32 is currently scheduled to be deprecated as it hasn't been converted > to use LRA instead of reload. Deprecation would happen with the gcc-15 > release and removal in gcc-16 if nobody steps forward to do the > conversion. I kinda wondered. Frankly, I treated this adventure as a way to learn more about GCC internals and do a 'real' patch. I have no practical use for LatticeMico32 myself. But, I'm happy to have the fix integrated and provide yet another (even if temporary) target for picolibc testing. Don't treat this as any kind of vote for continued support; I'll be just as happy to see gcc's code base be reduced by one not-terribly-relevant architecture. Deleting code is one of the purest pleasures in software development.
On 1/14/25 11:14 PM, Keith Packard wrote: > >> lm32 is currently scheduled to be deprecated as it hasn't been converted >> to use LRA instead of reload. Deprecation would happen with the gcc-15 >> release and removal in gcc-16 if nobody steps forward to do the >> conversion. > > I kinda wondered. Frankly, I treated this adventure as a way to learn > more about GCC internals and do a 'real' patch. I have no practical use > for LatticeMico32 myself. But, I'm happy to have the fix integrated and > provide yet another (even if temporary) target for picolibc testing. Sounds good. I did something similar with a partial LLVM port for the v850 chip series. Never pushed it far enough to integrate as the whole point was to get a better working knowledge of LLVM backend/target interfaces. > > Don't treat this as any kind of vote for continued support; I'll be just > as happy to see gcc's code base be reduced by one not-terribly-relevant > architecture. Deleting code is one of the purest pleasures in software > development. Yea. For it to be a vote for continued support someone would really need to step in to do that reload->LRA conversion as the plan of record is to rip out the old reload code completely. Those conversions can sometimes be trivially easy and other times mind bending hard. All the trivially easy ones have been done. I wouldn't really expect lm32 to be tough, but surprises happen. If you wanted to get a deeper understanding of how GCC works, that might be a way to do it. Jeff >