2005-06-24 05:01:16 +00:00
|
|
|
/*
|
|
|
|
* arch/xtensa/kernel/vmlinux.lds.S
|
|
|
|
*
|
|
|
|
* Xtensa linker script
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*
|
2013-01-05 00:57:17 +00:00
|
|
|
* Copyright (C) 2001 - 2008 Tensilica Inc.
|
2005-06-24 05:01:16 +00:00
|
|
|
*
|
|
|
|
* Chris Zankel <chris@zankel.net>
|
|
|
|
* Marc Gauthier <marc@tensilica.com, marc@alumni.uwaterloo.ca>
|
|
|
|
* Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <asm-generic/vmlinux.lds.h>
|
2009-09-24 14:36:19 +00:00
|
|
|
#include <asm/page.h>
|
|
|
|
#include <asm/thread_info.h>
|
2005-06-24 05:01:16 +00:00
|
|
|
|
2012-12-03 11:01:43 +00:00
|
|
|
#include <asm/vectors.h>
|
2008-11-06 14:40:46 +00:00
|
|
|
#include <variant/core.h>
|
2009-03-04 15:21:32 +00:00
|
|
|
#include <platform/hardware.h>
|
2005-06-24 05:01:16 +00:00
|
|
|
OUTPUT_ARCH(xtensa)
|
|
|
|
ENTRY(_start)
|
|
|
|
|
2006-12-10 10:18:48 +00:00
|
|
|
#ifdef __XTENSA_EB__
|
2005-06-24 05:01:16 +00:00
|
|
|
jiffies = jiffies_64 + 4;
|
|
|
|
#else
|
|
|
|
jiffies = jiffies_64;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Note: In the following macros, it would be nice to specify only the
|
|
|
|
vector name and section kind and construct "sym" and "section" using
|
|
|
|
CPP concatenation, but that does not work reliably. Concatenating a
|
|
|
|
string with "." produces an invalid token. CPP will not print a
|
|
|
|
warning because it thinks this is an assembly file, but it leaves
|
|
|
|
them as multiple tokens and there may or may not be whitespace
|
|
|
|
between them. */
|
|
|
|
|
|
|
|
/* Macro for a relocation entry */
|
|
|
|
|
|
|
|
#define RELOCATE_ENTRY(sym, section) \
|
|
|
|
LONG(sym ## _start); \
|
|
|
|
LONG(sym ## _end); \
|
|
|
|
LONG(LOADADDR(section))
|
|
|
|
|
|
|
|
/* Macro to define a section for a vector.
|
|
|
|
*
|
|
|
|
* Use of the MIN function catches the types of errors illustrated in
|
|
|
|
* the following example:
|
|
|
|
*
|
|
|
|
* Assume the section .DoubleExceptionVector.literal is completely
|
|
|
|
* full. Then a programmer adds code to .DoubleExceptionVector.text
|
|
|
|
* that produces another literal. The final literal position will
|
|
|
|
* overlay onto the first word of the adjacent code section
|
|
|
|
* .DoubleExceptionVector.text. (In practice, the literals will
|
|
|
|
* overwrite the code, and the first few instructions will be
|
|
|
|
* garbage.)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \
|
|
|
|
section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \
|
|
|
|
LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
|
|
|
|
{ \
|
|
|
|
. = ALIGN(4); \
|
|
|
|
sym ## _start = ABSOLUTE(.); \
|
|
|
|
*(section) \
|
|
|
|
sym ## _end = ABSOLUTE(.); \
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mapping of input sections to output sections when linking.
|
|
|
|
*/
|
|
|
|
|
|
|
|
SECTIONS
|
|
|
|
{
|
2006-12-10 10:18:48 +00:00
|
|
|
. = KERNELOFFSET;
|
2005-06-24 05:01:16 +00:00
|
|
|
/* .text section */
|
|
|
|
|
|
|
|
_text = .;
|
|
|
|
_stext = .;
|
|
|
|
|
|
|
|
.text :
|
|
|
|
{
|
2009-04-26 02:10:57 +00:00
|
|
|
/* The HEAD_TEXT section must be the first section! */
|
|
|
|
HEAD_TEXT
|
2009-04-21 07:34:15 +00:00
|
|
|
TEXT_TEXT
|
2005-06-24 05:01:16 +00:00
|
|
|
VMLINUX_SYMBOL(__sched_text_start) = .;
|
2005-07-12 20:58:25 +00:00
|
|
|
*(.sched.literal .sched.text)
|
2005-06-24 05:01:16 +00:00
|
|
|
VMLINUX_SYMBOL(__sched_text_end) = .;
|
2016-10-08 00:02:55 +00:00
|
|
|
VMLINUX_SYMBOL(__cpuidle_text_start) = .;
|
|
|
|
*(.cpuidle.literal .cpuidle.text)
|
|
|
|
VMLINUX_SYMBOL(__cpuidle_text_end) = .;
|
2005-06-24 05:01:16 +00:00
|
|
|
VMLINUX_SYMBOL(__lock_text_start) = .;
|
2005-07-12 20:58:25 +00:00
|
|
|
*(.spinlock.literal .spinlock.text)
|
2005-06-24 05:01:16 +00:00
|
|
|
VMLINUX_SYMBOL(__lock_text_end) = .;
|
|
|
|
|
|
|
|
}
|
|
|
|
_etext = .;
|
2007-06-01 00:47:01 +00:00
|
|
|
PROVIDE (etext = .);
|
2005-06-24 05:01:16 +00:00
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
|
|
|
|
RODATA
|
|
|
|
|
|
|
|
/* Relocation table */
|
|
|
|
|
|
|
|
.fixup : { *(.fixup) }
|
|
|
|
|
2009-09-24 14:36:19 +00:00
|
|
|
EXCEPTION_TABLE(16)
|
2005-06-24 05:01:16 +00:00
|
|
|
/* Data section */
|
|
|
|
|
2012-06-20 19:52:58 +00:00
|
|
|
_sdata = .;
|
2009-09-24 14:36:19 +00:00
|
|
|
RW_DATA_SECTION(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE)
|
2005-06-24 05:01:16 +00:00
|
|
|
_edata = .;
|
|
|
|
|
|
|
|
/* Initialization code and data: */
|
|
|
|
|
2009-09-24 14:36:19 +00:00
|
|
|
. = ALIGN(PAGE_SIZE);
|
2005-06-24 05:01:16 +00:00
|
|
|
__init_begin = .;
|
2009-09-24 14:36:19 +00:00
|
|
|
INIT_TEXT_SECTION(PAGE_SIZE)
|
2005-06-24 05:01:16 +00:00
|
|
|
|
|
|
|
.init.data :
|
|
|
|
{
|
2008-01-20 13:15:03 +00:00
|
|
|
INIT_DATA
|
2005-06-24 05:01:16 +00:00
|
|
|
. = ALIGN(0x4);
|
|
|
|
__tagtable_begin = .;
|
|
|
|
*(.taglist)
|
|
|
|
__tagtable_end = .;
|
2007-06-01 00:47:01 +00:00
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
__boot_reloc_table_start = ABSOLUTE(.);
|
|
|
|
|
|
|
|
RELOCATE_ENTRY(_WindowVectors_text,
|
|
|
|
.WindowVectors.text);
|
2013-01-05 00:57:17 +00:00
|
|
|
#if XCHAL_EXCM_LEVEL >= 2
|
|
|
|
RELOCATE_ENTRY(_Level2InterruptVector_text,
|
|
|
|
.Level2InterruptVector.text);
|
|
|
|
#endif
|
|
|
|
#if XCHAL_EXCM_LEVEL >= 3
|
|
|
|
RELOCATE_ENTRY(_Level3InterruptVector_text,
|
|
|
|
.Level3InterruptVector.text);
|
|
|
|
#endif
|
|
|
|
#if XCHAL_EXCM_LEVEL >= 4
|
|
|
|
RELOCATE_ENTRY(_Level4InterruptVector_text,
|
|
|
|
.Level4InterruptVector.text);
|
|
|
|
#endif
|
|
|
|
#if XCHAL_EXCM_LEVEL >= 5
|
|
|
|
RELOCATE_ENTRY(_Level5InterruptVector_text,
|
|
|
|
.Level5InterruptVector.text);
|
|
|
|
#endif
|
|
|
|
#if XCHAL_EXCM_LEVEL >= 6
|
|
|
|
RELOCATE_ENTRY(_Level6InterruptVector_text,
|
|
|
|
.Level6InterruptVector.text);
|
|
|
|
#endif
|
2007-06-01 00:47:01 +00:00
|
|
|
RELOCATE_ENTRY(_KernelExceptionVector_text,
|
|
|
|
.KernelExceptionVector.text);
|
|
|
|
RELOCATE_ENTRY(_UserExceptionVector_text,
|
|
|
|
.UserExceptionVector.text);
|
|
|
|
RELOCATE_ENTRY(_DoubleExceptionVector_literal,
|
|
|
|
.DoubleExceptionVector.literal);
|
|
|
|
RELOCATE_ENTRY(_DoubleExceptionVector_text,
|
|
|
|
.DoubleExceptionVector.text);
|
2007-12-31 06:00:54 +00:00
|
|
|
RELOCATE_ENTRY(_DebugInterruptVector_text,
|
|
|
|
.DebugInterruptVector.text);
|
2013-10-16 22:42:26 +00:00
|
|
|
#if defined(CONFIG_SMP)
|
|
|
|
RELOCATE_ENTRY(_SecondaryResetVector_text,
|
|
|
|
.SecondaryResetVector.text);
|
|
|
|
#endif
|
|
|
|
|
2007-06-01 00:47:01 +00:00
|
|
|
|
|
|
|
__boot_reloc_table_end = ABSOLUTE(.) ;
|
2005-06-24 05:01:16 +00:00
|
|
|
|
2009-09-24 14:36:19 +00:00
|
|
|
INIT_SETUP(XCHAL_ICACHE_LINESIZE)
|
|
|
|
INIT_CALLS
|
|
|
|
CON_INITCALL
|
|
|
|
SECURITY_INITCALL
|
|
|
|
INIT_RAM_FS
|
2005-06-24 05:01:16 +00:00
|
|
|
}
|
2007-06-01 00:47:01 +00:00
|
|
|
|
2011-03-24 17:50:09 +00:00
|
|
|
PERCPU_SECTION(XCHAL_ICACHE_LINESIZE)
|
2007-06-01 00:47:01 +00:00
|
|
|
|
2005-06-24 05:01:16 +00:00
|
|
|
/* We need this dummy segment here */
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
.dummy : { LONG(0) }
|
|
|
|
|
|
|
|
/* The vectors are relocated to the real position at startup time */
|
|
|
|
|
|
|
|
SECTION_VECTOR (_WindowVectors_text,
|
|
|
|
.WindowVectors.text,
|
2012-12-03 11:01:43 +00:00
|
|
|
WINDOW_VECTORS_VADDR, 4,
|
2005-06-24 05:01:16 +00:00
|
|
|
.dummy)
|
|
|
|
SECTION_VECTOR (_DebugInterruptVector_literal,
|
|
|
|
.DebugInterruptVector.literal,
|
2012-12-03 11:01:43 +00:00
|
|
|
DEBUG_VECTOR_VADDR - 4,
|
2005-06-24 05:01:16 +00:00
|
|
|
SIZEOF(.WindowVectors.text),
|
|
|
|
.WindowVectors.text)
|
|
|
|
SECTION_VECTOR (_DebugInterruptVector_text,
|
|
|
|
.DebugInterruptVector.text,
|
2012-12-03 11:01:43 +00:00
|
|
|
DEBUG_VECTOR_VADDR,
|
2005-06-24 05:01:16 +00:00
|
|
|
4,
|
|
|
|
.DebugInterruptVector.literal)
|
2013-01-05 00:57:17 +00:00
|
|
|
#undef LAST
|
|
|
|
#define LAST .DebugInterruptVector.text
|
|
|
|
#if XCHAL_EXCM_LEVEL >= 2
|
|
|
|
SECTION_VECTOR (_Level2InterruptVector_text,
|
|
|
|
.Level2InterruptVector.text,
|
2012-12-03 11:01:43 +00:00
|
|
|
INTLEVEL2_VECTOR_VADDR,
|
2013-01-05 00:57:17 +00:00
|
|
|
SIZEOF(LAST), LAST)
|
|
|
|
# undef LAST
|
|
|
|
# define LAST .Level2InterruptVector.text
|
|
|
|
#endif
|
|
|
|
#if XCHAL_EXCM_LEVEL >= 3
|
|
|
|
SECTION_VECTOR (_Level3InterruptVector_text,
|
|
|
|
.Level3InterruptVector.text,
|
2012-12-03 11:01:43 +00:00
|
|
|
INTLEVEL3_VECTOR_VADDR,
|
2013-01-05 00:57:17 +00:00
|
|
|
SIZEOF(LAST), LAST)
|
|
|
|
# undef LAST
|
|
|
|
# define LAST .Level3InterruptVector.text
|
|
|
|
#endif
|
|
|
|
#if XCHAL_EXCM_LEVEL >= 4
|
|
|
|
SECTION_VECTOR (_Level4InterruptVector_text,
|
|
|
|
.Level4InterruptVector.text,
|
2012-12-03 11:01:43 +00:00
|
|
|
INTLEVEL4_VECTOR_VADDR,
|
2013-01-05 00:57:17 +00:00
|
|
|
SIZEOF(LAST), LAST)
|
|
|
|
# undef LAST
|
|
|
|
# define LAST .Level4InterruptVector.text
|
|
|
|
#endif
|
|
|
|
#if XCHAL_EXCM_LEVEL >= 5
|
|
|
|
SECTION_VECTOR (_Level5InterruptVector_text,
|
|
|
|
.Level5InterruptVector.text,
|
2012-12-03 11:01:43 +00:00
|
|
|
INTLEVEL5_VECTOR_VADDR,
|
2013-01-05 00:57:17 +00:00
|
|
|
SIZEOF(LAST), LAST)
|
|
|
|
# undef LAST
|
|
|
|
# define LAST .Level5InterruptVector.text
|
|
|
|
#endif
|
|
|
|
#if XCHAL_EXCM_LEVEL >= 6
|
|
|
|
SECTION_VECTOR (_Level6InterruptVector_text,
|
|
|
|
.Level6InterruptVector.text,
|
2012-12-03 11:01:43 +00:00
|
|
|
INTLEVEL6_VECTOR_VADDR,
|
2013-01-05 00:57:17 +00:00
|
|
|
SIZEOF(LAST), LAST)
|
|
|
|
# undef LAST
|
|
|
|
# define LAST .Level6InterruptVector.text
|
|
|
|
#endif
|
2005-06-24 05:01:16 +00:00
|
|
|
SECTION_VECTOR (_KernelExceptionVector_literal,
|
|
|
|
.KernelExceptionVector.literal,
|
2012-12-03 11:01:43 +00:00
|
|
|
KERNEL_VECTOR_VADDR - 4,
|
2013-01-05 00:57:17 +00:00
|
|
|
SIZEOF(LAST), LAST)
|
|
|
|
#undef LAST
|
2005-06-24 05:01:16 +00:00
|
|
|
SECTION_VECTOR (_KernelExceptionVector_text,
|
|
|
|
.KernelExceptionVector.text,
|
2012-12-03 11:01:43 +00:00
|
|
|
KERNEL_VECTOR_VADDR,
|
2005-06-24 05:01:16 +00:00
|
|
|
4,
|
|
|
|
.KernelExceptionVector.literal)
|
|
|
|
SECTION_VECTOR (_UserExceptionVector_literal,
|
|
|
|
.UserExceptionVector.literal,
|
2012-12-03 11:01:43 +00:00
|
|
|
USER_VECTOR_VADDR - 4,
|
2005-06-24 05:01:16 +00:00
|
|
|
SIZEOF(.KernelExceptionVector.text),
|
|
|
|
.KernelExceptionVector.text)
|
|
|
|
SECTION_VECTOR (_UserExceptionVector_text,
|
|
|
|
.UserExceptionVector.text,
|
2012-12-03 11:01:43 +00:00
|
|
|
USER_VECTOR_VADDR,
|
2005-06-24 05:01:16 +00:00
|
|
|
4,
|
|
|
|
.UserExceptionVector.literal)
|
|
|
|
SECTION_VECTOR (_DoubleExceptionVector_literal,
|
|
|
|
.DoubleExceptionVector.literal,
|
2014-08-06 21:03:01 +00:00
|
|
|
DOUBLEEXC_VECTOR_VADDR - 48,
|
2005-06-24 05:01:16 +00:00
|
|
|
SIZEOF(.UserExceptionVector.text),
|
|
|
|
.UserExceptionVector.text)
|
|
|
|
SECTION_VECTOR (_DoubleExceptionVector_text,
|
|
|
|
.DoubleExceptionVector.text,
|
2012-12-03 11:01:43 +00:00
|
|
|
DOUBLEEXC_VECTOR_VADDR,
|
2014-08-06 21:03:01 +00:00
|
|
|
48,
|
2005-06-24 05:01:16 +00:00
|
|
|
.DoubleExceptionVector.literal)
|
|
|
|
|
|
|
|
. = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
|
2013-10-16 22:42:26 +00:00
|
|
|
|
|
|
|
#if defined(CONFIG_SMP)
|
|
|
|
|
|
|
|
SECTION_VECTOR (_SecondaryResetVector_text,
|
|
|
|
.SecondaryResetVector.text,
|
|
|
|
RESET_VECTOR1_VADDR,
|
2015-10-16 14:01:04 +00:00
|
|
|
SIZEOF(.DoubleExceptionVector.text),
|
|
|
|
.DoubleExceptionVector.text)
|
2013-10-16 22:42:26 +00:00
|
|
|
|
|
|
|
. = LOADADDR(.SecondaryResetVector.text)+SIZEOF(.SecondaryResetVector.text);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2009-09-24 14:36:19 +00:00
|
|
|
. = ALIGN(PAGE_SIZE);
|
2005-06-24 05:01:16 +00:00
|
|
|
|
|
|
|
__init_end = .;
|
|
|
|
|
2009-09-24 14:36:19 +00:00
|
|
|
BSS_SECTION(0, 8192, 0)
|
2007-06-01 00:47:01 +00:00
|
|
|
|
2005-06-24 05:01:16 +00:00
|
|
|
_end = .;
|
|
|
|
|
2007-06-01 00:47:01 +00:00
|
|
|
.xt.lit : { *(.xt.lit) }
|
|
|
|
.xt.prop : { *(.xt.prop) }
|
2005-06-24 05:01:16 +00:00
|
|
|
|
|
|
|
.debug 0 : { *(.debug) }
|
|
|
|
.line 0 : { *(.line) }
|
|
|
|
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
|
|
|
.debug_sfnames 0 : { *(.debug_sfnames) }
|
|
|
|
.debug_aranges 0 : { *(.debug_aranges) }
|
|
|
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
|
|
|
.debug_info 0 : { *(.debug_info) }
|
|
|
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
|
|
|
.debug_line 0 : { *(.debug_line) }
|
|
|
|
.debug_frame 0 : { *(.debug_frame) }
|
|
|
|
.debug_str 0 : { *(.debug_str) }
|
|
|
|
.debug_loc 0 : { *(.debug_loc) }
|
|
|
|
.debug_macinfo 0 : { *(.debug_macinfo) }
|
|
|
|
.debug_weaknames 0 : { *(.debug_weaknames) }
|
|
|
|
.debug_funcnames 0 : { *(.debug_funcnames) }
|
|
|
|
.debug_typenames 0 : { *(.debug_typenames) }
|
|
|
|
.debug_varnames 0 : { *(.debug_varnames) }
|
|
|
|
|
|
|
|
.xt.insn 0 :
|
|
|
|
{
|
|
|
|
*(.xt.insn)
|
|
|
|
*(.gnu.linkonce.x*)
|
|
|
|
}
|
|
|
|
|
|
|
|
.xt.lit 0 :
|
|
|
|
{
|
|
|
|
*(.xt.lit)
|
|
|
|
*(.gnu.linkonce.p*)
|
|
|
|
}
|
linker script: unify usage of discard definition
Discarded sections in different archs share some commonality but have
considerable differences. This led to linker script for each arch
implementing its own /DISCARD/ definition, which makes maintaining
tedious and adding new entries error-prone.
This patch makes all linker scripts to move discard definitions to the
end of the linker script and use the common DISCARDS macro. As ld
uses the first matching section definition, archs can include default
discarded sections by including them earlier in the linker script.
ia64 is notable because it first throws away some ia64 specific
subsections and then include the rest of the sections into the final
image, so those sections must be discarded before the inclusion.
defconfig compile tested for x86, x86-64, powerpc, powerpc64, ia64,
alpha, sparc, sparc64 and s390. Michal Simek tested microblaze.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Tested-by: Michal Simek <monstr@monstr.eu>
Cc: linux-arch@vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Tony Luck <tony.luck@intel.com>
2009-07-09 02:27:40 +00:00
|
|
|
|
|
|
|
/* Sections to be discarded */
|
|
|
|
DISCARDS
|
|
|
|
/DISCARD/ : { *(.exit.literal) }
|
2005-06-24 05:01:16 +00:00
|
|
|
}
|