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