xref: /linux/arch/s390/kernel/vdso/vdso.lds.S (revision 3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * This is the infamous ld script for the 64 bits vdso
4 * library
5 */
6
7#include <asm/vdso/vsyscall.h>
8#include <asm/page.h>
9#include <asm/vdso.h>
10#include <asm-generic/vmlinux.lds.h>
11#include <vdso/datapage.h>
12
13OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
14OUTPUT_ARCH(s390:64-bit)
15
16SECTIONS
17{
18	VDSO_VVAR_SYMS
19
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	. = ALIGN(16);
33	.text		: {
34		*(.text .stub .text.* .gnu.linkonce.t.*)
35	} :text
36	PROVIDE(__etext = .);
37	PROVIDE(_etext = .);
38	PROVIDE(etext = .);
39
40	/*
41	 * Other stuff is appended to the text segment:
42	 */
43	.rodata		: { *(.rodata .rodata.* .gnu.linkonce.r.*) }
44	.rodata1	: { *(.rodata1) }
45
46	. = ALIGN(8);
47	.altinstructions	: { *(.altinstructions) }
48	.altinstr_replacement	: { *(.altinstr_replacement) }
49
50	.dynamic	: { *(.dynamic) }		:text	:dynamic
51
52	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
53	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
54	.gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) }
55
56	.rela.dyn ALIGN(8) : { *(.rela.dyn) }
57	.got ALIGN(8)	: { *(.got .toc) }
58	.got.plt ALIGN(8) : { *(.got.plt) }
59
60	_end = .;
61	PROVIDE(end = .);
62
63	STABS_DEBUG
64	DWARF_DEBUG
65	.comment       0 : { *(.comment) }
66	.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
67
68	/DISCARD/	: {
69		*(.note.GNU-stack)
70		*(.branch_lt)
71		*(.data .data.* .gnu.linkonce.d.* .sdata*)
72		*(.bss .sbss .dynbss .dynsbss)
73	}
74}
75
76/*
77 * Very old versions of ld do not recognize this name token; use the constant.
78 */
79#define PT_GNU_EH_FRAME	0x6474e550
80
81/*
82 * We must supply the ELF program headers explicitly to get just one
83 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
84 */
85#define PF_R	FLAGS(4)
86#define PF_RX	FLAGS(5)
87
88PHDRS
89{
90	text		PT_LOAD		PF_RX FILEHDR PHDRS;
91	dynamic		PT_DYNAMIC	PF_R;
92	note		PT_NOTE		PF_R;
93	eh_frame_hdr	PT_GNU_EH_FRAME	PF_R;
94}
95
96/*
97 * This controls what symbols we export from the DSO.
98 */
99VERSION
100{
101	VDSO_VERSION_STRING {
102	global:
103		/*
104		 * Has to be there for the kernel to find
105		 */
106		__kernel_gettimeofday;
107		__kernel_clock_gettime;
108		__kernel_clock_getres;
109		__kernel_getcpu;
110		__kernel_restart_syscall;
111		__kernel_rt_sigreturn;
112		__kernel_sigreturn;
113		__kernel_getrandom;
114	local: *;
115	};
116}
117