From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id PWKBJDLlHGZ9uC8AWB0awg (envelope-from ) for ; Mon, 15 Apr 2024 04:28:34 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=HOTMAIL.DE header.i=@HOTMAIL.DE header.a=rsa-sha256 header.s=selector1 header.b=cA+qjEzk; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6761D1E0C0; Mon, 15 Apr 2024 04:28:34 -0400 (EDT) Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 484C91E092 for ; Mon, 15 Apr 2024 04:28:32 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B79193858CDB for ; Mon, 15 Apr 2024 08:28:31 +0000 (GMT) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01olkn2014.outbound.protection.outlook.com [40.92.64.14]) by sourceware.org (Postfix) with ESMTPS id BA3463858D34 for ; Mon, 15 Apr 2024 08:26:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA3463858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=hotmail.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hotmail.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BA3463858D34 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.92.64.14 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713169596; cv=pass; b=Yut6Ifq/AS8xRlUSnvyK1LUdEqaMPQLwAEutwk0oDJlKBJyhe9Nr3kWdChn8uGdTYpBzPPFlSmPpMDLI7hjZ4x+DNN3/+GEz3uPYQ0y4ThUOiFfVKz/Qe1ui+kFCVm4Duj/QFC2fnjacUzHKQLmzFHb2CJOpByHbmlFcHbYoLXI= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713169596; c=relaxed/simple; bh=2DaAC0wrHJq8NrtZwcA/Z5OvSVXmZyn2fIBs/EVJHdw=; h=DKIM-Signature:Message-ID:Date:Subject:To:From:MIME-Version; b=abd4lX5GTp/iVKIVg1ChT6LT85KKjtfEZrkKmaUfm9hD6JnU1NTk984iI1K4LN4kW9wFrPMkh+8qReSP8vK+qXwIkg/Tb9Bz5g+iGN+2JE90snw0jOSGM19TW/lWKhohhl4fTeD1bpYl1Z+Olat3zRwTn2AFwsBZ/wD8jcmAwig= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IPrOWpcHpFvceCuZK0hiG1B6KyPThS5pjUMMmqsZ5SL/BWV83N24CC1UJeXjuyha/QcmFKzmVCiMDPNHmrEn+G0OcImFd/4muBwvlX61WAWj0K38FMhT/DNNTezXRfyybG3er0hNzo22BWtgi/5HOUq5IJ8YVkeIS5H4RckE0ps0zVgSL6pojNDT+yBlPZp+vaYQ+cHw/S03lnRyLGzXdGq76DJw6JO5B3LoYsj3iKGR4LRS4CrjNmPfid7y4/lLLEq4ifsSpbMLzFcrfzirTTYd1h0tKw00waY/rIQ9QBfcKpYcEGQ6DJ5nNVpaa7VIy3VIjKEk0eiJPqMXx3NK0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RGH6WTo7xZgrt82wf5X1p7INM4vsalxm07XNSPfDsQw=; b=AbqJeR0ZbSs4y7Uihh3XLXFf6HrJcr6moU25GxXzGtWjEU9v0ivHYT1uHS5GQN3cBbpwUR3aY7+XTi7ZDubrLSaaXVW765EidhjqavfxKT530uhk+hEjWXfidJTkdvrrfpJQW9qGdw0ZkxXafa2QZ7EMHP+2spovxVrKIBCPZ+ioMd1tLs5a8qk+jt3NL20bCHKvZepJ87w7P6UR131Llj7jLUodtKppkx0jUSDotPgrk3DTXInD5ofNXQfZUNlnk9Xj7XO1oxy+Ek7E578eKhVxzZqOGqY5Ekt35BZ4KLXWnePQfIGnvkrHo0b+3h3qwic9pabn8hskCRUZactjxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=HOTMAIL.DE; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RGH6WTo7xZgrt82wf5X1p7INM4vsalxm07XNSPfDsQw=; b=cA+qjEzk6O52D4N37fuRkO8AZh2OUzRL04SQTj3+Ni9K7BSaAtlbpsQKIzqNigshtoBq7gVAxnOt9t+SD3WSRRY0DIfydyIRZvCVC1zTq9+HjFqsxcRKRgbulXB79rqLh4BM/Vbuv49NnRJBgqv0oKTeNsm5urn5Yhn9L1sOHsOl/GVEAR9p9lnZjyt9Oqqp76wW4rHgEk8fmvqMD9W0uUZpnOh53rjZDabQ8n6BsIxd+ICF0i5F8Y/c3gYMm3LcZ6gAG4Z3sNLOtz7gBSmxfVybnl6oWrQfrjz7yLDVfuvSnASeBXLjEtBQDRObhB9I8ObINrvPJ8VUds49lJ81YQ== Received: from AS8P193MB1285.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:333::21) by GV1P193MB2419.EURP193.PROD.OUTLOOK.COM (2603:10a6:150:2e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.49; Mon, 15 Apr 2024 08:26:03 +0000 Received: from AS8P193MB1285.EURP193.PROD.OUTLOOK.COM ([fe80::5403:f1ad:efaf:1f71]) by AS8P193MB1285.EURP193.PROD.OUTLOOK.COM ([fe80::5403:f1ad:efaf:1f71%4]) with mapi id 15.20.7452.049; Mon, 15 Apr 2024 08:26:03 +0000 Message-ID: Date: Mon, 15 Apr 2024 10:27:55 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] sim: riscv: Make stack 16-byte aligned To: Andrew Burgess , "gdb-patches@sourceware.org" References: <87bk6e6fdc.fsf@redhat.com> Content-Language: en-US From: Bernd Edlinger In-Reply-To: <87bk6e6fdc.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TMN: [h5Z80frfwU5/zjIgJjvStx+sjxvqV/frXep1N4JT06j/8z0gJV7apnjz4e43gOsP] X-ClientProxiedBy: BE1P281CA0206.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:89::17) To AS8P193MB1285.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:333::21) X-Microsoft-Original-Message-ID: <9e737a0b-24ad-4bd1-acd2-8dc8c80b4f79@hotmail.de> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P193MB1285:EE_|GV1P193MB2419:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d55ce8c-d087-4e0c-da40-08dc5d25b077 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TABgtW4eqQ8Lz5U1uufShbRsJBBFXKEobTgKgRurgDsFgSX44+31ezHd+LzDyvYNjX/JlXD+WgvgXRQZdGyMTmnb+Bznk0mMBl/PEXw8iJgH5oTVHNce5azwhgMhVxbhpxnj1mIoaox4WVQZ5IIm2ppChnzycOtFx0TvpvJ1FnpYWLOqB4FdbIevvfkj8Mn1OYL7oX51/0sNziwuO+ponDLjB/Pr5HH2s8b8FfidvHGgAXx9YNWg2ivJrWd6GVF96nBSXoeHleN61Uzm2xubHRSWScPCoKCkYOEexu5Pdh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bWpP?= =?utf-8?B?U0dlUSsxdFhRMGtqWmwxQ01wWFFkZDdPaFF4MVo0YWpDc2VRRnhPTGdTOFlu?= =?utf-8?B?N2lkb0JyRXY4Um84ekw4d2hReFhXNFRMb29oUVlMNHpyaFNCQ1Y5ZDZmYTE1?= =?utf-8?B?SlJ2MW1ZNTA3OVVQMDZ5RURpL3Z6ck9OU1R0c3VHRkdpcW8wWGFacG43VHZE?= =?utf-8?B?V25UM01vQ00rMFBZcW5pNUlySTVrMUxmcmhIR2xZODVJb1Qxc0dWRTE2by9H?= =?utf-8?Q?AU5jkRvCJI/mos0i9sEZGhQRkVEQHbvN/RTJ+jO?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-80ceb.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 5d55ce8c-d087-4e0c-da40-08dc5d25b077 X-MS-Exchange-CrossTenant-AuthSource: AS8P193MB1285.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2024 08:26:03.8871 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1P193MB2419 X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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+public-inbox=simark.ca@sourceware.org On 4/12/24 12:32, Andrew Burgess wrote: > Bernd Edlinger writes: > >> Various gcc test cases fail due to the stack >> alignment of 16 bytes is expected by gcc, > > And indeed by the RISC-V ABI specification I believe. > >> causing issues mostly with vararg functinos; > > Typo: functions. > >> e.g. >> >> FAIL: gcc.c-torture/execute/nest-align-1.c -O0 execution test >> FAIL: gcc.c-torture/execute/nest-stdar-1.c -O0 execution test >> FAIL: gcc.c-torture/execute/va-arg-12.c -O0 execution test >> FAIL: gcc.c-torture/execute/va-arg-15.c -O0 execution test >> FAIL: gcc.c-torture/execute/va-arg-16.c -O0 execution test >> FAIL: gcc.c-torture/execute/va-arg-17.c -O0 execution test >> FAIL: gcc.c-torture/execute/va-arg-20.c -O0 execution test >> FAIL: gcc.c-torture/execute/va-arg-26.c -O0 execution test >> ... >> --- >> sim/riscv/sim-main.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/sim/riscv/sim-main.c b/sim/riscv/sim-main.c >> index 4e3672505c6..0876d455570 100644 >> --- a/sim/riscv/sim-main.c >> +++ b/sim/riscv/sim-main.c >> @@ -1586,6 +1586,8 @@ initialize_env (SIM_DESC sd, const char * const *argv, const char * const *env) >> sp = sp_flat - ((argc + 1 + envc + 1) * sizeof (address_word)); >> /* Then the argc. */ >> sp -= sizeof (unsigned_word); >> + /* Align to 16 bytes. */ >> + sp &= ~(address_word)15; > > I think you should use 'align_down' from common/sim-bits.h, as: > > /* Align to 16 bytes. */ > sp = align_down (sp, 15); > > Assuming that works then: > > Approved-By: Andrew Burgess > > Thanks, > Andrew > Okay, thanks for the hint about align_down. So I changed that to: sp = align_down (sp, 16); and it worked... Pushed. Thanks Bernd.