4e3a8d4ee6140c4a1785e1f1f5bd995d2c4aadcc
[linux-2.6-microblaze.git] / arch / powerpc / kernel / vdso64 / vdso64.lds.S
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * This is the infamous ld script for the 64 bits vdso
4  * library
5  */
6 #include <asm/vdso.h>
7
8 #ifdef __LITTLE_ENDIAN__
9 OUTPUT_FORMAT("elf64-powerpcle", "elf64-powerpcle", "elf64-powerpcle")
10 #else
11 OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc", "elf64-powerpc")
12 #endif
13 OUTPUT_ARCH(powerpc:common64)
14 ENTRY(_start)
15
16 SECTIONS
17 {
18         . = VDSO64_LBASE + SIZEOF_HEADERS;
19
20         .hash           : { *(.hash) }                  :text
21         .gnu.hash       : { *(.gnu.hash) }
22         .dynsym         : { *(.dynsym) }
23         .dynstr         : { *(.dynstr) }
24         .gnu.version    : { *(.gnu.version) }
25         .gnu.version_d  : { *(.gnu.version_d) }
26         .gnu.version_r  : { *(.gnu.version_r) }
27
28         .note           : { *(.note.*) }                :text   :note
29
30         . = ALIGN(16);
31         .text           : {
32                 *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*)
33                 *(.sfpr)
34         }                                               :text
35         PROVIDE(__etext = .);
36         PROVIDE(_etext = .);
37         PROVIDE(etext = .);
38
39         . = ALIGN(8);
40         __ftr_fixup     : { *(__ftr_fixup) }
41
42         . = ALIGN(8);
43         __mmu_ftr_fixup : { *(__mmu_ftr_fixup) }
44
45         . = ALIGN(8);
46         __lwsync_fixup  : { *(__lwsync_fixup) }
47
48         . = ALIGN(8);
49         __fw_ftr_fixup  : { *(__fw_ftr_fixup) }
50
51         /*
52          * Other stuff is appended to the text segment:
53          */
54         .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
55         .rodata1        : { *(.rodata1) }
56
57         .dynamic        : { *(.dynamic) }               :text   :dynamic
58
59         .eh_frame_hdr   : { *(.eh_frame_hdr) }          :text   :eh_frame_hdr
60         .eh_frame       : { KEEP (*(.eh_frame)) }       :text
61         .gcc_except_table : { *(.gcc_except_table) }
62         .rela.dyn ALIGN(8) : { *(.rela.dyn) }
63
64         .opd ALIGN(8)   : { KEEP (*(.opd)) }
65         .got ALIGN(8)   : { *(.got .toc) }
66
67         _end = .;
68         PROVIDE(end = .);
69
70         /*
71          * Stabs debugging sections are here too.
72          */
73         .stab          0 : { *(.stab) }
74         .stabstr       0 : { *(.stabstr) }
75         .stab.excl     0 : { *(.stab.excl) }
76         .stab.exclstr  0 : { *(.stab.exclstr) }
77         .stab.index    0 : { *(.stab.index) }
78         .stab.indexstr 0 : { *(.stab.indexstr) }
79         .comment       0 : { *(.comment) }
80
81         /*
82          * DWARF debug sections.
83          * Symbols in the DWARF debugging sections are relative to the beginning
84          * of the section so we begin them at 0.
85          */
86         /* DWARF 1 */
87         .debug          0 : { *(.debug) }
88         .line           0 : { *(.line) }
89         /* GNU DWARF 1 extensions */
90         .debug_srcinfo  0 : { *(.debug_srcinfo) }
91         .debug_sfnames  0 : { *(.debug_sfnames) }
92         /* DWARF 1.1 and DWARF 2 */
93         .debug_aranges  0 : { *(.debug_aranges) }
94         .debug_pubnames 0 : { *(.debug_pubnames) }
95         /* DWARF 2 */
96         .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
97         .debug_abbrev   0 : { *(.debug_abbrev) }
98         .debug_line     0 : { *(.debug_line) }
99         .debug_frame    0 : { *(.debug_frame) }
100         .debug_str      0 : { *(.debug_str) }
101         .debug_loc      0 : { *(.debug_loc) }
102         .debug_macinfo  0 : { *(.debug_macinfo) }
103         /* SGI/MIPS DWARF 2 extensions */
104         .debug_weaknames 0 : { *(.debug_weaknames) }
105         .debug_funcnames 0 : { *(.debug_funcnames) }
106         .debug_typenames 0 : { *(.debug_typenames) }
107         .debug_varnames  0 : { *(.debug_varnames) }
108
109         /DISCARD/       : {
110                 *(.note.GNU-stack)
111                 *(.branch_lt)
112                 *(.data .data.* .gnu.linkonce.d.* .sdata*)
113                 *(.bss .sbss .dynbss .dynsbss)
114                 *(.glink .iplt .plt .rela*)
115         }
116 }
117
118 /*
119  * Very old versions of ld do not recognize this name token; use the constant.
120  */
121 #define PT_GNU_EH_FRAME 0x6474e550
122
123 /*
124  * We must supply the ELF program headers explicitly to get just one
125  * PT_LOAD segment, and set the flags explicitly to make segments read-only.
126  */
127 PHDRS
128 {
129         text            PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
130         dynamic         PT_DYNAMIC FLAGS(4);            /* PF_R */
131         note            PT_NOTE FLAGS(4);               /* PF_R */
132         eh_frame_hdr    PT_GNU_EH_FRAME;
133 }
134
135 /*
136  * This controls what symbols we export from the DSO.
137  */
138 VERSION
139 {
140         VDSO_VERSION_STRING {
141         global:
142                 /*
143                  * Has to be there for the kernel to find
144                  */
145                 __kernel_datapage_offset;
146
147                 __kernel_get_syscall_map;
148                 __kernel_gettimeofday;
149                 __kernel_clock_gettime;
150                 __kernel_clock_getres;
151                 __kernel_get_tbfreq;
152                 __kernel_sync_dicache;
153                 __kernel_sync_dicache_p5;
154                 __kernel_sigtramp_rt64;
155                 __kernel_getcpu;
156                 __kernel_time;
157
158         local: *;
159         };
160 }