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#include <asm-generic/vmlinux.lds.h> 22 23/* needed for the processor specific cache alignment size */ 24#include <asm/cache.h> 25#include <asm/page.h> 26#include <asm/asm-offsets.h> 27#include <asm/thread_info.h> 28 29/* ld script to make hppa Linux kernel */ 30#ifndef CONFIG_64BIT 31OUTPUT_FORMAT("elf32-hppa-linux") 32OUTPUT_ARCH(hppa) 33#else 34OUTPUT_FORMAT("elf64-hppa-linux") 35OUTPUT_ARCH(hppa:hppa2.0w) 36#endif 37 38#define EXIT_TEXT_SECTIONS() .exit.text : { EXIT_TEXT } 39#if !defined(CONFIG_64BIT) || defined(CONFIG_MLONGCALLS) 40#define MLONGCALL_KEEP(x) 41#define MLONGCALL_DISCARD(x) x 42#else 43#define MLONGCALL_KEEP(x) x 44#define MLONGCALL_DISCARD(x) 45#endif 46 47ENTRY(parisc_kernel_start) 48#ifndef CONFIG_64BIT 49jiffies = jiffies_64 + 4; 50#else 51jiffies = jiffies_64; 52#endif 53SECTIONS 54{ 55 . = KERNEL_BINARY_TEXT_START; 56 57 __init_begin = .; 58 HEAD_TEXT_SECTION 59 MLONGCALL_DISCARD(INIT_TEXT_SECTION(8)) 60 61 . = ALIGN(PAGE_SIZE); 62 INIT_DATA_SECTION(PAGE_SIZE) 63 MLONGCALL_DISCARD(EXIT_TEXT_SECTIONS()) 64 .exit.data : 65 { 66 EXIT_DATA 67 } 68 PERCPU_SECTION(8) 69 . = ALIGN(4); 70 .altinstructions : { 71 __alt_instructions = .; 72 *(.altinstructions) 73 __alt_instructions_end = .; 74 } 75 . = ALIGN(HUGEPAGE_SIZE); 76 __init_end = .; 77 /* freed after init ends here */ 78 79 _text = .; /* Text and read-only data */ 80 _stext = .; 81 MLONGCALL_KEEP(INIT_TEXT_SECTION(8)) 82 .text ALIGN(PAGE_SIZE) : { 83 TEXT_TEXT 84 LOCK_TEXT 85 SCHED_TEXT 86 CPUIDLE_TEXT 87 KPROBES_TEXT 88 IRQENTRY_TEXT 89 SOFTIRQENTRY_TEXT 90 *(.text.do_softirq) 91 *(.text.sys_exit) 92 *(.text.do_sigaltstack) 93 *(.text.do_fork) 94 *(.text.div) 95 *($$*) /* millicode routines */ 96 *(.text.*) 97 *(.fixup) 98 *(.lock.text) /* out-of-line lock text */ 99 *(.gnu.warning) 100 } 101 MLONGCALL_KEEP(EXIT_TEXT_SECTIONS()) 102 . = ALIGN(PAGE_SIZE); 103 _etext = .; 104 /* End of text section */ 105 106 /* Start of data section */ 107 _sdata = .; 108 109 /* Architecturally we need to keep __gp below 0x1000000 and thus 110 * in front of RO_DATA_SECTION() which stores lots of tracepoint 111 * and ftrace symbols. */ 112#ifdef CONFIG_64BIT 113 . = ALIGN(16); 114 /* Linkage tables */ 115 .opd : { 116 __start_opd = .; 117 *(.opd) 118 __end_opd = .; 119 } PROVIDE (__gp = .); 120 .plt : { 121 *(.plt) 122 } 123 .dlt : { 124 *(.dlt) 125 } 126#endif 127 128 RO_DATA_SECTION(8) 129 130 /* RO because of BUILDTIME_EXTABLE_SORT */ 131 EXCEPTION_TABLE(8) 132 NOTES 133 134 /* unwind info */ 135 .PARISC.unwind : { 136 __start___unwind = .; 137 *(.PARISC.unwind) 138 __stop___unwind = .; 139 } 140 141 /* writeable */ 142 /* Make sure this is page aligned so 143 * that we can properly leave these 144 * as writable 145 */ 146 . = ALIGN(HUGEPAGE_SIZE); 147 data_start = .; 148 149 /* Data */ 150 RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, PAGE_SIZE) 151 152 /* PA-RISC locks requires 16-byte alignment */ 153 . = ALIGN(16); 154 .data..lock_aligned : { 155 *(.data..lock_aligned) 156 } 157 158 /* End of data section */ 159 _edata = .; 160 161 /* BSS */ 162 BSS_SECTION(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE) 163 164 . = ALIGN(HUGEPAGE_SIZE); 165 _end = . ; 166 167 STABS_DEBUG 168 .note 0 : { *(.note) } 169 170 /* Sections to be discarded */ 171 DISCARDS 172 /DISCARD/ : { 173#ifdef CONFIG_64BIT 174 /* temporary hack until binutils is fixed to not emit these 175 * for static binaries 176 */ 177 *(.interp) 178 *(.dynsym) 179 *(.dynstr) 180 *(.dynamic) 181 *(.hash) 182 *(.gnu.hash) 183#endif 184 } 185} 186