xref: /openbmc/linux/arch/riscv/kernel/vdso/vdso.lds.S (revision 83554cb9)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2012 Regents of the University of California
4 */
5
6OUTPUT_ARCH(riscv)
7
8SECTIONS
9{
10	. = SIZEOF_HEADERS;
11
12	.hash		: { *(.hash) }			:text
13	.gnu.hash	: { *(.gnu.hash) }
14	.dynsym		: { *(.dynsym) }
15	.dynstr		: { *(.dynstr) }
16	.gnu.version	: { *(.gnu.version) }
17	.gnu.version_d	: { *(.gnu.version_d) }
18	.gnu.version_r	: { *(.gnu.version_r) }
19
20	.note		: { *(.note.*) }		:text	:note
21	.dynamic	: { *(.dynamic) }		:text	:dynamic
22
23	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
24	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
25
26	.rodata		: { *(.rodata .rodata.* .gnu.linkonce.r.*) }
27
28	/*
29	 * This linker script is used both with -r and with -shared.
30	 * For the layouts to match, we need to skip more than enough
31	 * space for the dynamic symbol table, etc. If this amount is
32	 * insufficient, ld -shared will error; simply increase it here.
33	 */
34	. = 0x800;
35	.text		: { *(.text .text.*) }		:text
36
37	.data		: {
38		*(.got.plt) *(.got)
39		*(.data .data.* .gnu.linkonce.d.*)
40		*(.dynbss)
41		*(.bss .bss.* .gnu.linkonce.b.*)
42	}
43}
44
45/*
46 * We must supply the ELF program headers explicitly to get just one
47 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
48 */
49PHDRS
50{
51	text		PT_LOAD		FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
52	dynamic		PT_DYNAMIC	FLAGS(4);		/* PF_R */
53	note		PT_NOTE		FLAGS(4);		/* PF_R */
54	eh_frame_hdr	PT_GNU_EH_FRAME;
55}
56
57/*
58 * This controls what symbols we export from the DSO.
59 */
60VERSION
61{
62	LINUX_4.15 {
63	global:
64		__vdso_rt_sigreturn;
65		__vdso_gettimeofday;
66		__vdso_clock_gettime;
67		__vdso_clock_getres;
68		__vdso_getcpu;
69		__vdso_flush_icache;
70	local: *;
71	};
72}
73