xref: /openbmc/linux/arch/arm64/kernel/vdso/vdso.lds.S (revision 7af6fbdd)
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
15OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64")
16OUTPUT_ARCH(aarch64)
17
18SECTIONS
19{
20	PROVIDE(_vdso_data = . - __VVAR_PAGES * PAGE_SIZE);
21#ifdef CONFIG_TIME_NS
22	PROVIDE(_timens_data = _vdso_data + PAGE_SIZE);
23#endif
24	. = VDSO_LBASE + SIZEOF_HEADERS;
25
26	.hash		: { *(.hash) }			:text
27	.gnu.hash	: { *(.gnu.hash) }
28	.dynsym		: { *(.dynsym) }
29	.dynstr		: { *(.dynstr) }
30	.gnu.version	: { *(.gnu.version) }
31	.gnu.version_d	: { *(.gnu.version_d) }
32	.gnu.version_r	: { *(.gnu.version_r) }
33
34	.note		: { *(.note.*) }		:text	:note
35
36	. = ALIGN(16);
37
38	.text		: { *(.text*) }			:text	=0xd503201f
39	PROVIDE (__etext = .);
40	PROVIDE (_etext = .);
41	PROVIDE (etext = .);
42
43	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
44	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
45
46	.dynamic	: { *(.dynamic) }		:text	:dynamic
47
48	.rodata		: { *(.rodata*) }		:text
49
50	_end = .;
51	PROVIDE(end = .);
52
53	/DISCARD/	: {
54		*(.note.GNU-stack)
55		*(.data .data.* .gnu.linkonce.d.* .sdata*)
56		*(.bss .sbss .dynbss .dynsbss)
57	}
58}
59
60/*
61 * We must supply the ELF program headers explicitly to get just one
62 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
63 */
64PHDRS
65{
66	text		PT_LOAD		FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
67	dynamic		PT_DYNAMIC	FLAGS(4);		/* PF_R */
68	note		PT_NOTE		FLAGS(4);		/* PF_R */
69	eh_frame_hdr	PT_GNU_EH_FRAME;
70}
71
72/*
73 * This controls what symbols we export from the DSO.
74 */
75VERSION
76{
77	LINUX_2.6.39 {
78	global:
79		__kernel_rt_sigreturn;
80		__kernel_gettimeofday;
81		__kernel_clock_gettime;
82		__kernel_clock_getres;
83	local: *;
84	};
85}
86
87/*
88 * Make the sigreturn code visible to the kernel.
89 */
90VDSO_sigtramp		= __kernel_rt_sigreturn;
91