[PATCH 2/3] aarch64: Fix corrupt GNU_PROPERTY_TYPE (5) size

Sebastian Huber sebastian.huber@embedded-brains.de
Mon Jul 31 06:41:49 GMT 2023


For ELF32 the notes alignment is 4 and not 8.  See also:

https://github.com/ARM-software/optimized-routines/issues/56

https://github.com/ARM-software/optimized-routines/pull/57
---
 newlib/libc/machine/aarch64/asmdefs.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/newlib/libc/machine/aarch64/asmdefs.h b/newlib/libc/machine/aarch64/asmdefs.h
index 069b146f4a..131b95e1fe 100644
--- a/newlib/libc/machine/aarch64/asmdefs.h
+++ b/newlib/libc/machine/aarch64/asmdefs.h
@@ -21,6 +21,19 @@
 #define FEATURE_1_PAC 2
 
 /* Add a NT_GNU_PROPERTY_TYPE_0 note.  */
+#ifdef __ILP32__
+#define GNU_PROPERTY(type, value)	\
+  .section .note.gnu.property, "a";	\
+  .p2align 2;				\
+  .word 4;				\
+  .word 12;				\
+  .word 5;				\
+  .asciz "GNU";				\
+  .word type;				\
+  .word 4;				\
+  .word value;				\
+  .text
+#else
 #define GNU_PROPERTY(type, value)	\
   .section .note.gnu.property, "a";	\
   .p2align 3;				\
@@ -33,6 +46,7 @@
   .word value;				\
   .word 0;				\
   .text
+#endif
 
 /* If set then the GNU Property Note section will be added to
    mark objects to support BTI and PAC-RET.  */
-- 
2.35.3



More information about the Newlib mailing list