xref: /linux/arch/s390/kernel/vdso/vdso.lds.S (revision 7fc2cd2e4b398c57c9cf961cfea05eadbf34c05c)
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 */
85PHDRS
86{
87	text		PT_LOAD FILEHDR PHDRS FLAGS(5);	/* PF_R|PF_X */
88	dynamic		PT_DYNAMIC FLAGS(4);		/* PF_R */
89	note		PT_NOTE FLAGS(4);		/* PF_R */
90	eh_frame_hdr	PT_GNU_EH_FRAME;
91}
92
93/*
94 * This controls what symbols we export from the DSO.
95 */
96VERSION
97{
98	VDSO_VERSION_STRING {
99	global:
100		/*
101		 * Has to be there for the kernel to find
102		 */
103		__kernel_gettimeofday;
104		__kernel_clock_gettime;
105		__kernel_clock_getres;
106		__kernel_getcpu;
107		__kernel_restart_syscall;
108		__kernel_rt_sigreturn;
109		__kernel_sigreturn;
110		__kernel_getrandom;
111	local: *;
112	};
113}
114