Re: [PATCH] clang compatibility: use p2align

Volodymyr Turanskyy <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <DB4PR08MB81526D9B57995F052A97610EE0E72@DB4PR08MB8152.eurprd08.prod.outlook.com>
Hi,

Please see attached re-formatted patch file.

Sincerely,

Volodymyr Turanskyy | Principal Software Engineer | CE SW LLVM Team

From: Joel Sherrill <[email protected]>
Date: Monday, 20 January 2025 at 14:58
To: Volodymyr Turanskyy <[email protected]>
Cc: [email protected] <[email protected]>, nd <[email protected]>
Subject: Re: [PATCH] clang compatibility: use p2align
The patch looks ok but it does not have a commit message.  git format-patch should do the trick.

I have a meeting in 2 minutes and can't look at the other two right now.

--joel

On Mon, Jan 20, 2025 at 8:49 AM Volodymyr Turanskyy <[email protected]<mailto:[email protected]>> wrote:
Hi,

Following up on the RFC [1], please find attached a patch that uses p2aling since as per https://www.sourceware.org/binutils/docs/as/ARM-Directives.html GCC .align 0 is a special case that actually means .p2align 2 which is explicit and handled by clang.

References

1.     https://sourceware.org/pipermail/newlib/2025/021452.html


Sincerely,

Volodymyr Turanskyy | Principal Software Engineer | CE SW LLVM Team
0001-Use-.p2align-2-instead-of-.align-0.patch (application/octet-stream, 2.1 KB)
From ae93bcf2c35135205be796cdfdcfbc1e17978acc Mon Sep 17 00:00:00 2001
From: Volodymyr Turanskyy <[email protected]>
Date: Mon, 20 Jan 2025 15:14:34 +0000
Subject: [PATCH] Use .p2align 2 instead of .align 0

This is to improve compatibility with LLVM clang: .align 0 is a special case for GCC that is not handled by clang.

Change-Id: I855939a32294c74813ecce7275a362265dbc3b1a
---
 libgloss/arm/crt0.S        | 2 +-
 libgloss/arm/trap.S        | 2 +-
 newlib/libc/sys/arm/crt0.S | 2 +-
 newlib/libc/sys/arm/trap.S | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
index 9ff0e6323..b9e768007 100644
--- a/libgloss/arm/crt0.S
+++ b/libgloss/arm/crt0.S
@@ -566,7 +566,7 @@ change_back:
 
 	/* For Thumb, constants must be after the code since only 
 	   positive offsets are supported for PC relative addresses.  */
-	.align 0
+	.p2align 2
 .LC0:
 #ifdef ARM_RDI_MONITOR
 	.word	HeapBase
diff --git a/libgloss/arm/trap.S b/libgloss/arm/trap.S
index 845ad0173..2056c2adf 100644
--- a/libgloss/arm/trap.S
+++ b/libgloss/arm/trap.S
@@ -5,7 +5,7 @@
 
 /* .text is used instead of .section .text so it works with arm-aout too.  */
 	.text
-        .align 0
+        .p2align 2
         .global __rt_stkovf_split_big
         .global __rt_stkovf_split_small
 
diff --git a/newlib/libc/sys/arm/crt0.S b/newlib/libc/sys/arm/crt0.S
index dae0f0465..51e86d549 100644
--- a/newlib/libc/sys/arm/crt0.S
+++ b/newlib/libc/sys/arm/crt0.S
@@ -557,7 +557,7 @@ change_back:
 
 	/* For Thumb, constants must be after the code since only 
 	   positive offsets are supported for PC relative addresses.  */
-	.align 0
+	.p2align 2
 .LC0:
 #ifdef ARM_RDI_MONITOR
 	.word	HeapBase
diff --git a/newlib/libc/sys/arm/trap.S b/newlib/libc/sys/arm/trap.S
index 681b3dbe0..8a49f39f3 100644
--- a/newlib/libc/sys/arm/trap.S
+++ b/newlib/libc/sys/arm/trap.S
@@ -4,7 +4,7 @@
 
 /* .text is used instead of .section .text so it works with arm-aout too.  */
 	.text
-        .align 0
+        .p2align 2
         .global __rt_stkovf_split_big
         .global __rt_stkovf_split_small
 
-- 
2.48.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.