blob: 000e6e91f6a0630c53f35519d450fccf02479e55 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* ld script to make s390 Linux kernel
2 * Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
3 */
4
Heiko Carstens0778dc32008-11-27 11:05:58 +01005#include <asm/thread_info.h>
Sam Ravnborg52480ee2007-10-12 16:11:50 +02006#include <asm/page.h>
Heiko Carstens0ccb32c2016-05-28 10:03:55 +02007
8/*
9 * Put .bss..swapper_pg_dir as the first thing in .bss. This will
10 * make sure it has 16k alignment.
11 */
12#define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir)
13
Heiko Carstensd07a9802016-06-07 10:12:55 +020014/* Handle ro_after_init data on our own. */
15#define RO_AFTER_INIT_DATA
16
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <asm-generic/vmlinux.lds.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Linus Torvalds1da177e2005-04-16 15:20:36 -070019OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
20OUTPUT_ARCH(s390:64-bit)
Christian Borntraegere0a15d52012-01-18 18:03:39 +010021ENTRY(startup)
Linus Torvalds1da177e2005-04-16 15:20:36 -070022jiffies = jiffies_64;
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Martin Schwidefskyea29ee12008-01-26 14:11:21 +010024PHDRS {
25 text PT_LOAD FLAGS(5); /* R_E */
26 data PT_LOAD FLAGS(7); /* RWE */
27 note PT_NOTE FLAGS(0); /* ___ */
28}
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030SECTIONS
31{
Sam Ravnborge16af092007-10-12 16:11:49 +020032 . = 0x00000000;
33 .text : {
34 _text = .; /* Text and read-only data */
Tim Abbott2133bb82009-04-25 22:11:06 -040035 HEAD_TEXT
36 TEXT_TEXT
Sam Ravnborge16af092007-10-12 16:11:49 +020037 SCHED_TEXT
Chris Metcalf6727ad92016-10-07 17:02:55 -070038 CPUIDLE_TEXT
Sam Ravnborge16af092007-10-12 16:11:49 +020039 LOCK_TEXT
40 KPROBES_TEXT
Heiko Carstens88dbd202009-06-12 10:26:46 +020041 IRQENTRY_TEXT
Alexander Potapenkobe7635e2016-03-25 14:22:05 -070042 SOFTIRQENTRY_TEXT
Sam Ravnborge16af092007-10-12 16:11:49 +020043 *(.fixup)
44 *(.gnu.warning)
Heiko Carstensa817a612008-02-05 16:50:38 +010045 } :text = 0x0700
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
Sam Ravnborge16af092007-10-12 16:11:49 +020047 _etext = .; /* End of text section */
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
Martin Schwidefskyea29ee12008-01-26 14:11:21 +010049 NOTES :text :note
Martin Schwidefskyea29ee12008-01-26 14:11:21 +010050
Martin Schwidefsky7a2512b2011-11-14 11:19:02 +010051 .dummy : { *(.dummy) } :data
52
Heiko Carstens56280b12012-07-24 16:32:39 +020053 RO_DATA_SECTION(PAGE_SIZE)
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55#ifdef CONFIG_SHARED_KERNEL
Sam Ravnborg52480ee2007-10-12 16:11:50 +020056 . = ALIGN(0x100000); /* VM shared segments are 1MB aligned */
Linus Torvalds1da177e2005-04-16 15:20:36 -070057#endif
58
Sam Ravnborg52480ee2007-10-12 16:11:50 +020059 . = ALIGN(PAGE_SIZE);
Sam Ravnborge16af092007-10-12 16:11:49 +020060 _eshared = .; /* End of shareable data */
Heiko Carstensdfcc3e62009-10-06 10:33:57 +020061 _sdata = .; /* Start of data section */
Heiko Carstens162e0062007-02-05 21:18:41 +010062
Heiko Carstensd07a9802016-06-07 10:12:55 +020063 . = ALIGN(PAGE_SIZE);
64 __start_ro_after_init = .;
65 .data..ro_after_init : {
66 *(.data..ro_after_init)
67 }
68 EXCEPTION_TABLE(16)
69 . = ALIGN(PAGE_SIZE);
70 __end_ro_after_init = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
Nelson Elhage04a95f62009-09-11 10:28:44 +020072 RW_DATA_SECTION(0x100, PAGE_SIZE, THREAD_SIZE)
Linus Torvalds1da177e2005-04-16 15:20:36 -070073
Sam Ravnborge16af092007-10-12 16:11:49 +020074 _edata = .; /* End of data section */
Heiko Carstensc0007f12007-04-27 16:01:42 +020075
Sam Ravnborge16af092007-10-12 16:11:49 +020076 /* will be freed after init */
Sam Ravnborg52480ee2007-10-12 16:11:50 +020077 . = ALIGN(PAGE_SIZE); /* Init code and data */
Sam Ravnborge16af092007-10-12 16:11:49 +020078 __init_begin = .;
Nelson Elhage04a95f62009-09-11 10:28:44 +020079
80 INIT_TEXT_SECTION(PAGE_SIZE)
81
Sam Ravnborge16af092007-10-12 16:11:49 +020082 /*
83 * .exit.text is discarded at runtime, not link time,
84 * to deal with references from __bug_table
85 */
86 .exit.text : {
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +010087 EXIT_TEXT
Sam Ravnborge16af092007-10-12 16:11:49 +020088 }
89
Heiko Carstensa4e69242013-02-11 14:26:24 +010090 .exit.data : {
91 EXIT_DATA
92 }
93
Christian Borntraeger92e6ecf2009-03-26 15:23:58 +010094 /* early.c uses stsi, which requires page aligned data. */
95 . = ALIGN(PAGE_SIZE);
Nelson Elhage04a95f62009-09-11 10:28:44 +020096 INIT_DATA_SECTION(0x100)
Linus Torvalds1da177e2005-04-16 15:20:36 -070097
Tejun Heo0415b00d12011-03-24 18:50:09 +010098 PERCPU_SECTION(0x100)
Sam Ravnborg52480ee2007-10-12 16:11:50 +020099 . = ALIGN(PAGE_SIZE);
Sam Ravnborge16af092007-10-12 16:11:49 +0200100 __init_end = .; /* freed after init ends here */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
Heiko Carstens0ccb32c2016-05-28 10:03:55 +0200102 BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103
Sam Ravnborge16af092007-10-12 16:11:49 +0200104 _end = . ;
105
Sam Ravnborge16af092007-10-12 16:11:49 +0200106 /* Debugging sections. */
107 STABS_DEBUG
108 DWARF_DEBUG
Tejun Heo023bf6f2009-07-09 11:27:40 +0900109
110 /* Sections to be discarded */
111 DISCARDS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112}