summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib64/runtime-offset.S
blob: 822e323c142e968f4e0cf2910b83df545b103dad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* SPDX-License-Identifier: GPL-2.0-only */

#include <linux/linkage.h>
#include <asm/assembler.h>

.section ".text_bare_init","ax"

/*
 * Get the offset between the link address and the address
 * we are currently running at.
 */
ENTRY(get_runtime_offset)
	adr x0, _text
	ldr x1, linkadr
	subs x0, x0, x1
	ret

.align 3
linkadr:
/*
 * With older gcc versions (gcc5) function pointers will not be filled
 * into the binary during compile time and instead rely on relocation
 * during runtime. In the binary we'll always have 0x0 here. We deliberately
 * use _text here since that is 0x0 and is correct without relocation.
 */
.quad _text
ENDPROC(get_runtime_offset)