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