Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / arch / parisc / kernel / vmlinux.lds.S
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*    Kernel link layout for various "sections"
3  *
4  *    Copyright (C) 1999-2003 Matthew Wilcox <willy at parisc-linux.org>
5  *    Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org>
6  *    Copyright (C) 2000 John Marvin <jsm at parisc-linux.org>
7  *    Copyright (C) 2000 Michael Ang <mang with subcarrier.org>
8  *    Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
9  *    Copyright (C) 2003 James Bottomley <jejb with parisc-linux.org>
10  *    Copyright (C) 2006-2013 Helge Deller <deller@gmx.de>
11  */
12
13 /*
14  * Put page table entries (swapper_pg_dir) as the first thing in .bss. This
15  * will ensure that it has .bss alignment (PAGE_SIZE).
16  */
17 #define BSS_FIRST_SECTIONS      *(.data..vm0.pmd) \
18                                 *(.data..vm0.pgd) \
19                                 *(.data..vm0.pte)
20
21 #define CC_USING_PATCHABLE_FUNCTION_ENTRY
22
23 #include <asm-generic/vmlinux.lds.h>
24
25 /* needed for the processor specific cache alignment size */    
26 #include <asm/cache.h>
27 #include <asm/page.h>
28 #include <asm/asm-offsets.h>
29 #include <asm/thread_info.h>
30         
31 /* ld script to make hppa Linux kernel */
32 #ifndef CONFIG_64BIT
33 OUTPUT_FORMAT("elf32-hppa-linux")
34 OUTPUT_ARCH(hppa)
35 #else
36 OUTPUT_FORMAT("elf64-hppa-linux")
37 OUTPUT_ARCH(hppa:hppa2.0w)
38 #endif
39
40 #define EXIT_TEXT_SECTIONS()    .exit.text : { EXIT_TEXT }
41 #if !defined(CONFIG_64BIT) || defined(CONFIG_MLONGCALLS)
42 #define MLONGCALL_KEEP(x)
43 #define MLONGCALL_DISCARD(x)    x
44 #else
45 #define MLONGCALL_KEEP(x)       x
46 #define MLONGCALL_DISCARD(x)
47 #endif
48
49 ENTRY(parisc_kernel_start)
50 #ifndef CONFIG_64BIT
51 jiffies = jiffies_64 + 4;
52 #else
53 jiffies = jiffies_64;
54 #endif
55 SECTIONS
56 {
57         . = KERNEL_BINARY_TEXT_START;
58
59         __init_begin = .;
60         HEAD_TEXT_SECTION
61         MLONGCALL_DISCARD(INIT_TEXT_SECTION(8))
62
63         . = ALIGN(PAGE_SIZE);
64         INIT_DATA_SECTION(PAGE_SIZE)
65         MLONGCALL_DISCARD(EXIT_TEXT_SECTIONS())
66         .exit.data :
67         {
68                 EXIT_DATA
69         }
70         PERCPU_SECTION(8)
71         . = ALIGN(4);
72         .altinstructions : {
73                 __alt_instructions = .;
74                 *(.altinstructions)
75                 __alt_instructions_end = .;
76         }
77         . = ALIGN(HUGEPAGE_SIZE);
78         __init_end = .;
79         /* freed after init ends here */
80
81         _text = .;              /* Text and read-only data */
82         _stext = .;
83         MLONGCALL_KEEP(INIT_TEXT_SECTION(8))
84         .text ALIGN(PAGE_SIZE) : {
85                 TEXT_TEXT
86                 LOCK_TEXT
87                 SCHED_TEXT
88                 CPUIDLE_TEXT
89                 KPROBES_TEXT
90                 IRQENTRY_TEXT
91                 SOFTIRQENTRY_TEXT
92                 *(.text.do_softirq)
93                 *(.text.sys_exit)
94                 *(.text.do_sigaltstack)
95                 *(.text.do_fork)
96                 *(.text.div)
97                 *($$*)                  /* millicode routines */
98                 *(.text.*)
99                 *(.fixup)
100                 *(.lock.text)           /* out-of-line lock text */
101                 *(.gnu.warning)
102         }
103         MLONGCALL_KEEP(EXIT_TEXT_SECTIONS())
104         . = ALIGN(PAGE_SIZE);
105         _etext = .;
106         /* End of text section */
107
108         /* Start of data section */
109         _sdata = .;
110
111         /* Architecturally we need to keep __gp below 0x1000000 and thus
112          * in front of RO_DATA_SECTION() which stores lots of tracepoint
113          * and ftrace symbols. */
114 #ifdef CONFIG_64BIT
115         . = ALIGN(16);
116         /* Linkage tables */
117         .opd : {
118                 __start_opd = .;
119                 *(.opd)
120                 __end_opd = .;
121         } PROVIDE (__gp = .);
122         .plt : {
123                 *(.plt)
124         }
125         .dlt : {
126                 *(.dlt)
127         }
128 #endif
129
130         RO_DATA_SECTION(8)
131
132         /* RO because of BUILDTIME_EXTABLE_SORT */
133         EXCEPTION_TABLE(8)
134         NOTES
135
136         /* unwind info */
137         .PARISC.unwind : {
138                 __start___unwind = .;
139                 *(.PARISC.unwind)
140                 __stop___unwind = .;
141         }
142
143         /* writeable */
144         /* Make sure this is page aligned so
145          * that we can properly leave these
146          * as writable
147          */
148         . = ALIGN(HUGEPAGE_SIZE);
149         data_start = .;
150
151         /* Data */
152         RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, PAGE_SIZE)
153
154         /* PA-RISC locks requires 16-byte alignment */
155         . = ALIGN(16);
156         .data..lock_aligned : {
157                 *(.data..lock_aligned)
158         }
159
160         /* End of data section */
161         _edata = .;
162
163         /* BSS */
164         BSS_SECTION(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE)
165
166         . = ALIGN(HUGEPAGE_SIZE);
167         _end = . ;
168
169         STABS_DEBUG
170         .note 0 : { *(.note) }
171
172         /* Sections to be discarded */
173         DISCARDS
174         /DISCARD/ : {
175 #ifdef CONFIG_64BIT
176                 /* temporary hack until binutils is fixed to not emit these
177                  * for static binaries
178                  */
179                 *(.interp)
180                 *(.dynsym)
181                 *(.dynstr)
182                 *(.dynamic)
183                 *(.hash)
184                 *(.gnu.hash)
185 #endif
186         }
187 }