2005-06-24 09:01:16 +04:00
/ *
* arch/ x t e n s a / k e r n e l / v m l i n u x . l d s . S
*
* Xtensa l i n k e r s c r i p t
*
* This f i l e i s s u b j e c t t o t h e t e r m s a n d c o n d i t i o n s o f t h e G N U G e n e r a l P u b l i c
* License. S e e t h e f i l e " C O P Y I N G " i n t h e m a i n d i r e c t o r y o f t h i s a r c h i v e
* for m o r e d e t a i l s .
*
2013-01-05 04:57:17 +04:00
* Copyright ( C ) 2 0 0 1 - 2 0 0 8 T e n s i l i c a I n c .
2005-06-24 09:01:16 +04:00
*
* Chris Z a n k e l < c h r i s @zankel.net>
* Marc G a u t h i e r < m a r c @tensilica.com, marc@alumni.uwaterloo.ca>
* Joe T a y l o r < j o e @tensilica.com, joetylr@yahoo.com>
* /
# include < a s m - g e n e r i c / v m l i n u x . l d s . h >
2009-09-24 18:36:19 +04:00
# include < a s m / p a g e . h >
# include < a s m / t h r e a d _ i n f o . h >
2005-06-24 09:01:16 +04:00
2012-12-03 15:01:43 +04:00
# include < a s m / v e c t o r s . h >
2008-11-06 17:40:46 +03:00
# include < v a r i a n t / c o r e . h >
2009-03-04 18:21:32 +03:00
# include < p l a t f o r m / h a r d w a r e . h >
2005-06-24 09:01:16 +04:00
OUTPUT_ A R C H ( x t e n s a )
ENTRY( _ s t a r t )
2006-12-10 13:18:48 +03:00
# ifdef _ _ X T E N S A _ E B _ _
2005-06-24 09:01:16 +04:00
jiffies = j i f f i e s _ 6 4 + 4 ;
# else
jiffies = j i f f i e s _ 6 4 ;
# endif
/ * Note : In t h e f o l l o w i n g m a c r o s , i t w o u l d b e n i c e t o s p e c i f y o n l y t h e
vector n a m e a n d s e c t i o n k i n d a n d c o n s t r u c t " s y m " a n d " s e c t i o n " u s i n g
CPP c o n c a t e n a t i o n , b u t t h a t d o e s n o t w o r k r e l i a b l y . C o n c a t e n a t i n g a
string w i t h " . " p r o d u c e s a n i n v a l i d t o k e n . C P P w i l l n o t p r i n t a
warning b e c a u s e i t t h i n k s t h i s i s a n a s s e m b l y f i l e , b u t i t l e a v e s
them a s m u l t i p l e t o k e n s a n d t h e r e m a y o r m a y n o t b e w h i t e s p a c e
between t h e m . * /
/* Macro for a relocation entry */
# define R E L O C A T E _ E N T R Y ( s y m , s e c t i o n ) \
LONG( s y m ## _ s t a r t ) ; \
LONG( s y m ## _ e n d ) ; \
LONG( L O A D A D D R ( s e c t i o n ) )
/ * Macro t o d e f i n e a s e c t i o n f o r a v e c t o r .
*
* Use o f t h e M I N f u n c t i o n c a t c h e s t h e t y p e s o f e r r o r s i l l u s t r a t e d i n
* the f o l l o w i n g e x a m p l e :
*
* Assume t h e s e c t i o n . D o u b l e E x c e p t i o n V e c t o r . l i t e r a l i s c o m p l e t e l y
* full. T h e n a p r o g r a m m e r a d d s c o d e t o . D o u b l e E x c e p t i o n V e c t o r . t e x t
* that p r o d u c e s a n o t h e r l i t e r a l . T h e f i n a l l i t e r a l p o s i t i o n w i l l
* overlay o n t o t h e f i r s t w o r d o f t h e a d j a c e n t c o d e s e c t i o n
* .DoubleExceptionVector .text . ( In p r a c t i c e , t h e l i t e r a l s w i l l
* overwrite t h e c o d e , a n d t h e f i r s t f e w i n s t r u c t i o n s w i l l b e
* garbage. )
* /
# define S E C T I O N _ V E C T O R ( s y m , s e c t i o n , a d d r , m a x _ p r e v s e c _ s i z e , p r e v s e c ) \
section a d d r : A T ( ( M I N ( L O A D A D D R ( p r e v s e c ) + m a x _ p r e v s e c _ s i z e , \
LOADADDR( p r e v s e c ) + S I Z E O F ( p r e v s e c ) ) + 3 ) & ~ 3 ) \
{ \
. = ALIGN( 4 ) ; \
sym ## _ s t a r t = A B S O L U T E ( . ) ; \
* ( section) \
sym ## _ e n d = A B S O L U T E ( . ) ; \
}
/ *
* Mapping o f i n p u t s e c t i o n s t o o u t p u t s e c t i o n s w h e n l i n k i n g .
* /
SECTIONS
{
2006-12-10 13:18:48 +03:00
. = KERNELOFFSET;
2005-06-24 09:01:16 +04:00
/* .text section */
_ text = . ;
_ stext = . ;
.text :
{
2009-04-26 06:10:57 +04:00
/* The HEAD_TEXT section must be the first section! */
HEAD_ T E X T
2009-04-21 11:34:15 +04:00
TEXT_ T E X T
2005-06-24 09:01:16 +04:00
VMLINUX_ S Y M B O L ( _ _ s c h e d _ t e x t _ s t a r t ) = . ;
2005-07-13 00:58:25 +04:00
* ( .sched .literal .sched .text )
2005-06-24 09:01:16 +04:00
VMLINUX_ S Y M B O L ( _ _ s c h e d _ t e x t _ e n d ) = . ;
2016-10-08 03:02:55 +03:00
VMLINUX_ S Y M B O L ( _ _ c p u i d l e _ t e x t _ s t a r t ) = . ;
* ( .cpuidle .literal .cpuidle .text )
VMLINUX_ S Y M B O L ( _ _ c p u i d l e _ t e x t _ e n d ) = . ;
2005-06-24 09:01:16 +04:00
VMLINUX_ S Y M B O L ( _ _ l o c k _ t e x t _ s t a r t ) = . ;
2005-07-13 00:58:25 +04:00
* ( .spinlock .literal .spinlock .text )
2005-06-24 09:01:16 +04:00
VMLINUX_ S Y M B O L ( _ _ l o c k _ t e x t _ e n d ) = . ;
}
_ etext = . ;
2007-06-01 04:47:01 +04:00
PROVIDE ( e t e x t = . ) ;
2005-06-24 09:01:16 +04:00
. = ALIGN( 1 6 ) ;
RODATA
/* Relocation table */
.fixup : { * ( .fixup ) }
2009-09-24 18:36:19 +04:00
EXCEPTION_ T A B L E ( 1 6 )
2005-06-24 09:01:16 +04:00
/* Data section */
2012-06-20 23:52:58 +04:00
_ sdata = . ;
2009-09-24 18:36:19 +04:00
RW_ D A T A _ S E C T I O N ( X C H A L _ I C A C H E _ L I N E S I Z E , P A G E _ S I Z E , T H R E A D _ S I Z E )
2005-06-24 09:01:16 +04:00
_ edata = . ;
/* Initialization code and data: */
2009-09-24 18:36:19 +04:00
. = ALIGN( P A G E _ S I Z E ) ;
2005-06-24 09:01:16 +04:00
_ _ init_ b e g i n = . ;
2009-09-24 18:36:19 +04:00
INIT_ T E X T _ S E C T I O N ( P A G E _ S I Z E )
2005-06-24 09:01:16 +04:00
.init .data :
{
2008-01-20 16:15:03 +03:00
INIT_ D A T A
2005-06-24 09:01:16 +04:00
. = ALIGN( 0 x4 ) ;
_ _ tagtable_ b e g i n = . ;
* ( .taglist )
_ _ tagtable_ e n d = . ;
2007-06-01 04:47:01 +04:00
. = ALIGN( 1 6 ) ;
_ _ boot_ r e l o c _ t a b l e _ s t a r t = A B S O L U T E ( . ) ;
RELOCATE_ E N T R Y ( _ W i n d o w V e c t o r s _ t e x t ,
.WindowVectors .text ) ;
2013-01-05 04:57:17 +04:00
# if X C H A L _ E X C M _ L E V E L > = 2
RELOCATE_ E N T R Y ( _ L e v e l 2 I n t e r r u p t V e c t o r _ t e x t ,
.Level2InterruptVector .text ) ;
# endif
# if X C H A L _ E X C M _ L E V E L > = 3
RELOCATE_ E N T R Y ( _ L e v e l 3 I n t e r r u p t V e c t o r _ t e x t ,
.Level3InterruptVector .text ) ;
# endif
# if X C H A L _ E X C M _ L E V E L > = 4
RELOCATE_ E N T R Y ( _ L e v e l 4 I n t e r r u p t V e c t o r _ t e x t ,
.Level4InterruptVector .text ) ;
# endif
# if X C H A L _ E X C M _ L E V E L > = 5
RELOCATE_ E N T R Y ( _ L e v e l 5 I n t e r r u p t V e c t o r _ t e x t ,
.Level5InterruptVector .text ) ;
# endif
# if X C H A L _ E X C M _ L E V E L > = 6
RELOCATE_ E N T R Y ( _ L e v e l 6 I n t e r r u p t V e c t o r _ t e x t ,
.Level6InterruptVector .text ) ;
# endif
2007-06-01 04:47:01 +04:00
RELOCATE_ E N T R Y ( _ K e r n e l E x c e p t i o n V e c t o r _ t e x t ,
.KernelExceptionVector .text ) ;
RELOCATE_ E N T R Y ( _ U s e r E x c e p t i o n V e c t o r _ t e x t ,
.UserExceptionVector .text ) ;
RELOCATE_ E N T R Y ( _ D o u b l e E x c e p t i o n V e c t o r _ l i t e r a l ,
.DoubleExceptionVector .literal ) ;
RELOCATE_ E N T R Y ( _ D o u b l e E x c e p t i o n V e c t o r _ t e x t ,
.DoubleExceptionVector .text ) ;
2007-12-31 09:00:54 +03:00
RELOCATE_ E N T R Y ( _ D e b u g I n t e r r u p t V e c t o r _ t e x t ,
.DebugInterruptVector .text ) ;
2013-10-17 02:42:26 +04:00
# if d e f i n e d ( C O N F I G _ S M P )
RELOCATE_ E N T R Y ( _ S e c o n d a r y R e s e t V e c t o r _ t e x t ,
.SecondaryResetVector .text ) ;
# endif
2007-06-01 04:47:01 +04:00
_ _ boot_ r e l o c _ t a b l e _ e n d = A B S O L U T E ( . ) ;
2005-06-24 09:01:16 +04:00
2009-09-24 18:36:19 +04:00
INIT_ S E T U P ( X C H A L _ I C A C H E _ L I N E S I Z E )
INIT_ C A L L S
CON_ I N I T C A L L
SECURITY_ I N I T C A L L
INIT_ R A M _ F S
2005-06-24 09:01:16 +04:00
}
2007-06-01 04:47:01 +04:00
2011-03-24 20:50:09 +03:00
PERCPU_ S E C T I O N ( X C H A L _ I C A C H E _ L I N E S I Z E )
2007-06-01 04:47:01 +04:00
2005-06-24 09:01:16 +04:00
/* We need this dummy segment here */
. = ALIGN( 4 ) ;
.dummy : { LONG( 0 ) }
/* The vectors are relocated to the real position at startup time */
SECTION_ V E C T O R ( _ W i n d o w V e c t o r s _ t e x t ,
.WindowVectors .text ,
2012-12-03 15:01:43 +04:00
WINDOW_ V E C T O R S _ V A D D R , 4 ,
2005-06-24 09:01:16 +04:00
.dummy )
SECTION_ V E C T O R ( _ D e b u g I n t e r r u p t V e c t o r _ l i t e r a l ,
.DebugInterruptVector .literal ,
2012-12-03 15:01:43 +04:00
DEBUG_ V E C T O R _ V A D D R - 4 ,
2005-06-24 09:01:16 +04:00
SIZEOF( . W i n d o w V e c t o r s . t e x t ) ,
.WindowVectors .text )
SECTION_ V E C T O R ( _ D e b u g I n t e r r u p t V e c t o r _ t e x t ,
.DebugInterruptVector .text ,
2012-12-03 15:01:43 +04:00
DEBUG_ V E C T O R _ V A D D R ,
2005-06-24 09:01:16 +04:00
4 ,
.DebugInterruptVector .literal )
2013-01-05 04:57:17 +04:00
# undef L A S T
# define L A S T . D e b u g I n t e r r u p t V e c t o r . t e x t
# if X C H A L _ E X C M _ L E V E L > = 2
SECTION_ V E C T O R ( _ L e v e l 2 I n t e r r u p t V e c t o r _ t e x t ,
.Level2InterruptVector .text ,
2012-12-03 15:01:43 +04:00
INTLEVEL2 _ V E C T O R _ V A D D R ,
2013-01-05 04:57:17 +04:00
SIZEOF( L A S T ) , L A S T )
# undef L A S T
# define L A S T . L e v e l 2 I n t e r r u p t V e c t o r . t e x t
# endif
# if X C H A L _ E X C M _ L E V E L > = 3
SECTION_ V E C T O R ( _ L e v e l 3 I n t e r r u p t V e c t o r _ t e x t ,
.Level3InterruptVector .text ,
2012-12-03 15:01:43 +04:00
INTLEVEL3 _ V E C T O R _ V A D D R ,
2013-01-05 04:57:17 +04:00
SIZEOF( L A S T ) , L A S T )
# undef L A S T
# define L A S T . L e v e l 3 I n t e r r u p t V e c t o r . t e x t
# endif
# if X C H A L _ E X C M _ L E V E L > = 4
SECTION_ V E C T O R ( _ L e v e l 4 I n t e r r u p t V e c t o r _ t e x t ,
.Level4InterruptVector .text ,
2012-12-03 15:01:43 +04:00
INTLEVEL4 _ V E C T O R _ V A D D R ,
2013-01-05 04:57:17 +04:00
SIZEOF( L A S T ) , L A S T )
# undef L A S T
# define L A S T . L e v e l 4 I n t e r r u p t V e c t o r . t e x t
# endif
# if X C H A L _ E X C M _ L E V E L > = 5
SECTION_ V E C T O R ( _ L e v e l 5 I n t e r r u p t V e c t o r _ t e x t ,
.Level5InterruptVector .text ,
2012-12-03 15:01:43 +04:00
INTLEVEL5 _ V E C T O R _ V A D D R ,
2013-01-05 04:57:17 +04:00
SIZEOF( L A S T ) , L A S T )
# undef L A S T
# define L A S T . L e v e l 5 I n t e r r u p t V e c t o r . t e x t
# endif
# if X C H A L _ E X C M _ L E V E L > = 6
SECTION_ V E C T O R ( _ L e v e l 6 I n t e r r u p t V e c t o r _ t e x t ,
.Level6InterruptVector .text ,
2012-12-03 15:01:43 +04:00
INTLEVEL6 _ V E C T O R _ V A D D R ,
2013-01-05 04:57:17 +04:00
SIZEOF( L A S T ) , L A S T )
# undef L A S T
# define L A S T . L e v e l 6 I n t e r r u p t V e c t o r . t e x t
# endif
2005-06-24 09:01:16 +04:00
SECTION_ V E C T O R ( _ K e r n e l E x c e p t i o n V e c t o r _ l i t e r a l ,
.KernelExceptionVector .literal ,
2012-12-03 15:01:43 +04:00
KERNEL_ V E C T O R _ V A D D R - 4 ,
2013-01-05 04:57:17 +04:00
SIZEOF( L A S T ) , L A S T )
# undef L A S T
2005-06-24 09:01:16 +04:00
SECTION_ V E C T O R ( _ K e r n e l E x c e p t i o n V e c t o r _ t e x t ,
.KernelExceptionVector .text ,
2012-12-03 15:01:43 +04:00
KERNEL_ V E C T O R _ V A D D R ,
2005-06-24 09:01:16 +04:00
4 ,
.KernelExceptionVector .literal )
SECTION_ V E C T O R ( _ U s e r E x c e p t i o n V e c t o r _ l i t e r a l ,
.UserExceptionVector .literal ,
2012-12-03 15:01:43 +04:00
USER_ V E C T O R _ V A D D R - 4 ,
2005-06-24 09:01:16 +04:00
SIZEOF( . K e r n e l E x c e p t i o n V e c t o r . t e x t ) ,
.KernelExceptionVector .text )
SECTION_ V E C T O R ( _ U s e r E x c e p t i o n V e c t o r _ t e x t ,
.UserExceptionVector .text ,
2012-12-03 15:01:43 +04:00
USER_ V E C T O R _ V A D D R ,
2005-06-24 09:01:16 +04:00
4 ,
.UserExceptionVector .literal )
SECTION_ V E C T O R ( _ D o u b l e E x c e p t i o n V e c t o r _ l i t e r a l ,
.DoubleExceptionVector .literal ,
2014-08-07 01:03:01 +04:00
DOUBLEEXC_ V E C T O R _ V A D D R - 4 8 ,
2005-06-24 09:01:16 +04:00
SIZEOF( . U s e r E x c e p t i o n V e c t o r . t e x t ) ,
.UserExceptionVector .text )
SECTION_ V E C T O R ( _ D o u b l e E x c e p t i o n V e c t o r _ t e x t ,
.DoubleExceptionVector .text ,
2012-12-03 15:01:43 +04:00
DOUBLEEXC_ V E C T O R _ V A D D R ,
2014-08-07 01:03:01 +04:00
4 8 ,
2005-06-24 09:01:16 +04:00
.DoubleExceptionVector .literal )
. = ( LOADADDR( . D o u b l e E x c e p t i o n V e c t o r . t e x t ) + S I Z E O F ( . D o u b l e E x c e p t i o n V e c t o r . t e x t ) + 3 ) & ~ 3 ;
2013-10-17 02:42:26 +04:00
# if d e f i n e d ( C O N F I G _ S M P )
SECTION_ V E C T O R ( _ S e c o n d a r y R e s e t V e c t o r _ t e x t ,
.SecondaryResetVector .text ,
RESET_ V E C T O R 1 _ V A D D R ,
2015-10-16 17:01:04 +03:00
SIZEOF( . D o u b l e E x c e p t i o n V e c t o r . t e x t ) ,
.DoubleExceptionVector .text )
2013-10-17 02:42:26 +04:00
. = LOADADDR( . S e c o n d a r y R e s e t V e c t o r . t e x t ) + S I Z E O F ( . S e c o n d a r y R e s e t V e c t o r . t e x t ) ;
# endif
2009-09-24 18:36:19 +04:00
. = ALIGN( P A G E _ S I Z E ) ;
2005-06-24 09:01:16 +04:00
_ _ init_ e n d = . ;
2009-09-24 18:36:19 +04:00
BSS_ S E C T I O N ( 0 , 8 1 9 2 , 0 )
2007-06-01 04:47:01 +04:00
2005-06-24 09:01:16 +04:00
_ end = . ;
2007-06-01 04:47:01 +04:00
.xt .lit : { * ( .xt .lit ) }
.xt .prop : { * ( .xt .prop ) }
2005-06-24 09:01:16 +04: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 06:27:40 +04:00
/* Sections to be discarded */
DISCARDS
/ DISCARD/ : { * ( . e x i t . l i t e r a l ) }
2005-06-24 09:01:16 +04:00
}