/*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 - 2008 Tensilica Inc.10*11* Chris Zankel <[email protected]>12* Marc Gauthier <[email protected], [email protected]>13* Joe Taylor <[email protected], [email protected]>14*/1516#define RO_EXCEPTION_TABLE_ALIGN 161718#include <asm-generic/vmlinux.lds.h>19#include <asm/page.h>20#include <asm/thread_info.h>2122#include <asm/core.h>23#include <asm/vectors.h>2425OUTPUT_ARCH(xtensa)26ENTRY(_start)2728#ifdef __XTENSA_EB__29jiffies = jiffies_64 + 4;30#else31jiffies = jiffies_64;32#endif3334/* Note: In the following macros, it would be nice to specify only the35vector name and section kind and construct "sym" and "section" using36CPP concatenation, but that does not work reliably. Concatenating a37string with "." produces an invalid token. CPP will not print a38warning because it thinks this is an assembly file, but it leaves39them as multiple tokens and there may or may not be whitespace40between them. */4142/* Macro for a relocation entry */4344#define RELOCATE_ENTRY(sym, section) \45LONG(sym ## _start); \46LONG(sym ## _end); \47LONG(LOADADDR(section))4849#if !defined(CONFIG_VECTORS_ADDR) && XCHAL_HAVE_VECBASE50#define MERGED_VECTORS 151#else52#define MERGED_VECTORS 053#endif5455/*56* Macro to define a section for a vector. When MERGED_VECTORS is 057* code for every vector is located with other init data. At startup58* time head.S copies code for every vector to its final position according59* to description recorded in the corresponding RELOCATE_ENTRY.60*/6162#define SECTION_VECTOR4(sym, section, addr, prevsec) \63section addr : AT(((LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \64{ \65. = ALIGN(4); \66sym ## _start = ABSOLUTE(.); \67*(section) \68sym ## _end = ABSOLUTE(.); \69}7071#define SECTION_VECTOR2(section, addr) \72. = addr; \73*(section)7475/*76* Mapping of input sections to output sections when linking.77*/7879SECTIONS80{81. = KERNELOFFSET;82/* .text section */8384_text = .;85_stext = .;8687.text :88{89/* The HEAD_TEXT section must be the first section! */90HEAD_TEXT9192#if MERGED_VECTORS93. = ALIGN(PAGE_SIZE);94_vecbase = .;9596#ifdef SUPPORT_WINDOWED97SECTION_VECTOR2 (.WindowVectors.text, WINDOW_VECTORS_VADDR)98#endif99#if XCHAL_EXCM_LEVEL >= 2100SECTION_VECTOR2 (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR)101#endif102#if XCHAL_EXCM_LEVEL >= 3103SECTION_VECTOR2 (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR)104#endif105#if XCHAL_EXCM_LEVEL >= 4106SECTION_VECTOR2 (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR)107#endif108#if XCHAL_EXCM_LEVEL >= 5109SECTION_VECTOR2 (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR)110#endif111#if XCHAL_EXCM_LEVEL >= 6112SECTION_VECTOR2 (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR)113#endif114SECTION_VECTOR2 (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR)115SECTION_VECTOR2 (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)116SECTION_VECTOR2 (.UserExceptionVector.text, USER_VECTOR_VADDR)117SECTION_VECTOR2 (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)118119*(.exception.text)120*(.xiptext)121#endif122123IRQENTRY_TEXT124SOFTIRQENTRY_TEXT125ENTRY_TEXT126TEXT_TEXT127SCHED_TEXT128LOCK_TEXT129*(.fixup)130}131_etext = .;132PROVIDE (etext = .);133134. = ALIGN(16);135136RO_DATA(4096)137138/* Data section */139140#ifdef CONFIG_XIP_KERNEL141INIT_TEXT_SECTION(PAGE_SIZE)142#else143_sdata = .;144RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)145_edata = .;146147/* Initialization code and data: */148149. = ALIGN(PAGE_SIZE);150__init_begin = .;151INIT_TEXT_SECTION(PAGE_SIZE)152153.init.data :154{155INIT_DATA156}157#endif158159.init.rodata :160{161. = ALIGN(0x4);162__tagtable_begin = .;163*(.taglist)164__tagtable_end = .;165166. = ALIGN(16);167__boot_reloc_table_start = ABSOLUTE(.);168169#if !MERGED_VECTORS170#ifdef SUPPORT_WINDOWED171RELOCATE_ENTRY(_WindowVectors_text,172.WindowVectors.text);173#endif174#if XCHAL_EXCM_LEVEL >= 2175RELOCATE_ENTRY(_Level2InterruptVector_text,176.Level2InterruptVector.text);177#endif178#if XCHAL_EXCM_LEVEL >= 3179RELOCATE_ENTRY(_Level3InterruptVector_text,180.Level3InterruptVector.text);181#endif182#if XCHAL_EXCM_LEVEL >= 4183RELOCATE_ENTRY(_Level4InterruptVector_text,184.Level4InterruptVector.text);185#endif186#if XCHAL_EXCM_LEVEL >= 5187RELOCATE_ENTRY(_Level5InterruptVector_text,188.Level5InterruptVector.text);189#endif190#if XCHAL_EXCM_LEVEL >= 6191RELOCATE_ENTRY(_Level6InterruptVector_text,192.Level6InterruptVector.text);193#endif194RELOCATE_ENTRY(_KernelExceptionVector_text,195.KernelExceptionVector.text);196RELOCATE_ENTRY(_UserExceptionVector_text,197.UserExceptionVector.text);198RELOCATE_ENTRY(_DoubleExceptionVector_text,199.DoubleExceptionVector.text);200RELOCATE_ENTRY(_DebugInterruptVector_text,201.DebugInterruptVector.text);202RELOCATE_ENTRY(_exception_text,203.exception.text);204#ifdef CONFIG_XIP_KERNEL205RELOCATE_ENTRY(_xip_text, .xiptext);206#endif207#endif208#ifdef CONFIG_XIP_KERNEL209RELOCATE_ENTRY(_xip_data, .data);210RELOCATE_ENTRY(_xip_init_data, .init.data);211#endif212#if defined(CONFIG_SECONDARY_RESET_VECTOR)213RELOCATE_ENTRY(_SecondaryResetVector_text,214.SecondaryResetVector.text);215#endif216217__boot_reloc_table_end = ABSOLUTE(.) ;218219INIT_SETUP(XCHAL_ICACHE_LINESIZE)220INIT_CALLS221CON_INITCALL222INIT_RAM_FS223}224225PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)226227/* We need this dummy segment here */228229. = ALIGN(4);230.dummy : { LONG(0) }231232#undef LAST233#define LAST .dummy234235#if !MERGED_VECTORS236/* The vectors are relocated to the real position at startup time */237238#ifdef SUPPORT_WINDOWED239SECTION_VECTOR4 (_WindowVectors_text,240.WindowVectors.text,241WINDOW_VECTORS_VADDR,242LAST)243#undef LAST244#define LAST .WindowVectors.text245#endif246SECTION_VECTOR4 (_DebugInterruptVector_text,247.DebugInterruptVector.text,248DEBUG_VECTOR_VADDR,249LAST)250#undef LAST251#define LAST .DebugInterruptVector.text252#if XCHAL_EXCM_LEVEL >= 2253SECTION_VECTOR4 (_Level2InterruptVector_text,254.Level2InterruptVector.text,255INTLEVEL2_VECTOR_VADDR,256LAST)257# undef LAST258# define LAST .Level2InterruptVector.text259#endif260#if XCHAL_EXCM_LEVEL >= 3261SECTION_VECTOR4 (_Level3InterruptVector_text,262.Level3InterruptVector.text,263INTLEVEL3_VECTOR_VADDR,264LAST)265# undef LAST266# define LAST .Level3InterruptVector.text267#endif268#if XCHAL_EXCM_LEVEL >= 4269SECTION_VECTOR4 (_Level4InterruptVector_text,270.Level4InterruptVector.text,271INTLEVEL4_VECTOR_VADDR,272LAST)273# undef LAST274# define LAST .Level4InterruptVector.text275#endif276#if XCHAL_EXCM_LEVEL >= 5277SECTION_VECTOR4 (_Level5InterruptVector_text,278.Level5InterruptVector.text,279INTLEVEL5_VECTOR_VADDR,280LAST)281# undef LAST282# define LAST .Level5InterruptVector.text283#endif284#if XCHAL_EXCM_LEVEL >= 6285SECTION_VECTOR4 (_Level6InterruptVector_text,286.Level6InterruptVector.text,287INTLEVEL6_VECTOR_VADDR,288LAST)289# undef LAST290# define LAST .Level6InterruptVector.text291#endif292SECTION_VECTOR4 (_KernelExceptionVector_text,293.KernelExceptionVector.text,294KERNEL_VECTOR_VADDR,295LAST)296#undef LAST297SECTION_VECTOR4 (_UserExceptionVector_text,298.UserExceptionVector.text,299USER_VECTOR_VADDR,300.KernelExceptionVector.text)301SECTION_VECTOR4 (_DoubleExceptionVector_text,302.DoubleExceptionVector.text,303DOUBLEEXC_VECTOR_VADDR,304.UserExceptionVector.text)305#define LAST .DoubleExceptionVector.text306307#endif308#if defined(CONFIG_SECONDARY_RESET_VECTOR)309310SECTION_VECTOR4 (_SecondaryResetVector_text,311.SecondaryResetVector.text,312RESET_VECTOR1_VADDR,313LAST)314#undef LAST315#define LAST .SecondaryResetVector.text316317#endif318#if !MERGED_VECTORS319SECTION_VECTOR4 (_exception_text,320.exception.text,321,322LAST)323#undef LAST324#define LAST .exception.text325SECTION_VECTOR4 (_xip_text,326.xiptext,327,328LAST)329#undef LAST330#define LAST .xiptext331#endif332. = (LOADADDR(LAST) + SIZEOF(LAST) + 3) & ~ 3;333334.dummy1 : AT(ADDR(.dummy1)) { LONG(0) }335. = ALIGN(PAGE_SIZE);336337#ifndef CONFIG_XIP_KERNEL338__init_end = .;339340BSS_SECTION(0, 8192, 0)341#endif342343_end = .;344345#ifdef CONFIG_XIP_KERNEL346. = CONFIG_XIP_DATA_ADDR;347348_xip_start = .;349350#undef LOAD_OFFSET351#define LOAD_OFFSET \352(CONFIG_XIP_DATA_ADDR - (LOADADDR(.dummy1) + SIZEOF(.dummy1) + 3) & ~ 3)353354_xip_data_start = .;355_sdata = .;356RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)357_edata = .;358_xip_data_end = .;359360/* Initialization data: */361362STRUCT_ALIGN();363364_xip_init_data_start = .;365__init_begin = .;366.init.data :367{368INIT_DATA369}370_xip_init_data_end = .;371__init_end = .;372BSS_SECTION(0, 8192, 0)373374_xip_end = .;375376#undef LOAD_OFFSET377#endif378379DWARF_DEBUG380381.xt.prop 0 : { KEEP(*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) }382.xt.insn 0 : { KEEP(*(.xt.insn .xt.insn.* .gnu.linkonce.x*)) }383.xt.lit 0 : { KEEP(*(.xt.lit .xt.lit.* .gnu.linkonce.p*)) }384385/* Sections to be discarded */386DISCARDS387}388389390