Path: blob/master/arch/xtensa/kernel/vmlinux.lds.S
10817 views
/*1* arch/xtensa/kernel/vmlinux.lds.S2*3* Xtensa linker script4*5* This file is subject to the terms and conditions of the GNU General Public6* License. See the file "COPYING" in the main directory of this archive7* for more details.8*9* Copyright (C) 2001 - 2005 Tensilica Inc.10*11* Chris Zankel <[email protected]>12* Marc Gauthier <[email protected], [email protected]>13* Joe Taylor <[email protected], [email protected]>14*/1516#include <asm-generic/vmlinux.lds.h>17#include <asm/page.h>18#include <asm/thread_info.h>1920#include <variant/core.h>21#include <platform/hardware.h>22OUTPUT_ARCH(xtensa)23ENTRY(_start)2425#ifdef __XTENSA_EB__26jiffies = jiffies_64 + 4;27#else28jiffies = jiffies_64;29#endif3031#ifndef KERNELOFFSET32#define KERNELOFFSET 0xd000100033#endif3435/* Note: In the following macros, it would be nice to specify only the36vector name and section kind and construct "sym" and "section" using37CPP concatenation, but that does not work reliably. Concatenating a38string with "." produces an invalid token. CPP will not print a39warning because it thinks this is an assembly file, but it leaves40them as multiple tokens and there may or may not be whitespace41between them. */4243/* Macro for a relocation entry */4445#define RELOCATE_ENTRY(sym, section) \46LONG(sym ## _start); \47LONG(sym ## _end); \48LONG(LOADADDR(section))4950/* Macro to define a section for a vector.51*52* Use of the MIN function catches the types of errors illustrated in53* the following example:54*55* Assume the section .DoubleExceptionVector.literal is completely56* full. Then a programmer adds code to .DoubleExceptionVector.text57* that produces another literal. The final literal position will58* overlay onto the first word of the adjacent code section59* .DoubleExceptionVector.text. (In practice, the literals will60* overwrite the code, and the first few instructions will be61* garbage.)62*/6364#define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \65section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \66LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \67{ \68. = ALIGN(4); \69sym ## _start = ABSOLUTE(.); \70*(section) \71sym ## _end = ABSOLUTE(.); \72}7374/*75* Mapping of input sections to output sections when linking.76*/7778SECTIONS79{80. = KERNELOFFSET;81/* .text section */8283_text = .;84_stext = .;85_ftext = .;8687.text :88{89/* The HEAD_TEXT section must be the first section! */90HEAD_TEXT91TEXT_TEXT92VMLINUX_SYMBOL(__sched_text_start) = .;93*(.sched.literal .sched.text)94VMLINUX_SYMBOL(__sched_text_end) = .;95VMLINUX_SYMBOL(__lock_text_start) = .;96*(.spinlock.literal .spinlock.text)97VMLINUX_SYMBOL(__lock_text_end) = .;9899}100_etext = .;101PROVIDE (etext = .);102103. = ALIGN(16);104105RODATA106107/* Relocation table */108109.fixup : { *(.fixup) }110111EXCEPTION_TABLE(16)112/* Data section */113114_fdata = .;115RW_DATA_SECTION(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)116_edata = .;117118/* Initialization code and data: */119120. = ALIGN(PAGE_SIZE);121__init_begin = .;122INIT_TEXT_SECTION(PAGE_SIZE)123124.init.data :125{126INIT_DATA127. = ALIGN(0x4);128__tagtable_begin = .;129*(.taglist)130__tagtable_end = .;131132. = ALIGN(16);133__boot_reloc_table_start = ABSOLUTE(.);134135RELOCATE_ENTRY(_WindowVectors_text,136.WindowVectors.text);137RELOCATE_ENTRY(_KernelExceptionVector_text,138.KernelExceptionVector.text);139RELOCATE_ENTRY(_UserExceptionVector_text,140.UserExceptionVector.text);141RELOCATE_ENTRY(_DoubleExceptionVector_literal,142.DoubleExceptionVector.literal);143RELOCATE_ENTRY(_DoubleExceptionVector_text,144.DoubleExceptionVector.text);145RELOCATE_ENTRY(_DebugInterruptVector_text,146.DebugInterruptVector.text);147148__boot_reloc_table_end = ABSOLUTE(.) ;149150INIT_SETUP(XCHAL_ICACHE_LINESIZE)151INIT_CALLS152CON_INITCALL153SECURITY_INITCALL154INIT_RAM_FS155}156157PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)158159/* We need this dummy segment here */160161. = ALIGN(4);162.dummy : { LONG(0) }163164/* The vectors are relocated to the real position at startup time */165166SECTION_VECTOR (_WindowVectors_text,167.WindowVectors.text,168XCHAL_WINDOW_VECTORS_VADDR, 4,169.dummy)170SECTION_VECTOR (_DebugInterruptVector_literal,171.DebugInterruptVector.literal,172XCHAL_DEBUG_VECTOR_VADDR - 4,173SIZEOF(.WindowVectors.text),174.WindowVectors.text)175SECTION_VECTOR (_DebugInterruptVector_text,176.DebugInterruptVector.text,177XCHAL_DEBUG_VECTOR_VADDR,1784,179.DebugInterruptVector.literal)180SECTION_VECTOR (_KernelExceptionVector_literal,181.KernelExceptionVector.literal,182XCHAL_KERNEL_VECTOR_VADDR - 4,183SIZEOF(.DebugInterruptVector.text),184.DebugInterruptVector.text)185SECTION_VECTOR (_KernelExceptionVector_text,186.KernelExceptionVector.text,187XCHAL_KERNEL_VECTOR_VADDR,1884,189.KernelExceptionVector.literal)190SECTION_VECTOR (_UserExceptionVector_literal,191.UserExceptionVector.literal,192XCHAL_USER_VECTOR_VADDR - 4,193SIZEOF(.KernelExceptionVector.text),194.KernelExceptionVector.text)195SECTION_VECTOR (_UserExceptionVector_text,196.UserExceptionVector.text,197XCHAL_USER_VECTOR_VADDR,1984,199.UserExceptionVector.literal)200SECTION_VECTOR (_DoubleExceptionVector_literal,201.DoubleExceptionVector.literal,202XCHAL_DOUBLEEXC_VECTOR_VADDR - 16,203SIZEOF(.UserExceptionVector.text),204.UserExceptionVector.text)205SECTION_VECTOR (_DoubleExceptionVector_text,206.DoubleExceptionVector.text,207XCHAL_DOUBLEEXC_VECTOR_VADDR,20832,209.DoubleExceptionVector.literal)210211. = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;212. = ALIGN(PAGE_SIZE);213214__init_end = .;215216BSS_SECTION(0, 8192, 0)217218_end = .;219220/* only used by the boot loader */221222. = ALIGN(0x10);223.bootstrap : { *(.bootstrap.literal .bootstrap.text .bootstrap.data) }224225. = ALIGN(0x1000);226__initrd_start = .;227.initrd : { *(.initrd) }228__initrd_end = .;229230.ResetVector.text XCHAL_RESET_VECTOR_VADDR :231{232*(.ResetVector.text)233}234235.xt.lit : { *(.xt.lit) }236.xt.prop : { *(.xt.prop) }237238.debug 0 : { *(.debug) }239.line 0 : { *(.line) }240.debug_srcinfo 0 : { *(.debug_srcinfo) }241.debug_sfnames 0 : { *(.debug_sfnames) }242.debug_aranges 0 : { *(.debug_aranges) }243.debug_pubnames 0 : { *(.debug_pubnames) }244.debug_info 0 : { *(.debug_info) }245.debug_abbrev 0 : { *(.debug_abbrev) }246.debug_line 0 : { *(.debug_line) }247.debug_frame 0 : { *(.debug_frame) }248.debug_str 0 : { *(.debug_str) }249.debug_loc 0 : { *(.debug_loc) }250.debug_macinfo 0 : { *(.debug_macinfo) }251.debug_weaknames 0 : { *(.debug_weaknames) }252.debug_funcnames 0 : { *(.debug_funcnames) }253.debug_typenames 0 : { *(.debug_typenames) }254.debug_varnames 0 : { *(.debug_varnames) }255256.xt.insn 0 :257{258*(.xt.insn)259*(.gnu.linkonce.x*)260}261262.xt.lit 0 :263{264*(.xt.lit)265*(.gnu.linkonce.p*)266}267268/* Sections to be discarded */269DISCARDS270/DISCARD/ : { *(.exit.literal) }271}272273274