Linux 6.7-rc7
[linux-modified.git] / arch / arm64 / kernel / vdso / vdso.lds.S
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * GNU linker script for the VDSO library.
4 *
5  * Copyright (C) 2012 ARM Limited
6  *
7  * Author: Will Deacon <will.deacon@arm.com>
8  * Heavily based on the vDSO linker scripts for other archs.
9  */
10
11 #include <linux/const.h>
12 #include <asm/page.h>
13 #include <asm/vdso.h>
14 #include <asm-generic/vmlinux.lds.h>
15
16 OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64")
17 OUTPUT_ARCH(aarch64)
18
19 SECTIONS
20 {
21         PROVIDE(_vdso_data = . - __VVAR_PAGES * PAGE_SIZE);
22 #ifdef CONFIG_TIME_NS
23         PROVIDE(_timens_data = _vdso_data + PAGE_SIZE);
24 #endif
25         . = VDSO_LBASE + SIZEOF_HEADERS;
26
27         .hash           : { *(.hash) }                  :text
28         .gnu.hash       : { *(.gnu.hash) }
29         .dynsym         : { *(.dynsym) }
30         .dynstr         : { *(.dynstr) }
31         .gnu.version    : { *(.gnu.version) }
32         .gnu.version_d  : { *(.gnu.version_d) }
33         .gnu.version_r  : { *(.gnu.version_r) }
34
35         /*
36          * Discard .note.gnu.property sections which are unused and have
37          * different alignment requirement from vDSO note sections.
38          */
39         /DISCARD/       : {
40                 *(.note.GNU-stack .note.gnu.property)
41         }
42         .note           : { *(.note.*) }                :text   :note
43
44         . = ALIGN(16);
45
46         .text           : { *(.text*) }                 :text   =0xd503201f
47         PROVIDE (__etext = .);
48         PROVIDE (_etext = .);
49         PROVIDE (etext = .);
50
51         . = ALIGN(4);
52         .altinstructions : {
53                 *(.altinstructions)
54         }
55
56         .dynamic        : { *(.dynamic) }               :text   :dynamic
57
58         .rela.dyn       : ALIGN(8) { *(.rela .rela*) }
59
60         .rodata         : {
61                 *(.rodata*)
62                 *(.got)
63                 *(.got.plt)
64                 *(.plt)
65                 *(.plt.*)
66                 *(.iplt)
67                 *(.igot .igot.plt)
68         }                                               :text
69
70         _end = .;
71         PROVIDE(end = .);
72
73         DWARF_DEBUG
74         ELF_DETAILS
75
76         /DISCARD/       : {
77                 *(.data .data.* .gnu.linkonce.d.* .sdata*)
78                 *(.bss .sbss .dynbss .dynsbss)
79                 *(.eh_frame .eh_frame_hdr)
80         }
81 }
82
83 /*
84  * We must supply the ELF program headers explicitly to get just one
85  * PT_LOAD segment, and set the flags explicitly to make segments read-only.
86  */
87 PHDRS
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 }
93
94 /*
95  * This controls what symbols we export from the DSO.
96  */
97 VERSION
98 {
99         LINUX_2.6.39 {
100         global:
101                 __kernel_rt_sigreturn;
102                 __kernel_gettimeofday;
103                 __kernel_clock_gettime;
104                 __kernel_clock_getres;
105         local: *;
106         };
107 }
108
109 /*
110  * Make the sigreturn code visible to the kernel.
111  */
112 VDSO_sigtramp           = __kernel_rt_sigreturn;