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