| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2012 Regents of the University of California |
|---|
| 3 | 4 | * Copyright (C) 2017 SiFive |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or |
|---|
| 6 | | - * modify it under the terms of the GNU General Public License |
|---|
| 7 | | - * as published by the Free Software Foundation, version 2. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | - * GNU General Public License for more details. |
|---|
| 13 | 5 | */ |
|---|
| 14 | 6 | |
|---|
| 15 | 7 | #define LOAD_OFFSET PAGE_OFFSET |
|---|
| .. | .. |
|---|
| 17 | 9 | #include <asm/page.h> |
|---|
| 18 | 10 | #include <asm/cache.h> |
|---|
| 19 | 11 | #include <asm/thread_info.h> |
|---|
| 12 | +#include <asm/set_memory.h> |
|---|
| 13 | +#include "image-vars.h" |
|---|
| 20 | 14 | |
|---|
| 15 | +#include <linux/sizes.h> |
|---|
| 21 | 16 | OUTPUT_ARCH(riscv) |
|---|
| 22 | 17 | ENTRY(_start) |
|---|
| 23 | 18 | |
|---|
| 24 | 19 | jiffies = jiffies_64; |
|---|
| 20 | + |
|---|
| 21 | +PECOFF_SECTION_ALIGNMENT = 0x1000; |
|---|
| 22 | +PECOFF_FILE_ALIGNMENT = 0x200; |
|---|
| 25 | 23 | |
|---|
| 26 | 24 | SECTIONS |
|---|
| 27 | 25 | { |
|---|
| 28 | 26 | /* Beginning of code and text segment */ |
|---|
| 29 | 27 | . = LOAD_OFFSET; |
|---|
| 30 | 28 | _start = .; |
|---|
| 31 | | - __init_begin = .; |
|---|
| 32 | 29 | HEAD_TEXT_SECTION |
|---|
| 30 | + . = ALIGN(PAGE_SIZE); |
|---|
| 31 | + |
|---|
| 32 | + __init_begin = .; |
|---|
| 33 | 33 | INIT_TEXT_SECTION(PAGE_SIZE) |
|---|
| 34 | | - INIT_DATA_SECTION(16) |
|---|
| 34 | + . = ALIGN(8); |
|---|
| 35 | + __soc_early_init_table : { |
|---|
| 36 | + __soc_early_init_table_start = .; |
|---|
| 37 | + KEEP(*(__soc_early_init_table)) |
|---|
| 38 | + __soc_early_init_table_end = .; |
|---|
| 39 | + } |
|---|
| 40 | + __soc_builtin_dtb_table : { |
|---|
| 41 | + __soc_builtin_dtb_table_start = .; |
|---|
| 42 | + KEEP(*(__soc_builtin_dtb_table)) |
|---|
| 43 | + __soc_builtin_dtb_table_end = .; |
|---|
| 44 | + } |
|---|
| 35 | 45 | /* we have to discard exit text and such at runtime, not link time */ |
|---|
| 36 | 46 | .exit.text : |
|---|
| 37 | 47 | { |
|---|
| .. | .. |
|---|
| 44 | 54 | PERCPU_SECTION(L1_CACHE_BYTES) |
|---|
| 45 | 55 | __init_end = .; |
|---|
| 46 | 56 | |
|---|
| 57 | + . = ALIGN(SECTION_ALIGN); |
|---|
| 47 | 58 | .text : { |
|---|
| 48 | 59 | _text = .; |
|---|
| 49 | 60 | _stext = .; |
|---|
| .. | .. |
|---|
| 54 | 65 | KPROBES_TEXT |
|---|
| 55 | 66 | ENTRY_TEXT |
|---|
| 56 | 67 | IRQENTRY_TEXT |
|---|
| 68 | + SOFTIRQENTRY_TEXT |
|---|
| 57 | 69 | *(.fixup) |
|---|
| 58 | 70 | _etext = .; |
|---|
| 59 | 71 | } |
|---|
| 60 | 72 | |
|---|
| 73 | +#ifdef CONFIG_EFI |
|---|
| 74 | + . = ALIGN(PECOFF_SECTION_ALIGNMENT); |
|---|
| 75 | + __pecoff_text_end = .; |
|---|
| 76 | +#endif |
|---|
| 77 | + |
|---|
| 78 | + INIT_DATA_SECTION(16) |
|---|
| 79 | + |
|---|
| 61 | 80 | /* Start of data section */ |
|---|
| 62 | 81 | _sdata = .; |
|---|
| 63 | | - RO_DATA_SECTION(L1_CACHE_BYTES) |
|---|
| 82 | + RO_DATA(SECTION_ALIGN) |
|---|
| 64 | 83 | .srodata : { |
|---|
| 65 | 84 | *(.srodata*) |
|---|
| 66 | 85 | } |
|---|
| 67 | 86 | |
|---|
| 68 | | - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) |
|---|
| 87 | + EXCEPTION_TABLE(0x10) |
|---|
| 88 | + |
|---|
| 89 | + . = ALIGN(SECTION_ALIGN); |
|---|
| 90 | + _data = .; |
|---|
| 91 | + |
|---|
| 92 | + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) |
|---|
| 69 | 93 | .sdata : { |
|---|
| 70 | 94 | __global_pointer$ = . + 0x800; |
|---|
| 71 | 95 | *(.sdata*) |
|---|
| 72 | | - /* End of data section */ |
|---|
| 73 | | - _edata = .; |
|---|
| 74 | | - *(.sbss*) |
|---|
| 75 | 96 | } |
|---|
| 76 | 97 | |
|---|
| 77 | | - BSS_SECTION(0, 0, 0) |
|---|
| 98 | +#ifdef CONFIG_EFI |
|---|
| 99 | + .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); } |
|---|
| 100 | + __pecoff_data_raw_size = ABSOLUTE(. - __pecoff_text_end); |
|---|
| 101 | +#endif |
|---|
| 78 | 102 | |
|---|
| 79 | | - EXCEPTION_TABLE(0x10) |
|---|
| 80 | | - NOTES |
|---|
| 103 | + /* End of data section */ |
|---|
| 104 | + _edata = .; |
|---|
| 105 | + |
|---|
| 106 | + BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0) |
|---|
| 81 | 107 | |
|---|
| 82 | 108 | .rel.dyn : { |
|---|
| 83 | 109 | *(.rel.dyn*) |
|---|
| 84 | 110 | } |
|---|
| 85 | 111 | |
|---|
| 112 | +#ifdef CONFIG_EFI |
|---|
| 113 | + . = ALIGN(PECOFF_SECTION_ALIGNMENT); |
|---|
| 114 | + __pecoff_data_virt_size = ABSOLUTE(. - __pecoff_text_end); |
|---|
| 115 | +#endif |
|---|
| 86 | 116 | _end = .; |
|---|
| 87 | 117 | |
|---|
| 88 | 118 | STABS_DEBUG |
|---|
| 89 | 119 | DWARF_DEBUG |
|---|
| 120 | + ELF_DETAILS |
|---|
| 90 | 121 | |
|---|
| 91 | 122 | DISCARDS |
|---|
| 92 | 123 | } |
|---|