From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id hCoVMs0NGWY1eCwAWB0awg (envelope-from ) for ; Fri, 12 Apr 2024 06:32:45 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GikF4T8q; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id ADC711E0C0; Fri, 12 Apr 2024 06:32:45 -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 817EA1E092 for ; Fri, 12 Apr 2024 06:32:43 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0883D385841F for ; Fri, 12 Apr 2024 10:32:43 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 506D83858420 for ; Fri, 12 Apr 2024 10:32:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 506D83858420 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 506D83858420 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712917942; cv=none; b=E3TW3AYZQKdP3N6y05qx9Ixu+IwX2/zZD7txRrmjtXPOg+lz9hzY1U8H0VfU+r5YxfjpYNAcYuTxmQRpbAyjnoe66wcPbg6OyJ/ZS3xN8bkYP4WLvqT7h3My9CFO7M+y6fNKHZDwvaA7qx5zQMm1ipIveullSO9NWCQP27+F+Eo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712917942; c=relaxed/simple; bh=vYqP7d6Y9H0lFTLvMuTYc+wCmrW3aC0ctUNPu6Kl8Yg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=plcPYUnyz6egHfQuiHAxMOI8UPtjqM30jyMRtnjNsZmbiQsaUTMYc2uMjDk3d8/+pXryHjzAN/y3QAhPVXnpx80TQLGKHzxGn3/Nk67yKuH4kZfO890tsBwH4vVOVlygRxdtKpVLPud9whsiNjaD/3QLV9WBafDmiiykF9pEAtw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712917940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CxJShewUUFB/GXvkOjBRoRtcx9GweZDjbPaqteo6Rag=; b=GikF4T8qzZWDuxIvNHjZjZEBjBcLDKEZEcWTJ1EwC5FjfUnkCsR2fNEYC6h7qvaNg+TJWU HYYyyrcfrh/x+4ceE3RAOxY4XplhhKvx1BwjhbNcjOLGfKUswwzgH0ZwsSn4IQmFxBrCRp S8EMQNrnfnt1jA/IUEwPn7uMg4UNWLA= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-568-YGIA_C5uNemQ1FvEH747aw-1; Fri, 12 Apr 2024 06:32:18 -0400 X-MC-Unique: YGIA_C5uNemQ1FvEH747aw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-416bf29ef94so4012635e9.2 for ; Fri, 12 Apr 2024 03:32:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712917937; x=1713522737; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CxJShewUUFB/GXvkOjBRoRtcx9GweZDjbPaqteo6Rag=; b=Dpe7Cl24qkshGjrbawHTGeNaOJXD28o9lr6e80AF8Tm0qxkHRd3pMm/vJhh1ybFFrO d6fnRT9NMs5n6+quiLZb4GqKGjgPDuWyOvO2wyVvZvUXJicSPMUYFwRR7V94NMA7jxnU BLrGvlMR0bxlsCt/oXLpf2PCq/BzwcljtD3OHKC0qzkaImvEBNZJiPOjzMFMkyA1TIap 1xXFKSeGHDwsW3gwaUY0JSk5FgEFhi8sHFIzl/DdZTgV/bt0cnjI7ONKvKai/XSBnTZZ U3Pur8c6ZMKWnpWV22heedSRkJ5rdiSbV0D/MuHf8X3HJKEx6km/Ch/Yl5bTrJOAmDue mPQw== X-Forwarded-Encrypted: i=1; AJvYcCWSzWE5KJDMyAdpF3GXDr4/LdmrofGGeS9PRaZhSnqWd9FbG+BDpsTiNdxR9EvArutPCuJaHDnpFovN86CDi5utyzlv7gQYUgs68g== X-Gm-Message-State: AOJu0YyZD7ih6vRC7Kd3MQSeV54WEperNOr5WxEtwjQy/xpGF5em15le HqHQiummyoPQiElGkMspvfRJ13lrkhhoHA2WNLHuMcfke/I+cXaXQXnJMaPvVhBC9QpX7XIHLbL iCKIDWFuRg1EskqvpG5az/XmC1af0QisWFqd+LP1B6qH27Pt8ho4sD9Y0d4g= X-Received: by 2002:a05:600c:154d:b0:416:8d61:7c91 with SMTP id f13-20020a05600c154d00b004168d617c91mr1727354wmg.10.1712917937388; Fri, 12 Apr 2024 03:32:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGGcU1IqcBdRBOXp1oqgdCKpuGWczdq68U3GbBINi4U1Df4gQOwMs5FxxTpRB+Z2eRUymvN1g== X-Received: by 2002:a05:600c:154d:b0:416:8d61:7c91 with SMTP id f13-20020a05600c154d00b004168d617c91mr1727330wmg.10.1712917936765; Fri, 12 Apr 2024 03:32:16 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id e8-20020a5d5308000000b00343daeddcb2sm3932503wrv.45.2024.04.12.03.32.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 03:32:16 -0700 (PDT) From: Andrew Burgess To: Bernd Edlinger , "gdb-patches@sourceware.org" Subject: Re: [PATCH] sim: riscv: Make stack 16-byte aligned In-Reply-To: References: Date: Fri, 12 Apr 2024 11:32:15 +0100 Message-ID: <87bk6e6fdc.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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 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 > > /* Set up the regs the libgloss crt0 expects. */ > riscv_cpu->a0 = argc; > -- > 2.25.1