GNU Linux-libre 5.15.72-gnu
[releases.git] / arch / powerpc / kernel / vdso32 / vdso32.lds.S
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * This is the infamous ld script for the 32 bits vdso
4  * library
5  */
6 #include <asm/vdso.h>
7 #include <asm/page.h>
8 #include <asm-generic/vmlinux.lds.h>
9
10 #ifdef __LITTLE_ENDIAN__
11 OUTPUT_FORMAT("elf32-powerpcle", "elf32-powerpcle", "elf32-powerpcle")
12 #else
13 OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
14 #endif
15 OUTPUT_ARCH(powerpc:common)
16 ENTRY(_start)
17
18 SECTIONS
19 {
20         PROVIDE(_vdso_datapage = . - 2 * PAGE_SIZE);
21         . = SIZEOF_HEADERS;
22
23         .hash           : { *(.hash) }                  :text
24         .gnu.hash       : { *(.gnu.hash) }
25         .dynsym         : { *(.dynsym) }
26         .dynstr         : { *(.dynstr) }
27         .gnu.version    : { *(.gnu.version) }
28         .gnu.version_d  : { *(.gnu.version_d) }
29         .gnu.version_r  : { *(.gnu.version_r) }
30
31         .note           : { *(.note.*) }                :text   :note
32
33         . = ALIGN(16);
34         .text           : {
35                 *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*)
36         }                                               :text
37         PROVIDE(__etext = .);
38         PROVIDE(_etext = .);
39         PROVIDE(etext = .);
40
41         . = ALIGN(8);
42         VDSO_ftr_fixup_start = .;
43         __ftr_fixup     : { *(__ftr_fixup) }
44         VDSO_ftr_fixup_end = .;
45
46         . = ALIGN(8);
47         VDSO_mmu_ftr_fixup_start = .;
48         __mmu_ftr_fixup : { *(__mmu_ftr_fixup) }
49         VDSO_mmu_ftr_fixup_end = .;
50
51         . = ALIGN(8);
52         VDSO_lwsync_fixup_start = .;
53         __lwsync_fixup  : { *(__lwsync_fixup) }
54         VDSO_lwsync_fixup_end = .;
55
56 #ifdef CONFIG_PPC64
57         . = ALIGN(8);
58         VDSO_fw_ftr_fixup_start = .;
59         __fw_ftr_fixup  : { *(__fw_ftr_fixup) }
60         VDSO_fw_ftr_fixup_end = .;
61 #endif
62
63         /*
64          * Other stuff is appended to the text segment:
65          */
66         .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
67         .rodata1        : { *(.rodata1) }
68
69         .eh_frame_hdr   : { *(.eh_frame_hdr) }          :text   :eh_frame_hdr
70         .eh_frame       : { KEEP (*(.eh_frame)) }       :text
71         .gcc_except_table : { *(.gcc_except_table) }
72         .fixup          : { *(.fixup) }
73
74         .dynamic        : { *(.dynamic) }               :text   :dynamic
75         .got            : { *(.got) }                   :text
76         .plt            : { *(.plt) }
77
78         _end = .;
79         __end = .;
80         PROVIDE(end = .);
81
82         STABS_DEBUG
83         DWARF_DEBUG
84         ELF_DETAILS
85
86         /DISCARD/       : {
87                 *(.note.GNU-stack)
88                 *(.data .data.* .gnu.linkonce.d.* .sdata*)
89                 *(.bss .sbss .dynbss .dynsbss)
90                 *(.got1)
91         }
92 }
93
94 /*
95  * Very old versions of ld do not recognize this name token; use the constant.
96  */
97 #define PT_GNU_EH_FRAME 0x6474e550
98
99 /*
100  * We must supply the ELF program headers explicitly to get just one
101  * PT_LOAD segment, and set the flags explicitly to make segments read-only.
102  */
103 PHDRS
104 {
105         text            PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
106         dynamic         PT_DYNAMIC FLAGS(4);            /* PF_R */
107         note            PT_NOTE FLAGS(4);               /* PF_R */
108         eh_frame_hdr    PT_GNU_EH_FRAME;
109 }
110
111 /*
112  * This controls what symbols we export from the DSO.
113  */
114 VERSION
115 {
116         VDSO_VERSION_STRING {
117         global:
118                 __kernel_get_syscall_map;
119                 __kernel_gettimeofday;
120                 __kernel_clock_gettime;
121                 __kernel_clock_gettime64;
122                 __kernel_clock_getres;
123                 __kernel_time;
124                 __kernel_get_tbfreq;
125                 __kernel_sync_dicache;
126                 __kernel_sigtramp32;
127                 __kernel_sigtramp_rt32;
128 #if defined(CONFIG_PPC64) || !defined(CONFIG_SMP)
129                 __kernel_getcpu;
130 #endif
131
132         local: *;
133         };
134 }
135
136 /*
137  * Make the sigreturn code visible to the kernel.
138  */
139 VDSO_sigtramp32         = __kernel_sigtramp32;
140 VDSO_sigtramp_rt32      = __kernel_sigtramp_rt32;