X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709055280; x=1709660080; darn=delorie.com; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Yu1HPusJPj+bjDKu8J5kgjdkHc5ZL0JmkEOAO2snYss=; b=lAq7LXsEiR3GZ/eMWqsw3ug5DU9FGjNbVy5MT0/FugFqtWi5Bb78T1CLTY5OXVXsAS 8Oxr9WSnQKcCAupi3CmKP4TVEFQCpYqHKFzv23MPa0X3oNeAGcAfAx/bmcMVrrowVUMX 11/1mWb6489xK87wzYWkb9KbwCmdMOsZ8u0vR5456mojmF21i6/5ArgbXAzV+knYCNS0 urbfvsWOguVk4MzeFnNdHjUMZy5oeRAQ60BcH4DPtL2LEzgEXLfMbii33U/iFb+IBDsj GkAySrPjnkEkFYzHmZ6558TLpoCZjBbF04L6NZHVG64JpDxK8cANwzZoXhH6ydh8ePdV ja+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709055280; x=1709660080; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yu1HPusJPj+bjDKu8J5kgjdkHc5ZL0JmkEOAO2snYss=; b=dwHy8x+0XqTLLNHKkwGB5QQQlvQ2yWaSJIzXNJn1TPR2GV9ewDrpo7XeEJQlOnO37/ vhxmgk6UEdJ8mHxBsLUMzccVThoSkxDqbq0q1/58iSN23K1lFI1+yVfAJ5HvMHKUPKDp pyEMWrMfzDWbyurBUdfnhFRTlVodqLgvtWy8b0LxhnL3v/5Xv6YJd06lYVTnXPX7ls5e yBWhQtckG9KISinGJSHXlRP/Jlt5JpCLPl6n5VtdW1aG8f8yn+GwJEpuUaFUGzVy5iZk qLTvqFPqw7h0Z6Q9fwjwPvYc15tIdKGrLXL0N7nf6DclHw+fDGJgmWXE7c6DHtRBLbwN Qdtg== X-Gm-Message-State: AOJu0Ywx3ns2i9azsT1RHcwxBcVTELIBaQyFVrh0J0+yalhDpBNdKo7k 4ja/SIHTmJFhFFJDl9/kDiIL6qMB1MpwM0RodHftnmnBL20kenrtnICmuC8+oanql3Odr4Psu/C hbG4yNhrXGRAD9iTIgY7xngutElE3R81p X-Google-Smtp-Source: AGHT+IGCf1Ug+UAt49jdZF7y3IM6rYfDWJStgJxHcj2TcPpM6geXrLRJWd97F0hwq7PMsDvqUfpXj/yRPlsshz3BVs8= X-Received: by 2002:a05:600c:524b:b0:412:9dd0:f7e7 with SMTP id fc11-20020a05600c524b00b004129dd0f7e7mr7342390wmb.22.1709055279772; Tue, 27 Feb 2024 09:34:39 -0800 (PST) MIME-Version: 1.0 References: <20211125151322 DOT 439824-1-jwjagersma AT gmail DOT com> In-Reply-To: From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com]" Date: Tue, 27 Feb 2024 20:34:28 +0300 Message-ID: Subject: Re: [PING][PATCH] increase stack and malloc alignment to 16 bytes To: djgpp AT delorie DOT com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 41RHYfhI1027930 Reply-To: djgpp AT delorie DOT com On Thu, Jan 26, 2023 at 12:50 AM J.W. Jagersma (jwjagersma AT gmail DOT com) [via djgpp AT delorie DOT com] wrote: > > Pinging another patch that I think is important, particularly for -msse users. > > Note that gcc / libstdc++ also expect 16-byte alignment, as evidenced by > alignof(std::max_align_t) == 16, the macro __STDCPP_DEFAULT_NEW_ALIGNMENT__ > (defined to 16), and the fact that it always bumps the stack pointer by > multiples of 16. > > > On 2021-11-25 16:13, J.W. Jagersma wrote: > > The section alignment patch I posted here earlier has been accepted in binutils, > > so that will be available in the next release. > > > > Now in libc only these two lines need to be adjusted, and then all code, data, > > stack and heap will be aligned to 16 byte boundaries. > > > > Should be good for SSE, hopefully it will help resolve the gcc 11 Ada issue too. > > > > --- > > src/libc/ansi/stdlib/nmalcdef.h | 2 +- > > src/libc/crt0/crt0.S | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/src/libc/ansi/stdlib/nmalcdef.h b/src/libc/ansi/stdlib/nmalcdef.h > > index cb41f619..495c63a6 100644 > > --- a/src/libc/ansi/stdlib/nmalcdef.h > > +++ b/src/libc/ansi/stdlib/nmalcdef.h > > @@ -188,7 +188,7 @@ typedef struct memblock { > > /* conversion and access macros */ > > #define MEMBLKp(p) (memblockp)((byte*)(p) - DATAOFFSET) > > #define PTR(m) (void*)((byte*)(m) + DATAOFFSET) > > -#define ALIGN 8 > > +#define ALIGN 16 > > > > #define ALIGNMASK (ALIGN-1) > > > > diff --git a/src/libc/crt0/crt0.S b/src/libc/crt0/crt0.S > > index 446a989b..226f0cb9 100644 > > --- a/src/libc/crt0/crt0.S > > +++ b/src/libc/crt0/crt0.S > > @@ -315,7 +315,7 @@ use_stubinfo_stack_size: > > addl __stklen, %eax > > movw %ds, %dx /* set stack */ > > movw %dx, %ss > > - andb $0xf8, %al /* align to 8-byte boundary */ > > + andb $0xf0, %al /* align to 16-byte boundary */ > > movl %eax, %esp > > movl %eax, ___djgpp_stack_top /* Top of stack */ > > subl ___djgpp_stack_limit, %eax > PING? Has anyone reviewed this?