xref: /linux/arch/loongarch/vdso/vdso.lds.S (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Author: Huacai Chen <chenhuacai@loongson.cn>
4 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
5 */
6#include <asm/page.h>
7#include <generated/asm-offsets.h>
8
9OUTPUT_FORMAT("elf64-loongarch", "elf64-loongarch", "elf64-loongarch")
10
11OUTPUT_ARCH(loongarch)
12
13SECTIONS
14{
15	PROVIDE(_vdso_data = . - __VVAR_PAGES * PAGE_SIZE);
16#ifdef CONFIG_TIME_NS
17	PROVIDE(_timens_data = _vdso_data + PAGE_SIZE);
18#endif
19	PROVIDE(_loongarch_data = _vdso_data + 2 * PAGE_SIZE);
20	. = SIZEOF_HEADERS;
21
22	.hash		: { *(.hash) }			:text
23	.gnu.hash	: { *(.gnu.hash) }
24	.dynsym		: { *(.dynsym) }
25	.dynstr		: { *(.dynstr) }
26	.gnu.version	: { *(.gnu.version) }
27	.gnu.version_d	: { *(.gnu.version_d) }
28	.gnu.version_r	: { *(.gnu.version_r) }
29
30	.note		: { *(.note.*) }		:text :note
31
32	.text		: { *(.text*) }			:text
33	PROVIDE (__etext = .);
34	PROVIDE (_etext = .);
35	PROVIDE (etext = .);
36
37	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text :eh_frame_hdr
38	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
39
40	.dynamic	: { *(.dynamic) }		:text :dynamic
41
42	.rodata		: { *(.rodata*) }		:text
43
44	_end = .;
45	PROVIDE(end = .);
46
47	/DISCARD/	: {
48		*(.gnu.attributes)
49		*(.note.GNU-stack)
50		*(.data .data.* .gnu.linkonce.d.* .sdata*)
51		*(.bss .sbss .dynbss .dynsbss)
52	}
53}
54
55PHDRS
56{
57	text		PT_LOAD		FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
58	dynamic		PT_DYNAMIC	FLAGS(4);		/* PF_R */
59	note		PT_NOTE		FLAGS(4);		/* PF_R */
60	eh_frame_hdr	PT_GNU_EH_FRAME;
61}
62
63VERSION
64{
65	LINUX_5.10 {
66	global:
67		__vdso_getcpu;
68		__vdso_clock_getres;
69		__vdso_clock_gettime;
70		__vdso_gettimeofday;
71		__vdso_getrandom;
72		__vdso_rt_sigreturn;
73	local: *;
74	};
75}
76
77/*
78 * Make the sigreturn code visible to the kernel.
79 */
80VDSO_sigreturn		= __vdso_rt_sigreturn;
81