Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Date: Thu,  6 May 2021 14:32:22 +0200
From: LemonBoy <thatlemon@...il.com>
To: musl@...ts.openwall.com
Subject: [PATCH] Explicitly set .crt{i,n} alignment for ARM targets

Clang's assembler behaves differently than GNU as in that it doesn't
automatically set the section alignment according to the selected mode
(ARM or Thumb).

The problem is evident when linking together objects with a mixture of
ARM and Thumb code, at link time the .init and .fini sections may end up
at misaligned addresses (the required alignment is 4 as they contain ARM
code) and cause problems at link or run time.
---
 crt/arm/crti.s | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/crt/arm/crti.s b/crt/arm/crti.s
index 18dc1e41..29a59171 100644
--- a/crt/arm/crti.s
+++ b/crt/arm/crti.s
@@ -3,11 +3,13 @@
 .section .init
 .global _init
 .type _init,%function
+.p2align 2
 _init:
 	push {r0,lr}
 
 .section .fini
 .global _fini
 .type _fini,%function
+.p2align 2
 _fini:
 	push {r0,lr}
-- 
2.30.2

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.