Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 1 | /* |
| 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 Rutland | a2c1d73 | 2014-06-24 16:51:36 +0100 | [diff] [blame] | 12 | #include "image.h" |
| 13 | |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 14 | #define ARM_EXIT_KEEP(x) |
| 15 | #define ARM_EXIT_DISCARD(x) x |
| 16 | |
| 17 | OUTPUT_ARCH(aarch64) |
Geoff Levand | af885f4 | 2014-05-16 18:26:01 +0100 | [diff] [blame] | 18 | ENTRY(_text) |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 19 | |
| 20 | jiffies = jiffies_64; |
| 21 | |
Marc Zyngier | 2240bbb | 2012-12-07 18:40:43 +0000 | [diff] [blame] | 22 | #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 Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 35 | SECTIONS |
| 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 Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 59 | __exception_text_start = .; |
| 60 | *(.exception.text) |
| 61 | __exception_text_end = .; |
| 62 | IRQENTRY_TEXT |
| 63 | TEXT_TEXT |
| 64 | SCHED_TEXT |
| 65 | LOCK_TEXT |
Marc Zyngier | 2240bbb | 2012-12-07 18:40:43 +0000 | [diff] [blame] | 66 | HYPERVISOR_TEXT |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 67 | *(.fixup) |
| 68 | *(.gnu.warning) |
| 69 | . = ALIGN(16); |
| 70 | *(.got) /* Global offset table */ |
| 71 | } |
| 72 | |
| 73 | RO_DATA(PAGE_SIZE) |
Will Deacon | adace89 | 2013-05-08 17:29:24 +0100 | [diff] [blame] | 74 | EXCEPTION_TABLE(8) |
Mark Salter | c80b7ee | 2013-08-23 16:16:42 +0100 | [diff] [blame] | 75 | NOTES |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 76 | _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 Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 101 | |
Mark Salter | 3c62062 | 2013-11-04 16:38:47 +0000 | [diff] [blame] | 102 | . = ALIGN(PAGE_SIZE); |
| 103 | _data = .; |
Mark Salter | 3c62062 | 2013-11-04 16:38:47 +0000 | [diff] [blame] | 104 | _sdata = .; |
| 105 | RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE) |
| 106 | _edata = .; |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 107 | |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 108 | BSS_SECTION(0, 0, 0) |
Mark Rutland | bd00cd5 | 2014-06-24 16:51:35 +0100 | [diff] [blame] | 109 | |
| 110 | . = ALIGN(PAGE_SIZE); |
| 111 | idmap_pg_dir = .; |
| 112 | . += IDMAP_DIR_SIZE; |
| 113 | swapper_pg_dir = .; |
| 114 | . += SWAPPER_DIR_SIZE; |
| 115 | |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 116 | _end = .; |
| 117 | |
| 118 | STABS_DEBUG |
Mark Rutland | a2c1d73 | 2014-06-24 16:51:36 +0100 | [diff] [blame] | 119 | |
| 120 | HEAD_SYMBOLS |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 121 | } |
Marc Zyngier | 2240bbb | 2012-12-07 18:40:43 +0000 | [diff] [blame] | 122 | |
| 123 | /* |
| 124 | * The HYP init code can't be more than a page long. |
| 125 | */ |
| 126 | ASSERT(((__hyp_idmap_text_start + PAGE_SIZE) > __hyp_idmap_text_end), |
| 127 | "HYP init code too big") |
Mark Rutland | da57a36 | 2014-06-24 16:51:37 +0100 | [diff] [blame] | 128 | |
| 129 | /* |
| 130 | * If padding is applied before .head.text, virt<->phys conversions will fail. |
| 131 | */ |
| 132 | ASSERT(_text == (PAGE_OFFSET + TEXT_OFFSET), "HEAD is misaligned") |