blob: 97f0c0429dfa647fc9e07eb349768b4ebc750e71 [file] [log] [blame]
Catalin Marinas8c2c3df2012-04-20 14:45:54 +01001/*
2 * ld script to make ARM Linux kernel
3 * taken from the i386 version by Russell King
4 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
5 */
6
7#include <asm-generic/vmlinux.lds.h>
8#include <asm/thread_info.h>
9#include <asm/memory.h>
10#include <asm/page.h>
11
Mark Rutlanda2c1d732014-06-24 16:51:36 +010012#include "image.h"
13
Catalin Marinas8c2c3df2012-04-20 14:45:54 +010014#define ARM_EXIT_KEEP(x)
15#define ARM_EXIT_DISCARD(x) x
16
17OUTPUT_ARCH(aarch64)
Geoff Levandaf885f42014-05-16 18:26:01 +010018ENTRY(_text)
Catalin Marinas8c2c3df2012-04-20 14:45:54 +010019
20jiffies = jiffies_64;
21
Marc Zyngier2240bbb2012-12-07 18:40:43 +000022#define HYPERVISOR_TEXT \
23 /* \
24 * Force the alignment to be compatible with \
25 * the vectors requirements \
26 */ \
27 . = ALIGN(2048); \
28 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
29 *(.hyp.idmap.text) \
30 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; \
31 VMLINUX_SYMBOL(__hyp_text_start) = .; \
32 *(.hyp.text) \
33 VMLINUX_SYMBOL(__hyp_text_end) = .;
34
Catalin Marinas8c2c3df2012-04-20 14:45:54 +010035SECTIONS
36{
37 /*
38 * XXX: The linker does not define how output sections are
39 * assigned to input sections when there are multiple statements
40 * matching the same input section name. There is no documented
41 * order of matching.
42 */
43 /DISCARD/ : {
44 ARM_EXIT_DISCARD(EXIT_TEXT)
45 ARM_EXIT_DISCARD(EXIT_DATA)
46 EXIT_CALL
47 *(.discard)
48 *(.discard.*)
49 }
50
51 . = PAGE_OFFSET + TEXT_OFFSET;
52
53 .head.text : {
54 _text = .;
55 HEAD_TEXT
56 }
57 .text : { /* Real text segment */
58 _stext = .; /* Text and read-only data */
Catalin Marinas8c2c3df2012-04-20 14:45:54 +010059 __exception_text_start = .;
60 *(.exception.text)
61 __exception_text_end = .;
62 IRQENTRY_TEXT
63 TEXT_TEXT
64 SCHED_TEXT
65 LOCK_TEXT
Marc Zyngier2240bbb2012-12-07 18:40:43 +000066 HYPERVISOR_TEXT
Catalin Marinas8c2c3df2012-04-20 14:45:54 +010067 *(.fixup)
68 *(.gnu.warning)
69 . = ALIGN(16);
70 *(.got) /* Global offset table */
71 }
72
73 RO_DATA(PAGE_SIZE)
Will Deaconadace892013-05-08 17:29:24 +010074 EXCEPTION_TABLE(8)
Mark Salterc80b7ee2013-08-23 16:16:42 +010075 NOTES
Catalin Marinas8c2c3df2012-04-20 14:45:54 +010076 _etext = .; /* End of text and rodata section */
77
78 . = ALIGN(PAGE_SIZE);
79 __init_begin = .;
80
81 INIT_TEXT_SECTION(8)
82 .exit.text : {
83 ARM_EXIT_KEEP(EXIT_TEXT)
84 }
85 . = ALIGN(16);
86 .init.data : {
87 INIT_DATA
88 INIT_SETUP(16)
89 INIT_CALLS
90 CON_INITCALL
91 SECURITY_INITCALL
92 INIT_RAM_FS
93 }
94 .exit.data : {
95 ARM_EXIT_KEEP(EXIT_DATA)
96 }
97
98 PERCPU_SECTION(64)
99
100 __init_end = .;
Catalin Marinas8c2c3df2012-04-20 14:45:54 +0100101
Mark Salter3c620622013-11-04 16:38:47 +0000102 . = ALIGN(PAGE_SIZE);
103 _data = .;
Mark Salter3c620622013-11-04 16:38:47 +0000104 _sdata = .;
105 RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE)
106 _edata = .;
Catalin Marinas8c2c3df2012-04-20 14:45:54 +0100107
Catalin Marinas8c2c3df2012-04-20 14:45:54 +0100108 BSS_SECTION(0, 0, 0)
Mark Rutlandbd00cd52014-06-24 16:51:35 +0100109
110 . = ALIGN(PAGE_SIZE);
111 idmap_pg_dir = .;
112 . += IDMAP_DIR_SIZE;
113 swapper_pg_dir = .;
114 . += SWAPPER_DIR_SIZE;
115
Catalin Marinas8c2c3df2012-04-20 14:45:54 +0100116 _end = .;
117
118 STABS_DEBUG
Mark Rutlanda2c1d732014-06-24 16:51:36 +0100119
120 HEAD_SYMBOLS
Catalin Marinas8c2c3df2012-04-20 14:45:54 +0100121}
Marc Zyngier2240bbb2012-12-07 18:40:43 +0000122
123/*
124 * The HYP init code can't be more than a page long.
125 */
126ASSERT(((__hyp_idmap_text_start + PAGE_SIZE) > __hyp_idmap_text_end),
127 "HYP init code too big")
Mark Rutlandda57a362014-06-24 16:51:37 +0100128
129/*
130 * If padding is applied before .head.text, virt<->phys conversions will fail.
131 */
132ASSERT(_text == (PAGE_OFFSET + TEXT_OFFSET), "HEAD is misaligned")