xref: /openbmc/linux/arch/arm64/kernel/vdso/vdso.lds.S (revision c7a806d9)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * GNU linker script for the VDSO library.
4*
5 * Copyright (C) 2012 ARM Limited
6 *
7 * Author: Will Deacon <will.deacon@arm.com>
8 * Heavily based on the vDSO linker scripts for other archs.
9 */
10
11#include <linux/const.h>
12#include <asm/page.h>
13#include <asm/vdso.h>
14#include <asm-generic/vmlinux.lds.h>
15
16OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64")
17OUTPUT_ARCH(aarch64)
18
19SECTIONS
20{
21	PROVIDE(_vdso_data = . - __VVAR_PAGES * PAGE_SIZE);
22#ifdef CONFIG_TIME_NS
23	PROVIDE(_timens_data = _vdso_data + PAGE_SIZE);
24#endif
25	. = VDSO_LBASE + SIZEOF_HEADERS;
26
27	.hash		: { *(.hash) }			:text
28	.gnu.hash	: { *(.gnu.hash) }
29	.dynsym		: { *(.dynsym) }
30	.dynstr		: { *(.dynstr) }
31	.gnu.version	: { *(.gnu.version) }
32	.gnu.version_d	: { *(.gnu.version_d) }
33	.gnu.version_r	: { *(.gnu.version_r) }
34
35	/*
36	 * Discard .note.gnu.property sections which are unused and have
37	 * different alignment requirement from vDSO note sections.
38	 */
39	/DISCARD/	: {
40		*(.note.GNU-stack .note.gnu.property)
41	}
42	.note		: { *(.note.*) }		:text	:note
43
44	. = ALIGN(16);
45
46	.text		: { *(.text*) }			:text	=0xd503201f
47	PROVIDE (__etext = .);
48	PROVIDE (_etext = .);
49	PROVIDE (etext = .);
50
51	. = ALIGN(4);
52	.altinstructions : {
53		__alt_instructions = .;
54		*(.altinstructions)
55		__alt_instructions_end = .;
56	}
57
58	.dynamic	: { *(.dynamic) }		:text	:dynamic
59
60	.rela.dyn	: ALIGN(8) { *(.rela .rela*) }
61
62	.rodata		: {
63		*(.rodata*)
64		*(.got)
65		*(.got.plt)
66		*(.plt)
67		*(.plt.*)
68		*(.iplt)
69		*(.igot .igot.plt)
70	}						:text
71
72	_end = .;
73	PROVIDE(end = .);
74
75	DWARF_DEBUG
76	ELF_DETAILS
77
78	/DISCARD/	: {
79		*(.data .data.* .gnu.linkonce.d.* .sdata*)
80		*(.bss .sbss .dynbss .dynsbss)
81		*(.eh_frame .eh_frame_hdr)
82	}
83}
84
85/*
86 * We must supply the ELF program headers explicitly to get just one
87 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
88 */
89PHDRS
90{
91	text		PT_LOAD		FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
92	dynamic		PT_DYNAMIC	FLAGS(4);		/* PF_R */
93	note		PT_NOTE		FLAGS(4);		/* PF_R */
94}
95
96/*
97 * This controls what symbols we export from the DSO.
98 */
99VERSION
100{
101	LINUX_2.6.39 {
102	global:
103		__kernel_rt_sigreturn;
104		__kernel_gettimeofday;
105		__kernel_clock_gettime;
106		__kernel_clock_getres;
107	local: *;
108	};
109}
110
111/*
112 * Make the sigreturn code visible to the kernel.
113 */
114VDSO_sigtramp		= __kernel_rt_sigreturn;
115