summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib64/runtime-offset.S
blob: 6624fdfa15b122464d694f08133a261fd45d6860 (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
28
29
30
31
#include <linux/linkage.h>
#include <asm/assembler.h>

/*
 * The .section directive below intentionally omits "a", since that
 * appears to be the simplest way to force assembler to not generate
 * R_AARCH64_RELATIVE relocation for
 *
 * linkadr:
 *	.quad get_runtime_offset
 *
 * statement below. While having that relocating was relatively
 * harmless with GCC8, builging the code with GCC5 resulted in
 * "linkaddr" being initialized to 0 causing complete boot breakdown
 */
.section ".text_bare_init","x"

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

.align 3
linkadr:
.quad get_runtime_offset
ENDPROC(get_runtime_offset)