mailing list of musl libc
 help / color / mirror / Atom feed
* [musl] [PATCH] Explicitly set .crt{i,n} alignment for ARM targets
@ 2021-05-06 12:32 LemonBoy
  0 siblings, 0 replies; only message in thread
From: LemonBoy @ 2021-05-06 12:32 UTC (permalink / raw)
  To: musl

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
 	push {r0,lr}
 .section .fini
 .global _fini
 .type _fini,%function
+.p2align 2
 	push {r0,lr}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-06 13:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 12:32 [musl] [PATCH] Explicitly set .crt{i,n} alignment for ARM targets LemonBoy

mailing list of musl libc

This inbox may be cloned and mirrored by anyone:

	git clone --mirror

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 musl musl/ \
	public-inbox-index musl

Example config snippet for mirrors.
Newsgroup available over NNTP:

code repositories for the project(s) associated with this inbox:

AGPL code for this site: git clone