blob: 36b07ec09742ae088c55affb18874c1ef0f09c6b [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
David Howells05008712018-01-02 15:12:01 +00002#include <asm/vmlinux.lds.h>
Cyrill Gorcunova7dfa942008-05-12 14:01:56 -07003#include <asm/page.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
5OUTPUT_FORMAT(ELF_FORMAT)
6OUTPUT_ARCH(ELF_ARCH)
7ENTRY(_start)
8jiffies = jiffies_64;
9
10SECTIONS
11{
Jeff Dike23bbd5862006-07-10 04:45:06 -070012 /* This must contain the right address - not quite the default ELF one.*/
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 PROVIDE (__executable_start = START);
Jeff Dike23bbd5862006-07-10 04:45:06 -070014 /* Static binaries stick stuff here, like the sigreturn trampoline,
15 * invisibly to objdump. So, just make __binary_start equal to the very
16 * beginning of the executable, and if there are unmapped pages after this,
17 * they are forever unusable.
18 */
19 __binary_start = START;
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Jeff Dike23bbd5862006-07-10 04:45:06 -070021 . = START + SIZEOF_HEADERS;
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
Jeff Diked1480c52006-10-30 22:07:13 -080023 _text = .;
Richard Weinberger6915e042010-10-26 14:21:16 -070024 INIT_TEXT_SECTION(0)
Cyrill Gorcunova7dfa942008-05-12 14:01:56 -070025 . = ALIGN(PAGE_SIZE);
Jeff Diked67b5692005-07-07 17:56:49 -070026
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 .text :
28 {
Jiang Liua214a8c2013-07-03 15:03:40 -070029 _stext = .;
Sam Ravnborg76647092007-05-13 00:31:33 +020030 TEXT_TEXT
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 SCHED_TEXT
Chris Metcalf6727ad92016-10-07 17:02:55 -070032 CPUIDLE_TEXT
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 LOCK_TEXT
34 *(.fixup)
35 /* .gnu.warning sections are handled specially by elf32.em. */
36 *(.gnu.warning)
37 *(.gnu.linkonce.t*)
Jeff Dikec7ec16d2007-08-30 23:56:17 -070038 }
Jeff Diked67b5692005-07-07 17:56:49 -070039
Cyrill Gorcunova7dfa942008-05-12 14:01:56 -070040 . = ALIGN(PAGE_SIZE);
Jeff Dikec7ec16d2007-08-30 23:56:17 -070041 .syscall_stub : {
42 __syscall_stub_start = .;
43 *(.__syscall_stub*)
44 __syscall_stub_end = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 }
46
Roland McGrathaa5fb4d2010-10-26 14:22:19 -070047 /*
48 * These are needed even in a static link, even if they wind up being empty.
49 * Newer glibc needs these __rel{,a}_iplt_{start,end} symbols.
50 */
51 .rel.plt : {
52 *(.rel.plt)
53 PROVIDE_HIDDEN(__rel_iplt_start = .);
54 *(.rel.iplt)
55 PROVIDE_HIDDEN(__rel_iplt_end = .);
56 }
57 .rela.plt : {
58 *(.rela.plt)
59 PROVIDE_HIDDEN(__rela_iplt_start = .);
60 *(.rela.iplt)
61 PROVIDE_HIDDEN(__rela_iplt_end = .);
62 }
63
Al Viro37185b32012-10-08 03:27:32 +010064 #include <asm/common.lds.S>
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
Jiang Liua214a8c2013-07-03 15:03:40 -070066 __init_begin = .;
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +010067 init.data : { INIT_DATA }
Jiang Liua214a8c2013-07-03 15:03:40 -070068 __init_end = .;
69
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 .data :
71 {
Tim Abbott5d150a972009-09-24 10:36:20 -040072 INIT_TASK_DATA(KERNEL_STACK_SIZE)
Jeff Dikec14b8492007-05-10 22:22:34 -070073 . = ALIGN(KERNEL_STACK_SIZE);
Denys Vlasenko9d1578a2010-02-20 01:03:41 +010074 *(.data..init_irqstack)
Sam Ravnborgca967252007-05-17 13:38:44 +020075 DATA_DATA
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 *(.gnu.linkonce.d*)
77 CONSTRUCTORS
78 }
79 .data1 : { *(.data1) }
80 .ctors :
81 {
82 *(.ctors)
83 }
84 .dtors :
85 {
86 *(.dtors)
87 }
88
89 .got : { *(.got.plt) *(.got) }
90 .dynamic : { *(.dynamic) }
Jeff Dikeba9950c2005-05-20 13:59:07 -070091 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
92 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 /* We want the small data sections together, so single-instruction offsets
94 can access them all, and initialized data all before uninitialized, so
95 we can shorten the on-disk segment size. */
96 .sdata : { *(.sdata) }
97 _edata = .;
98 PROVIDE (edata = .);
Cyrill Gorcunova7dfa942008-05-12 14:01:56 -070099 . = ALIGN(PAGE_SIZE);
Tim Abbott5d150a972009-09-24 10:36:20 -0400100 __bss_start = .;
101 PROVIDE(_bss_start = .);
102 SBSS(0)
103 BSS(0)
Jiang Liua214a8c2013-07-03 15:03:40 -0700104 __bss_stop = .;
Paolo 'Blaisorblade' Giarrussoa7d0c212005-09-10 19:44:54 +0200105 _end = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 PROVIDE (end = .);
Paolo 'Blaisorblade' Giarrussoa7d0c212005-09-10 19:44:54 +0200107
108 STABS_DEBUG
109
110 DWARF_DEBUG
Tejun Heo405d9672009-06-24 15:13:38 +0900111
Tejun Heo023bf6f2009-07-09 11:27:40 +0900112 DISCARDS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113}