xref: /linux/arch/mips/vdso/vdso.lds.S (revision 805185b7c7a1069e407b6f7b3bc98e44d415f484)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2015 Imagination Technologies
4 * Author: Alex Smith <alex.smith@imgtec.com>
5 */
6
7#include <asm/sgidefs.h>
8#include <asm/vdso/vdso.h>
9#include <vdso/datapage.h>
10
11#if _MIPS_SIM == _MIPS_SIM_ABI64
12OUTPUT_FORMAT("elf64-tradlittlemips", "elf64-tradbigmips", "elf64-tradlittlemips")
13#elif _MIPS_SIM == _MIPS_SIM_NABI32
14OUTPUT_FORMAT("elf32-ntradlittlemips", "elf32-ntradbigmips", "elf32-ntradlittlemips")
15#else
16OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips", "elf32-tradlittlemips")
17#endif
18
19OUTPUT_ARCH(mips)
20
21SECTIONS
22{
23	VDSO_VVAR_SYMS
24
25	. = SIZEOF_HEADERS;
26
27	/*
28	 * In order to retain compatibility with older toolchains we provide the
29	 * ABI flags section ourself. Newer assemblers will automatically
30	 * generate .MIPS.abiflags sections so we discard such input sections,
31	 * and then manually define our own section here. genvdso will patch
32	 * this section to have the correct name/type.
33	 */
34	.mips_abiflags	: { *(.mips_abiflags) } 	:text :abiflags
35
36	.reginfo	: { *(.reginfo) }		:text :reginfo
37
38	.hash		: { *(.hash) }			:text
39	.gnu.hash	: { *(.gnu.hash) }
40	.dynsym		: { *(.dynsym) }
41	.dynstr		: { *(.dynstr) }
42	.gnu.version	: { *(.gnu.version) }
43	.gnu.version_d	: { *(.gnu.version_d) }
44	.gnu.version_r	: { *(.gnu.version_r) }
45
46	.note		: { *(.note.*) }		:text :note
47
48	.text		: { *(.text*) }			:text
49	PROVIDE (__etext = .);
50	PROVIDE (_etext = .);
51	PROVIDE (etext = .);
52
53	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text :eh_frame_hdr
54	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
55
56	.dynamic	: { *(.dynamic) }		:text :dynamic
57
58	.rodata		: { *(.rodata*) }		:text
59	.got		: { *(.got) }
60
61	_end = .;
62	PROVIDE(end = .);
63
64	/DISCARD/	: {
65		*(.MIPS.abiflags)
66		*(.gnu.attributes)
67		*(.note.GNU-stack)
68		*(.data .data.* .gnu.linkonce.d.* .sdata*)
69		*(.bss .sbss .dynbss .dynsbss)
70	}
71}
72
73PHDRS
74{
75	/*
76	 * Provide a PT_MIPS_ABIFLAGS header to assign the ABI flags section
77	 * to. We can specify the header type directly here so no modification
78	 * is needed later on.
79	 */
80	abiflags	0x70000003;
81
82	/*
83	 * The ABI flags header must exist directly after the PT_INTERP header,
84	 * so we must explicitly place the PT_MIPS_REGINFO header after it to
85	 * stop the linker putting one in at the start.
86	 */
87	reginfo		0x70000000;
88
89	text		PT_LOAD		FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
90	dynamic		PT_DYNAMIC	FLAGS(4);		/* PF_R */
91	note		PT_NOTE		FLAGS(4);		/* PF_R */
92	eh_frame_hdr	PT_GNU_EH_FRAME;
93}
94
95VERSION
96{
97	LINUX_2.6 {
98#ifdef CONFIG_GENERIC_GETTIMEOFDAY
99	global:
100		__vdso_clock_gettime;
101		__vdso_gettimeofday;
102		__vdso_clock_getres;
103#if _MIPS_SIM != _MIPS_SIM_ABI64
104		__vdso_clock_gettime64;
105		__vdso_clock_getres_time64;
106#endif
107#endif
108	local: *;
109	};
110}
111