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 | |
| 12 | #define ARM_EXIT_KEEP(x) |
| 13 | #define ARM_EXIT_DISCARD(x) x |
| 14 | |
| 15 | OUTPUT_ARCH(aarch64) |
Geoff Levand | af885f4 | 2014-05-16 18:26:01 +0100 | [diff] [blame] | 16 | ENTRY(_text) |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 17 | |
| 18 | jiffies = jiffies_64; |
| 19 | |
Marc Zyngier | 2240bbb | 2012-12-07 18:40:43 +0000 | [diff] [blame] | 20 | #define HYPERVISOR_TEXT \ |
| 21 | /* \ |
| 22 | * Force the alignment to be compatible with \ |
| 23 | * the vectors requirements \ |
| 24 | */ \ |
| 25 | . = ALIGN(2048); \ |
| 26 | VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \ |
| 27 | *(.hyp.idmap.text) \ |
| 28 | VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; \ |
| 29 | VMLINUX_SYMBOL(__hyp_text_start) = .; \ |
| 30 | *(.hyp.text) \ |
| 31 | VMLINUX_SYMBOL(__hyp_text_end) = .; |
| 32 | |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 33 | SECTIONS |
| 34 | { |
| 35 | /* |
| 36 | * XXX: The linker does not define how output sections are |
| 37 | * assigned to input sections when there are multiple statements |
| 38 | * matching the same input section name. There is no documented |
| 39 | * order of matching. |
| 40 | */ |
| 41 | /DISCARD/ : { |
| 42 | ARM_EXIT_DISCARD(EXIT_TEXT) |
| 43 | ARM_EXIT_DISCARD(EXIT_DATA) |
| 44 | EXIT_CALL |
| 45 | *(.discard) |
| 46 | *(.discard.*) |
| 47 | } |
| 48 | |
| 49 | . = PAGE_OFFSET + TEXT_OFFSET; |
| 50 | |
| 51 | .head.text : { |
| 52 | _text = .; |
| 53 | HEAD_TEXT |
| 54 | } |
| 55 | .text : { /* Real text segment */ |
| 56 | _stext = .; /* Text and read-only data */ |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 57 | __exception_text_start = .; |
| 58 | *(.exception.text) |
| 59 | __exception_text_end = .; |
| 60 | IRQENTRY_TEXT |
| 61 | TEXT_TEXT |
| 62 | SCHED_TEXT |
| 63 | LOCK_TEXT |
Marc Zyngier | 2240bbb | 2012-12-07 18:40:43 +0000 | [diff] [blame] | 64 | HYPERVISOR_TEXT |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 65 | *(.fixup) |
| 66 | *(.gnu.warning) |
| 67 | . = ALIGN(16); |
| 68 | *(.got) /* Global offset table */ |
| 69 | } |
| 70 | |
| 71 | RO_DATA(PAGE_SIZE) |
Will Deacon | adace89 | 2013-05-08 17:29:24 +0100 | [diff] [blame] | 72 | EXCEPTION_TABLE(8) |
Mark Salter | c80b7ee | 2013-08-23 16:16:42 +0100 | [diff] [blame] | 73 | NOTES |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 74 | _etext = .; /* End of text and rodata section */ |
| 75 | |
| 76 | . = ALIGN(PAGE_SIZE); |
| 77 | __init_begin = .; |
| 78 | |
| 79 | INIT_TEXT_SECTION(8) |
| 80 | .exit.text : { |
| 81 | ARM_EXIT_KEEP(EXIT_TEXT) |
| 82 | } |
| 83 | . = ALIGN(16); |
| 84 | .init.data : { |
| 85 | INIT_DATA |
| 86 | INIT_SETUP(16) |
| 87 | INIT_CALLS |
| 88 | CON_INITCALL |
| 89 | SECURITY_INITCALL |
| 90 | INIT_RAM_FS |
| 91 | } |
| 92 | .exit.data : { |
| 93 | ARM_EXIT_KEEP(EXIT_DATA) |
| 94 | } |
| 95 | |
| 96 | PERCPU_SECTION(64) |
| 97 | |
| 98 | __init_end = .; |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 99 | |
Mark Salter | 3c62062 | 2013-11-04 16:38:47 +0000 | [diff] [blame] | 100 | . = ALIGN(PAGE_SIZE); |
| 101 | _data = .; |
Mark Salter | 3c62062 | 2013-11-04 16:38:47 +0000 | [diff] [blame] | 102 | _sdata = .; |
| 103 | RW_DATA_SECTION(64, PAGE_SIZE, THREAD_SIZE) |
| 104 | _edata = .; |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 105 | |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 106 | BSS_SECTION(0, 0, 0) |
Mark Rutland | bd00cd5 | 2014-06-24 16:51:35 +0100 | [diff] [blame^] | 107 | |
| 108 | . = ALIGN(PAGE_SIZE); |
| 109 | idmap_pg_dir = .; |
| 110 | . += IDMAP_DIR_SIZE; |
| 111 | swapper_pg_dir = .; |
| 112 | . += SWAPPER_DIR_SIZE; |
| 113 | |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 114 | _end = .; |
| 115 | |
| 116 | STABS_DEBUG |
Catalin Marinas | 8c2c3df | 2012-04-20 14:45:54 +0100 | [diff] [blame] | 117 | } |
Marc Zyngier | 2240bbb | 2012-12-07 18:40:43 +0000 | [diff] [blame] | 118 | |
| 119 | /* |
| 120 | * The HYP init code can't be more than a page long. |
| 121 | */ |
| 122 | ASSERT(((__hyp_idmap_text_start + PAGE_SIZE) > __hyp_idmap_text_end), |
| 123 | "HYP init code too big") |