aarch64: Add support for indirect branch targets in the function macro

The function macro emits AARCH64_VALID_CALL_TARGET for exported symbols,
marking them as valid destinations for indirect _calls_. Functions that
are reached by indirect _branches_ (i.e. tail-call dispatch chains
where the link register is not set) require AARCH64_VALID_JUMP_TARGET
instead.

This commit adds a "jumpable" parameter to the function macro that, when
set, emits AARCH64_VALID_JUMP_TARGET instead of AARCH64_VALID_CALL_TARGET.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
This commit is contained in:
Ramiro Polla
2026-03-31 17:25:12 +08:00
parent 8b93c94f47
commit af443abe99

View File

@@ -256,7 +256,7 @@ DISABLE_SME2
.popsection
#endif
.macro function name, export=0, align=4
.macro function name, export=0, jumpable=0, align=4
.macro endfunc
ELF .size \name, . - \name
FUNC .endfunc
@@ -269,7 +269,11 @@ FUNC .endfunc
ELF .type EXTERN_ASM\name, %function
FUNC .func EXTERN_ASM\name
EXTERN_ASM\name:
.if \jumpable
AARCH64_VALID_JUMP_TARGET
.else
AARCH64_VALID_CALL_TARGET
.endif
.else
ELF .type \name, %function
FUNC .func \name