1/* 2 * Copyright (C) 2012 Regents of the University of California 3 * 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 */ 14 15#define LOAD_OFFSET PAGE_OFFSET 16#include <asm/vmlinux.lds.h> 17#include <asm/page.h> 18#include <asm/cache.h> 19#include <asm/thread_info.h> 20 21#define MAX_BYTES_PER_LONG 0x10 22 23OUTPUT_ARCH(riscv) 24ENTRY(_start) 25 26jiffies = jiffies_64; 27 28SECTIONS 29{ 30 /* Beginning of code and text segment */ 31 . = LOAD_OFFSET; 32 _start = .; 33 __init_begin = .; 34 HEAD_TEXT_SECTION 35 INIT_TEXT_SECTION(PAGE_SIZE) 36 INIT_DATA_SECTION(16) 37 /* we have to discard exit text and such at runtime, not link time */ 38 .exit.text : 39 { 40 EXIT_TEXT 41 } 42 .exit.data : 43 { 44 EXIT_DATA 45 } 46 PERCPU_SECTION(L1_CACHE_BYTES) 47 __init_end = .; 48 49 .text : { 50 _text = .; 51 _stext = .; 52 TEXT_TEXT 53 SCHED_TEXT 54 CPUIDLE_TEXT 55 LOCK_TEXT 56 KPROBES_TEXT 57 ENTRY_TEXT 58 IRQENTRY_TEXT 59 *(.fixup) 60 _etext = .; 61 } 62 63 /* Start of data section */ 64 _sdata = .; 65 RO_DATA_SECTION(L1_CACHE_BYTES) 66 .srodata : { 67 *(.srodata*) 68 } 69 70 RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) 71 .sdata : { 72 __global_pointer$ = . + 0x800; 73 *(.sdata*) 74 /* End of data section */ 75 _edata = .; 76 *(.sbss*) 77 } 78 79 EXCEPTION_TABLE(0x10) 80 NOTES 81 82 .rel.dyn : { 83 *(.rel.dyn*) 84 } 85 86 BSS_SECTION(MAX_BYTES_PER_LONG, 87 MAX_BYTES_PER_LONG, 88 MAX_BYTES_PER_LONG) 89 90 _end = .; 91 92 STABS_DEBUG 93 DWARF_DEBUG 94 95 DISCARDS 96} 97