GNU Linux-libre 5.15.137-gnu
[releases.git] / arch / sh / kernel / vmlinux.lds.S
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * ld script to make SuperH Linux kernel
4  * Written by Niibe Yutaka and Paul Mundt
5  */
6 OUTPUT_ARCH(sh)
7 #define RUNTIME_DISCARD_EXIT
8 #include <asm/thread_info.h>
9 #include <asm/cache.h>
10 #include <asm/vmlinux.lds.h>
11
12 #ifdef CONFIG_PMB
13  #define MEMORY_OFFSET  0
14 #else
15  #define MEMORY_OFFSET  __MEMORY_START
16 #endif
17
18 ENTRY(_start)
19 SECTIONS
20 {
21         . = PAGE_OFFSET + MEMORY_OFFSET + PHYSICAL_OFFSET + CONFIG_ZERO_PAGE_OFFSET;
22
23         _text = .;              /* Text and read-only data */
24
25         .empty_zero_page : AT(ADDR(.empty_zero_page)) {
26                 *(.empty_zero_page)
27         } = 0
28
29         .text : AT(ADDR(.text)) {
30                 HEAD_TEXT
31                 TEXT_TEXT
32                 SCHED_TEXT
33                 CPUIDLE_TEXT
34                 LOCK_TEXT
35                 KPROBES_TEXT
36                 IRQENTRY_TEXT
37                 SOFTIRQENTRY_TEXT
38                 *(.fixup)
39                 *(.gnu.warning)
40                 _etext = .;             /* End of text section */
41         } = 0x0009
42
43         EXCEPTION_TABLE(16)
44
45         _sdata = .;
46         RO_DATA(PAGE_SIZE)
47         RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
48         _edata = .;
49
50         DWARF_EH_FRAME
51
52         . = ALIGN(PAGE_SIZE);           /* Init code and data */
53         __init_begin = .;
54         INIT_TEXT_SECTION(PAGE_SIZE)
55         INIT_DATA_SECTION(16)
56
57         . = ALIGN(4);
58         .machvec.init : AT(ADDR(.machvec.init)) {
59                 __machvec_start = .;
60                 *(.machvec.init)
61                 __machvec_end = .;
62         }
63
64         PERCPU_SECTION(L1_CACHE_BYTES)
65
66         /*
67          * .exit.text is discarded at runtime, not link time, to deal with
68          * references from __bug_table
69          */
70         .exit.text : AT(ADDR(.exit.text)) { EXIT_TEXT }
71         .exit.data : AT(ADDR(.exit.data)) { EXIT_DATA }
72
73         . = ALIGN(PAGE_SIZE);
74         __init_end = .;
75         BSS_SECTION(0, PAGE_SIZE, 4)
76         _end = . ;
77
78         STABS_DEBUG
79         DWARF_DEBUG
80         ELF_DETAILS
81
82         DISCARDS
83 }