delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2021/11/25/10:25:33

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=20210112;
h=from:to:cc:subject:date:message-id:mime-version
:content-transfer-encoding;
bh=N64K10UqIVQhjbtLKmJjceYXmdgxeHMtXu1Spcq2KDo=;
b=b13LGShyL0GaJRLgw2DafFBnsthZixPClJuAcX9gz0SAdY1v+FkulQHP6ZogXF83CK
SZxWBenWQjqnR6WAraA9SMAFwv7O1sP9ZzqpZv6c+LxhuKuZ9c/mUUqqNkF3QfE1l2hX
ZkoTPYPo/X4QR8tLY5WeMS88YqJcNF8EZ1nm0erwiW3h+ATWMoXy8tkCahhUDhV6Bt2H
0j5jeKQOhgD44FvIgoOK5NR4UKZ2Ai6qFPT9NHOppr3J+fMJlogyXBq3/0Nb59O3UtBR
v5gFaxW+ggz1NyWwZcGaPvCfMgXI8ZFkNGyKK1pHjeANSfOM2nosfdsQ6Oq5n6c8Llae
ItTw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
:content-transfer-encoding;
bh=N64K10UqIVQhjbtLKmJjceYXmdgxeHMtXu1Spcq2KDo=;
b=lxK8NVjjy0AEcml6RM50lsyMfkVPGDqzXVoJ4ctrl6+kLwpOPKG6tHtoDbVqmlBPSE
/StyR4cJ01OUe4V7COUh1ot7COV7DRf5DZoM6uUThmKUvSWOpFfv9RKG9jS4mEYmEVqQ
XBy7Cw9lwQoFDuuUHCLu+WcLxQEi0mhkIpFkPnw5njk/MF1A3JChNXc+XGMJx0z0jPNx
ssMFm5obBkoYYDuO26D0OUeHL89ug6IuXfF0p5+5DfnQuNfNHgYmJj/aOvH0X+aurAuO
IXIcabj1P3Q+Ko5mlzTrhozBwj2eFeacyGMtomxYF0qJDckOSq3zfQYHpjPL8UnNzFH8
feZg==
X-Gm-Message-State: AOAM533Vp1z/BTpzQ30F98A1cyZy5UVgWAgGMnShg4YqQlaPfqOZxZ1Y
i5GpRB7JOM2ORKJkVnrrBnckC92cqf4=
X-Google-Smtp-Source: ABdhPJwmH/vFnynpH5y5YDtw7stJ5lG6SC7tgGTMTtwJLbITxc/SbBoL5iu7RWNIIMWvl2GzKdO9nA==
X-Received: by 2002:a17:907:6d99:: with SMTP id sb25mr34763478ejc.261.1637853922812;
Thu, 25 Nov 2021 07:25:22 -0800 (PST)
From: "J.W. Jagersma (jwjagersma AT gmail DOT com) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
To: djgpp AT delorie DOT com
Cc: "J.W. Jagersma" <jwjagersma AT gmail DOT com>
Subject: [PATCH] increase stack and malloc alignment to 16 bytes
Date: Thu, 25 Nov 2021 16:13:24 +0100
Message-Id: <20211125151322.439824-1-jwjagersma@gmail.com>
X-Mailer: git-send-email 2.33.0
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

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
-- 
2.33.0

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019