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