xref: /linux/arch/riscv/kernel/vdso/vdso.lds.S (revision 3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2012 Regents of the University of California
4 */
5#include <asm/page.h>
6#include <asm/vdso.h>
7#include <vdso/datapage.h>
8
9OUTPUT_ARCH(riscv)
10
11SECTIONS
12{
13	VDSO_VVAR_SYMS
14
15	. = SIZEOF_HEADERS;
16
17	.hash		: { *(.hash) }			:text
18	.gnu.hash	: { *(.gnu.hash) }
19	.dynsym		: { *(.dynsym) }
20	.dynstr		: { *(.dynstr) }
21	.gnu.version	: { *(.gnu.version) }
22	.gnu.version_d	: { *(.gnu.version_d) }
23	.gnu.version_r	: { *(.gnu.version_r) }
24
25	.dynamic	: { *(.dynamic) }		:text	:dynamic
26
27	.rodata		: {
28		*(.rodata .rodata.* .gnu.linkonce.r.*)
29		*(.got.plt) *(.got)
30		*(.data .data.* .gnu.linkonce.d.*)
31		*(.dynbss)
32		*(.bss .bss.* .gnu.linkonce.b.*)
33	}						:text
34
35	.note		: { *(.note.*) }		:text	:note
36
37	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
38	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
39
40	/*
41	 * Text is well-separated from actual data: there's plenty of
42	 * stuff that isn't used at runtime in between.
43	 */
44	. = ALIGN(16);
45	.text		: { *(.text .text.*) }		:text
46
47	. = ALIGN(4);
48	__vdso_alternatives_start = .;
49	.alternative : {
50		*(.alternative)
51	}
52	__vdso_alternatives_end = .;
53}
54
55/*
56 * We must supply the ELF program headers explicitly to get just one
57 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
58 */
59PHDRS
60{
61	text		PT_LOAD		FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
62	dynamic		PT_DYNAMIC	FLAGS(4);		/* PF_R */
63	note		PT_NOTE		FLAGS(4);		/* PF_R */
64	eh_frame_hdr	PT_GNU_EH_FRAME;
65}
66
67/*
68 * This controls what symbols we export from the DSO.
69 */
70VERSION
71{
72	LINUX_4.15 {
73	global:
74		__vdso_rt_sigreturn;
75#ifdef HAS_VGETTIMEOFDAY
76		__vdso_gettimeofday;
77		__vdso_clock_gettime;
78		__vdso_clock_getres;
79#endif
80		__vdso_getcpu;
81		__vdso_flush_icache;
82#ifndef COMPAT_VDSO
83		__vdso_riscv_hwprobe;
84#endif
85#if defined(CONFIG_VDSO_GETRANDOM) && !defined(COMPAT_VDSO)
86		__vdso_getrandom;
87#endif
88	local: *;
89	};
90}
91