xref: /linux/arch/arm64/kernel/vdso/vdso.lds.S (revision fa79e55d467366a2c52c68a261a0d6ea5f8a6534)
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/vdso/vsyscall.h>
15#include <asm-generic/vmlinux.lds.h>
16#include <vdso/datapage.h>
17
18OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64")
19OUTPUT_ARCH(aarch64)
20
21SECTIONS
22{
23	VDSO_VVAR_SYMS
24
25	. = 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		*(.ARM.attributes)
42	}
43	.note		: { *(.note.*) }		:text	:note
44
45	. = ALIGN(16);
46
47	.text		: { *(.text*) }			:text	=0xd503201f
48	PROVIDE (__etext = .);
49	PROVIDE (_etext = .);
50	PROVIDE (etext = .);
51
52	. = ALIGN(4);
53	.altinstructions : {
54		*(.altinstructions)
55	}
56
57	.dynamic	: { *(.dynamic) }		:text	:dynamic
58
59	.rela.dyn	: ALIGN(8) { *(.rela .rela*) }
60
61	.rodata		: {
62		*(.rodata*)
63		*(.got)
64		*(.got.plt)
65		*(.plt)
66		*(.plt.*)
67		*(.iplt)
68		*(.igot .igot.plt)
69	}						:text
70
71	_end = .;
72	PROVIDE(end = .);
73
74	DWARF_DEBUG
75	ELF_DETAILS
76
77	/DISCARD/	: {
78		*(.data .data.* .gnu.linkonce.d.* .sdata*)
79		*(.bss .sbss .dynbss .dynsbss)
80		*(.eh_frame .eh_frame_hdr)
81	}
82}
83
84/*
85 * We must supply the ELF program headers explicitly to get just one
86 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
87 */
88PHDRS
89{
90	text		PT_LOAD		FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
91	dynamic		PT_DYNAMIC	FLAGS(4);		/* PF_R */
92	note		PT_NOTE		FLAGS(4);		/* PF_R */
93}
94
95/*
96 * This controls what symbols we export from the DSO.
97 */
98VERSION
99{
100	LINUX_2.6.39 {
101	global:
102		__kernel_rt_sigreturn;
103		__kernel_gettimeofday;
104		__kernel_clock_gettime;
105		__kernel_clock_getres;
106		__kernel_getrandom;
107	local: *;
108	};
109}
110
111/*
112 * Make the sigreturn code visible to the kernel.
113 */
114VDSO_sigtramp		= __kernel_rt_sigreturn;
115