2007-10-11 11:14:21 +02:00
/ * ld s c r i p t t o m a k e x86 - 6 4 L i n u x k e r n e l
* Written b y M a r t i n M a r e s < m j @atrey.karlin.mff.cuni.cz>;
* /
# define L O A D _ O F F S E T _ _ S T A R T _ K E R N E L _ m a p
# include < a s m - g e n e r i c / v m l i n u x . l d s . h >
# include < a s m / p a g e . h >
# undef i 3 8 6 / * i n c a s e t h e p r e p r o c e s s o r i s a 3 2 b i t o n e * /
OUTPUT_ F O R M A T ( " e l f64 - x86 - 6 4 " , " e l f64 - x86 - 6 4 " , " e l f64 - x86 - 6 4 " )
OUTPUT_ A R C H ( i 3 8 6 : x86 - 6 4 )
ENTRY( p h y s _ s t a r t u p _ 6 4 )
jiffies_ 6 4 = j i f f i e s ;
_ proxy_ p d a = 1 ;
PHDRS {
text P T _ L O A D F L A G S ( 5 ) ; /* R_E */
data P T _ L O A D F L A G S ( 7 ) ; /* RWE */
user P T _ L O A D F L A G S ( 7 ) ; /* RWE */
data. i n i t P T _ L O A D F L A G S ( 7 ) ; /* RWE */
note P T _ N O T E F L A G S ( 4 ) ; /* R__ */
}
SECTIONS
{
. = _ _ START_ K E R N E L ;
phys_ s t a r t u p _ 6 4 = s t a r t u p _ 6 4 - L O A D _ O F F S E T ;
_ text = . ; /* Text and read-only data */
.text : AT( A D D R ( . t e x t ) - L O A D _ O F F S E T ) {
/* First the code that has to be first for bootstrapping */
* ( .text .head )
_ stext = . ;
/* Then the rest */
TEXT_ T E X T
SCHED_ T E X T
LOCK_ T E X T
KPROBES_ T E X T
* ( .fixup )
* ( .gnu .warning )
2008-02-17 18:17:17 +03:00
_ etext = . ; /* End of text section */
2008-01-30 13:33:14 +01:00
} : text = 0 x90 9 0
2007-10-11 11:14:21 +02:00
. = ALIGN( 1 6 ) ; /* Exception table */
2008-01-30 13:33:14 +01:00
_ _ ex_ t a b l e : A T ( A D D R ( _ _ e x _ t a b l e ) - L O A D _ O F F S E T ) {
_ _ start_ _ _ e x _ t a b l e = . ;
* ( _ _ ex_ t a b l e )
_ _ stop_ _ _ e x _ t a b l e = . ;
}
2007-10-11 11:14:21 +02:00
NOTES : t e x t : n o t e
BUG_ T A B L E : t e x t
RODATA
. = ALIGN( 4 ) ;
.tracedata : AT( A D D R ( . t r a c e d a t a ) - L O A D _ O F F S E T ) {
_ _ tracedata_ s t a r t = . ;
* ( .tracedata )
_ _ tracedata_ e n d = . ;
}
2008-02-17 18:17:17 +03:00
. = ALIGN( P A G E _ S I Z E ) ; /* Align data segment to page size boundary */
2007-10-11 11:14:21 +02:00
/* Data */
.data : AT( A D D R ( . d a t a ) - L O A D _ O F F S E T ) {
DATA_ D A T A
CONSTRUCTORS
} : data
_ edata = . ; /* End of data section */
. = ALIGN( P A G E _ S I Z E ) ;
. = ALIGN( C O N F I G _ X 8 6 _ L 1 _ C A C H E _ B Y T E S ) ;
.data .cacheline_aligned : AT( A D D R ( . d a t a . c a c h e l i n e _ a l i g n e d ) - L O A D _ O F F S E T ) {
* ( .data .cacheline_aligned )
}
. = ALIGN( C O N F I G _ X 8 6 _ I N T E R N O D E _ C A C H E _ B Y T E S ) ;
.data .read_mostly : AT( A D D R ( . d a t a . r e a d _ m o s t l y ) - L O A D _ O F F S E T ) {
* ( .data .read_mostly )
}
# define V S Y S C A L L _ A D D R ( - 1 0 * 1 0 2 4 * 1 0 2 4 )
# define V S Y S C A L L _ P H Y S _ A D D R ( ( L O A D A D D R ( . d a t a . r e a d _ m o s t l y ) + S I Z E O F ( . d a t a . r e a d _ m o s t l y ) + 4 0 9 5 ) & ~ ( 4 0 9 5 ) )
# define V S Y S C A L L _ V I R T _ A D D R ( ( A D D R ( . d a t a . r e a d _ m o s t l y ) + S I Z E O F ( . d a t a . r e a d _ m o s t l y ) + 4 0 9 5 ) & ~ ( 4 0 9 5 ) )
# define V L O A D _ O F F S E T ( V S Y S C A L L _ A D D R - V S Y S C A L L _ P H Y S _ A D D R )
# define V L O A D ( x ) ( A D D R ( x ) - V L O A D _ O F F S E T )
# define V V I R T _ O F F S E T ( V S Y S C A L L _ A D D R - V S Y S C A L L _ V I R T _ A D D R )
# define V V I R T ( x ) ( A D D R ( x ) - V V I R T _ O F F S E T )
. = VSYSCALL_ A D D R ;
.vsyscall_0 : AT( V S Y S C A L L _ P H Y S _ A D D R ) { * ( . v s y s c a l l _ 0 ) } : u s e r
_ _ vsyscall_ 0 = V S Y S C A L L _ V I R T _ A D D R ;
. = ALIGN( C O N F I G _ X 8 6 _ L 1 _ C A C H E _ B Y T E S ) ;
.vsyscall_fn : AT( V L O A D ( . v s y s c a l l _ f n ) ) { * ( . v s y s c a l l _ f n ) }
. = ALIGN( C O N F I G _ X 8 6 _ L 1 _ C A C H E _ B Y T E S ) ;
.vsyscall_gtod_data : AT( V L O A D ( . v s y s c a l l _ g t o d _ d a t a ) )
{ * ( .vsyscall_gtod_data ) }
vsyscall_ g t o d _ d a t a = V V I R T ( . v s y s c a l l _ g t o d _ d a t a ) ;
.vsyscall_clock : AT( V L O A D ( . v s y s c a l l _ c l o c k ) )
{ * ( .vsyscall_clock ) }
vsyscall_ c l o c k = V V I R T ( . v s y s c a l l _ c l o c k ) ;
.vsyscall_1 ADDR( . v s y s c a l l _ 0 ) + 1 0 2 4 : A T ( V L O A D ( . v s y s c a l l _ 1 ) )
{ * ( .vsyscall_1 ) }
.vsyscall_2 ADDR( . v s y s c a l l _ 0 ) + 2 0 4 8 : A T ( V L O A D ( . v s y s c a l l _ 2 ) )
{ * ( .vsyscall_2 ) }
.vgetcpu_mode : AT( V L O A D ( . v g e t c p u _ m o d e ) ) { * ( . v g e t c p u _ m o d e ) }
vgetcpu_ m o d e = V V I R T ( . v g e t c p u _ m o d e ) ;
. = ALIGN( C O N F I G _ X 8 6 _ L 1 _ C A C H E _ B Y T E S ) ;
.jiffies : AT( V L O A D ( . j i f f i e s ) ) { * ( . j i f f i e s ) }
jiffies = V V I R T ( . j i f f i e s ) ;
.vsyscall_3 ADDR( . v s y s c a l l _ 0 ) + 3 0 7 2 : A T ( V L O A D ( . v s y s c a l l _ 3 ) )
{ * ( .vsyscall_3 ) }
2008-02-17 18:17:17 +03:00
. = VSYSCALL_ V I R T _ A D D R + P A G E _ S I Z E ;
2007-10-11 11:14:21 +02:00
# undef V S Y S C A L L _ A D D R
# undef V S Y S C A L L _ P H Y S _ A D D R
# undef V S Y S C A L L _ V I R T _ A D D R
# undef V L O A D _ O F F S E T
# undef V L O A D
# undef V V I R T _ O F F S E T
# undef V V I R T
2008-02-17 18:17:18 +03:00
. = ALIGN( T H R E A D _ S I Z E ) ; /* init_task */
2007-10-11 11:14:21 +02:00
.data .init_task : AT( A D D R ( . d a t a . i n i t _ t a s k ) - L O A D _ O F F S E T ) {
* ( .data .init_task )
} : data. i n i t
2008-02-17 18:17:17 +03:00
. = ALIGN( P A G E _ S I Z E ) ;
2007-10-11 11:14:21 +02:00
.data .page_aligned : AT( A D D R ( . d a t a . p a g e _ a l i g n e d ) - L O A D _ O F F S E T ) {
* ( .data .page_aligned )
}
/* might get freed after init */
2008-02-17 18:17:17 +03:00
. = ALIGN( P A G E _ S I Z E ) ;
2007-10-11 11:14:21 +02:00
_ _ smp_ a l t _ b e g i n = . ;
_ _ smp_ l o c k s = . ;
.smp_locks : AT( A D D R ( . s m p _ l o c k s ) - L O A D _ O F F S E T ) {
* ( .smp_locks )
}
_ _ smp_ l o c k s _ e n d = . ;
2008-02-17 18:17:17 +03:00
. = ALIGN( P A G E _ S I Z E ) ;
2007-10-11 11:14:21 +02:00
_ _ smp_ a l t _ e n d = . ;
2008-02-17 18:17:17 +03:00
. = ALIGN( P A G E _ S I Z E ) ; /* Init code and data */
2007-10-11 11:14:21 +02:00
_ _ init_ b e g i n = . ;
.init .text : AT( A D D R ( . i n i t . t e x t ) - L O A D _ O F F S E T ) {
_ sinittext = . ;
2008-01-20 14:15:03 +01:00
INIT_ T E X T
2007-10-11 11:14:21 +02:00
_ einittext = . ;
}
2008-01-20 14:15:03 +01:00
.init .data : AT( A D D R ( . i n i t . d a t a ) - L O A D _ O F F S E T ) {
_ _ initdata_ b e g i n = . ;
INIT_ D A T A
_ _ initdata_ e n d = . ;
}
2007-10-11 11:14:21 +02:00
. = ALIGN( 1 6 ) ;
_ _ setup_ s t a r t = . ;
.init .setup : AT( A D D R ( . i n i t . s e t u p ) - L O A D _ O F F S E T ) { * ( . i n i t . s e t u p ) }
_ _ setup_ e n d = . ;
_ _ initcall_ s t a r t = . ;
.initcall .init : AT( A D D R ( . i n i t c a l l . i n i t ) - L O A D _ O F F S E T ) {
INITCALLS
}
_ _ initcall_ e n d = . ;
_ _ con_ i n i t c a l l _ s t a r t = . ;
.con_initcall .init : AT( A D D R ( . c o n _ i n i t c a l l . i n i t ) - L O A D _ O F F S E T ) {
* ( .con_initcall .init )
}
_ _ con_ i n i t c a l l _ e n d = . ;
SECURITY_ I N I T
2008-01-30 13:33:19 +01:00
. = ALIGN( 8 ) ;
.parainstructions : AT( A D D R ( . p a r a i n s t r u c t i o n s ) - L O A D _ O F F S E T ) {
_ _ parainstructions = . ;
* ( .parainstructions )
_ _ parainstructions_ e n d = . ;
}
2007-10-11 11:14:21 +02:00
. = ALIGN( 8 ) ;
_ _ alt_ i n s t r u c t i o n s = . ;
.altinstructions : AT( A D D R ( . a l t i n s t r u c t i o n s ) - L O A D _ O F F S E T ) {
* ( .altinstructions )
}
2008-02-17 18:17:17 +03:00
_ _ alt_ i n s t r u c t i o n s _ e n d = . ;
2007-10-11 11:14:21 +02:00
.altinstr_replacement : AT( A D D R ( . a l t i n s t r _ r e p l a c e m e n t ) - L O A D _ O F F S E T ) {
* ( .altinstr_replacement )
}
/ * .exit .text is discard a t r u n t i m e , n o t l i n k t i m e , t o d e a l w i t h r e f e r e n c e s
from . a l t i n s t r u c t i o n s a n d . e h _ f r a m e * /
2008-01-20 14:15:03 +01:00
.exit .text : AT( A D D R ( . e x i t . t e x t ) - L O A D _ O F F S E T ) {
EXIT_ T E X T
}
.exit .data : AT( A D D R ( . e x i t . d a t a ) - L O A D _ O F F S E T ) {
EXIT_ D A T A
}
2007-10-11 11:14:21 +02:00
/* vdso blob that is mapped into user space */
vdso_ s t a r t = . ;
.vdso : AT( A D D R ( . v d s o ) - L O A D _ O F F S E T ) { * ( . v d s o ) }
2008-02-17 18:17:17 +03:00
. = ALIGN( P A G E _ S I Z E ) ;
2007-10-11 11:14:21 +02:00
vdso_ e n d = . ;
# ifdef C O N F I G _ B L K _ D E V _ I N I T R D
2008-02-17 18:17:17 +03:00
. = ALIGN( P A G E _ S I Z E ) ;
2007-10-11 11:14:21 +02:00
_ _ initramfs_ s t a r t = . ;
.init .ramfs : AT( A D D R ( . i n i t . r a m f s ) - L O A D _ O F F S E T ) { * ( . i n i t . r a m f s ) }
_ _ initramfs_ e n d = . ;
# endif
2008-02-17 18:17:17 +03:00
PERCPU( P A G E _ S I Z E )
2007-10-11 11:14:21 +02:00
2008-02-17 18:17:17 +03:00
. = ALIGN( P A G E _ S I Z E ) ;
2007-10-11 11:14:21 +02:00
_ _ init_ e n d = . ;
2008-02-17 18:17:17 +03:00
. = ALIGN( P A G E _ S I Z E ) ;
2007-10-11 11:14:21 +02:00
_ _ nosave_ b e g i n = . ;
.data_nosave : AT( A D D R ( . d a t a _ n o s a v e ) - L O A D _ O F F S E T ) { * ( . d a t a . n o s a v e ) }
2008-02-17 18:17:17 +03:00
. = ALIGN( P A G E _ S I Z E ) ;
2007-10-11 11:14:21 +02:00
_ _ nosave_ e n d = . ;
_ _ bss_ s t a r t = . ; /* BSS */
.bss : AT( A D D R ( . b s s ) - L O A D _ O F F S E T ) {
* ( .bss .page_aligned )
* ( .bss )
}
_ _ bss_ s t o p = . ;
_ end = . ;
/* Sections to be discarded */
/ DISCARD/ : {
* ( .exitcall .exit )
* ( .eh_frame )
}
STABS_ D E B U G
DWARF_ D E B U G
}