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	}
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	.alternative : {
49		*(.alternative)
50	}
51}
52
53/*
54 * We must supply the ELF program headers explicitly to get just one
55 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
56 */
57PHDRS
58{
59	text		PT_LOAD		FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
60	dynamic		PT_DYNAMIC	FLAGS(4);		/* PF_R */
61	note		PT_NOTE		FLAGS(4);		/* PF_R */
62	eh_frame_hdr	PT_GNU_EH_FRAME;
63}
64
65/*
66 * This controls what symbols we export from the DSO.
67 */
68VERSION
69{
70	LINUX_4.15 {
71	global:
72		__vdso_rt_sigreturn;
73#ifdef HAS_VGETTIMEOFDAY
74		__vdso_gettimeofday;
75		__vdso_clock_gettime;
76		__vdso_clock_getres;
77#endif
78		__vdso_getcpu;
79		__vdso_flush_icache;
80#ifndef COMPAT_VDSO
81		__vdso_riscv_hwprobe;
82#endif
83	local: *;
84	};
85}
86