2005-04-16 15:20:36 -07:00
/ * ld s c r i p t t o m a k e A R M L i n u x k e r n e l
* taken f r o m t h e i 3 8 6 v e r s i o n b y R u s s e l l K i n g
* Written b y M a r t i n M a r e s < m j @atrey.karlin.mff.cuni.cz>
* /
# include < a s m - g e n e r i c / v m l i n u x . l d s . h >
2012-01-20 11:55:54 +01:00
# include < a s m / c a c h e . h >
2005-05-05 13:11:00 +01:00
# include < a s m / t h r e a d _ i n f o . h >
2005-10-29 21:44:56 +01:00
# include < a s m / m e m o r y . h >
2009-06-24 23:38:56 +01:00
# include < a s m / p a g e . h >
2014-04-03 17:28:11 -07:00
# ifdef C O N F I G _ A R M _ K E R N M E M _ P E R M S
# include < a s m / p g t a b l e . h >
# endif
2015-03-23 10:52:57 +00:00
2010-10-01 15:37:05 +01:00
# define P R O C _ I N F O \
2012-02-07 02:46:38 +01:00
. = ALIGN( 4 ) ; \
2010-10-01 15:37:05 +01:00
VMLINUX_ S Y M B O L ( _ _ p r o c _ i n f o _ b e g i n ) = . ; \
* ( .proc .info .init ) \
VMLINUX_ S Y M B O L ( _ _ p r o c _ i n f o _ e n d ) = . ;
2011-09-30 11:43:29 +01:00
# define I D M A P _ T E X T \
ALIGN_ F U N C T I O N ( ) ; \
VMLINUX_ S Y M B O L ( _ _ i d m a p _ t e x t _ s t a r t ) = . ; \
* ( .idmap .text ) \
2013-01-20 18:43:10 -05:00
VMLINUX_ S Y M B O L ( _ _ i d m a p _ t e x t _ e n d ) = . ; \
2015-03-27 10:18:01 +00:00
. = ALIGN( P A G E _ S I Z E ) ; \
2013-01-20 18:43:10 -05:00
VMLINUX_ S Y M B O L ( _ _ h y p _ i d m a p _ t e x t _ s t a r t ) = . ; \
* ( .hyp .idmap .text ) \
VMLINUX_ S Y M B O L ( _ _ h y p _ i d m a p _ t e x t _ e n d ) = . ;
2011-09-30 11:43:29 +01:00
2010-10-01 15:37:05 +01:00
# ifdef C O N F I G _ H O T P L U G _ C P U
# define A R M _ C P U _ D I S C A R D ( x )
# define A R M _ C P U _ K E E P ( x ) x
# else
# define A R M _ C P U _ D I S C A R D ( x ) x
# define A R M _ C P U _ K E E P ( x )
# endif
2011-08-16 23:44:26 +01:00
# if ( d e f i n e d ( C O N F I G _ S M P _ O N _ U P ) & & ! d e f i n e d ( C O N F I G _ D E B U G _ S P I N L O C K ) ) | | \
defined( C O N F I G _ G E N E R I C _ B U G )
2011-02-21 10:13:36 +00:00
# define A R M _ E X I T _ K E E P ( x ) x
ARM: fix vmlinux.lds.S discarding sections
We are seeing linker errors caused by sections being discarded, despite
the linker script trying to keep them. The result is (eg):
`.exit.text' referenced in section `.alt.smp.init' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
`.exit.text' referenced in section `.alt.smp.init' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o
This is the relevent part of the linker script (reformatted to make it
clearer):
| SECTIONS
| {
| /*
| * unwind exit sections must be discarded before the rest of the
| * unwind sections get included.
| */
| /DISCARD/ : {
| *(.ARM.exidx.exit.text)
| *(.ARM.extab.exit.text)
| }
| ...
| .exit.text : {
| *(.exit.text)
| *(.memexit.text)
| }
| ...
| /DISCARD/ : {
| *(.exit.text)
| *(.memexit.text)
| *(.exit.data)
| *(.memexit.data)
| *(.memexit.rodata)
| *(.exitcall.exit)
| *(.discard)
| *(.discard.*)
| }
| }
Now, this is what the linker manual says about discarded output sections:
| The special output section name `/DISCARD/' may be used to discard
| input sections. Any input sections which are assigned to an output
| section named `/DISCARD/' are not included in the output file.
No questions, no exceptions. It doesn't say "unless they are listed
before the /DISCARD/ section." Now, this is what asn-generic/vmlinux.lds.S
says:
| /*
| * Default discarded sections.
| *
| * Some archs want to discard exit text/data at runtime rather than
| * link time due to cross-section references such as alt instructions,
| * bug table, eh_frame, etc. DISCARDS must be the last of output
| * section definitions so that such archs put those in earlier section
| * definitions.
| */
And guess what - the list _always_ includes .exit.text etc.
Now, what's actually happening is that the linker is reading the script,
and it finds the first /DISCARD/ output section at the beginning of the
script. It continues reading the script, and finds the 'DISCARD' macro
at the end, which having been postprocessed results in another
/DISCARD/ output section. As the linker already contains the earlier
/DISCARD/ output section, it adds it to that existing section, so it
effectively is placed at the start. This can be seen by using the -M
option to ld:
| Linker script and memory map
|
| 0xc037c080 jiffies = jiffies_64
|
| /DISCARD/
| *(.ARM.exidx.exit.text)
| *(.ARM.extab.exit.text)
| *(.exit.text)
| *(.memexit.text)
| *(.exit.data)
| *(.memexit.data)
| *(.memexit.rodata)
| *(.exitcall.exit)
| *(.discard)
| *(.discard.*)
|
| 0xc0008000 . = 0xc0008000
|
| .head.text 0xc0008000 0x1d0
| 0xc0008000 _text = .
| *(.head.text)
| .head.text 0xc0008000 0x1d0 arch/arm/kernel/head.o
| 0xc0008000 stext
|
| .text 0xc0008200 0x2d78d0
| 0xc0008200 _stext = .
| 0xc0008200 __exception_text_start = .
| *(.exception.text)
| .exception.text
| ...
As you can see, all the discarded sections are grouped together - and
as a result of it being the first output section, they all appear before
any other section.
The result is that not only is the unwind information discarded (as
intended), but also the .exit.text, despite us wanting to have the
.exit.text preserved.
We can't move the unwind information elsewhere, because it'll then be
included even when we do actually discard the .exit.text (and similar)
sections.
So, work around this by avoiding the generic DISCARDS macro, and instead
conditionalize the sections to be discarded ourselves. This avoids the
ambiguity in how the linker assigns input sections to output sections,
making our script less dependent on undocumented linker behaviour.
Reported-by: Rob Herring <robherring2@gmail.com>
Tested-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-09-20 23:35:15 +01:00
# define A R M _ E X I T _ D I S C A R D ( x )
2011-02-21 10:13:36 +00:00
# else
# define A R M _ E X I T _ K E E P ( x )
ARM: fix vmlinux.lds.S discarding sections
We are seeing linker errors caused by sections being discarded, despite
the linker script trying to keep them. The result is (eg):
`.exit.text' referenced in section `.alt.smp.init' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
`.exit.text' referenced in section `.alt.smp.init' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o
This is the relevent part of the linker script (reformatted to make it
clearer):
| SECTIONS
| {
| /*
| * unwind exit sections must be discarded before the rest of the
| * unwind sections get included.
| */
| /DISCARD/ : {
| *(.ARM.exidx.exit.text)
| *(.ARM.extab.exit.text)
| }
| ...
| .exit.text : {
| *(.exit.text)
| *(.memexit.text)
| }
| ...
| /DISCARD/ : {
| *(.exit.text)
| *(.memexit.text)
| *(.exit.data)
| *(.memexit.data)
| *(.memexit.rodata)
| *(.exitcall.exit)
| *(.discard)
| *(.discard.*)
| }
| }
Now, this is what the linker manual says about discarded output sections:
| The special output section name `/DISCARD/' may be used to discard
| input sections. Any input sections which are assigned to an output
| section named `/DISCARD/' are not included in the output file.
No questions, no exceptions. It doesn't say "unless they are listed
before the /DISCARD/ section." Now, this is what asn-generic/vmlinux.lds.S
says:
| /*
| * Default discarded sections.
| *
| * Some archs want to discard exit text/data at runtime rather than
| * link time due to cross-section references such as alt instructions,
| * bug table, eh_frame, etc. DISCARDS must be the last of output
| * section definitions so that such archs put those in earlier section
| * definitions.
| */
And guess what - the list _always_ includes .exit.text etc.
Now, what's actually happening is that the linker is reading the script,
and it finds the first /DISCARD/ output section at the beginning of the
script. It continues reading the script, and finds the 'DISCARD' macro
at the end, which having been postprocessed results in another
/DISCARD/ output section. As the linker already contains the earlier
/DISCARD/ output section, it adds it to that existing section, so it
effectively is placed at the start. This can be seen by using the -M
option to ld:
| Linker script and memory map
|
| 0xc037c080 jiffies = jiffies_64
|
| /DISCARD/
| *(.ARM.exidx.exit.text)
| *(.ARM.extab.exit.text)
| *(.exit.text)
| *(.memexit.text)
| *(.exit.data)
| *(.memexit.data)
| *(.memexit.rodata)
| *(.exitcall.exit)
| *(.discard)
| *(.discard.*)
|
| 0xc0008000 . = 0xc0008000
|
| .head.text 0xc0008000 0x1d0
| 0xc0008000 _text = .
| *(.head.text)
| .head.text 0xc0008000 0x1d0 arch/arm/kernel/head.o
| 0xc0008000 stext
|
| .text 0xc0008200 0x2d78d0
| 0xc0008200 _stext = .
| 0xc0008200 __exception_text_start = .
| *(.exception.text)
| .exception.text
| ...
As you can see, all the discarded sections are grouped together - and
as a result of it being the first output section, they all appear before
any other section.
The result is that not only is the unwind information discarded (as
intended), but also the .exit.text, despite us wanting to have the
.exit.text preserved.
We can't move the unwind information elsewhere, because it'll then be
included even when we do actually discard the .exit.text (and similar)
sections.
So, work around this by avoiding the generic DISCARDS macro, and instead
conditionalize the sections to be discarded ourselves. This avoids the
ambiguity in how the linker assigns input sections to output sections,
making our script less dependent on undocumented linker behaviour.
Reported-by: Rob Herring <robherring2@gmail.com>
Tested-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-09-20 23:35:15 +01:00
# define A R M _ E X I T _ D I S C A R D ( x ) x
2011-02-21 10:13:36 +00:00
# endif
2005-04-16 15:20:36 -07:00
OUTPUT_ A R C H ( a r m )
ENTRY( s t e x t )
2005-10-29 21:44:56 +01:00
2005-04-16 15:20:36 -07:00
# ifndef _ _ A R M E B _ _
jiffies = j i f f i e s _ 6 4 ;
# else
jiffies = j i f f i e s _ 6 4 + 4 ;
# endif
2005-10-29 21:44:56 +01:00
2006-01-03 17:28:33 +00:00
SECTIONS
{
2011-05-26 11:25:33 +01:00
/ *
ARM: fix vmlinux.lds.S discarding sections
We are seeing linker errors caused by sections being discarded, despite
the linker script trying to keep them. The result is (eg):
`.exit.text' referenced in section `.alt.smp.init' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
`.exit.text' referenced in section `.alt.smp.init' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o
This is the relevent part of the linker script (reformatted to make it
clearer):
| SECTIONS
| {
| /*
| * unwind exit sections must be discarded before the rest of the
| * unwind sections get included.
| */
| /DISCARD/ : {
| *(.ARM.exidx.exit.text)
| *(.ARM.extab.exit.text)
| }
| ...
| .exit.text : {
| *(.exit.text)
| *(.memexit.text)
| }
| ...
| /DISCARD/ : {
| *(.exit.text)
| *(.memexit.text)
| *(.exit.data)
| *(.memexit.data)
| *(.memexit.rodata)
| *(.exitcall.exit)
| *(.discard)
| *(.discard.*)
| }
| }
Now, this is what the linker manual says about discarded output sections:
| The special output section name `/DISCARD/' may be used to discard
| input sections. Any input sections which are assigned to an output
| section named `/DISCARD/' are not included in the output file.
No questions, no exceptions. It doesn't say "unless they are listed
before the /DISCARD/ section." Now, this is what asn-generic/vmlinux.lds.S
says:
| /*
| * Default discarded sections.
| *
| * Some archs want to discard exit text/data at runtime rather than
| * link time due to cross-section references such as alt instructions,
| * bug table, eh_frame, etc. DISCARDS must be the last of output
| * section definitions so that such archs put those in earlier section
| * definitions.
| */
And guess what - the list _always_ includes .exit.text etc.
Now, what's actually happening is that the linker is reading the script,
and it finds the first /DISCARD/ output section at the beginning of the
script. It continues reading the script, and finds the 'DISCARD' macro
at the end, which having been postprocessed results in another
/DISCARD/ output section. As the linker already contains the earlier
/DISCARD/ output section, it adds it to that existing section, so it
effectively is placed at the start. This can be seen by using the -M
option to ld:
| Linker script and memory map
|
| 0xc037c080 jiffies = jiffies_64
|
| /DISCARD/
| *(.ARM.exidx.exit.text)
| *(.ARM.extab.exit.text)
| *(.exit.text)
| *(.memexit.text)
| *(.exit.data)
| *(.memexit.data)
| *(.memexit.rodata)
| *(.exitcall.exit)
| *(.discard)
| *(.discard.*)
|
| 0xc0008000 . = 0xc0008000
|
| .head.text 0xc0008000 0x1d0
| 0xc0008000 _text = .
| *(.head.text)
| .head.text 0xc0008000 0x1d0 arch/arm/kernel/head.o
| 0xc0008000 stext
|
| .text 0xc0008200 0x2d78d0
| 0xc0008200 _stext = .
| 0xc0008200 __exception_text_start = .
| *(.exception.text)
| .exception.text
| ...
As you can see, all the discarded sections are grouped together - and
as a result of it being the first output section, they all appear before
any other section.
The result is that not only is the unwind information discarded (as
intended), but also the .exit.text, despite us wanting to have the
.exit.text preserved.
We can't move the unwind information elsewhere, because it'll then be
included even when we do actually discard the .exit.text (and similar)
sections.
So, work around this by avoiding the generic DISCARDS macro, and instead
conditionalize the sections to be discarded ourselves. This avoids the
ambiguity in how the linker assigns input sections to output sections,
making our script less dependent on undocumented linker behaviour.
Reported-by: Rob Herring <robherring2@gmail.com>
Tested-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-09-20 23:35:15 +01:00
* XXX : The l i n k e r d o e s n o t d e f i n e h o w o u t p u t s e c t i o n s a r e
* assigned t o i n p u t s e c t i o n s w h e n t h e r e a r e m u l t i p l e s t a t e m e n t s
* matching t h e s a m e i n p u t s e c t i o n n a m e . T h e r e i s n o d o c u m e n t e d
* order o f m a t c h i n g .
*
2011-05-26 11:25:33 +01:00
* unwind e x i t s e c t i o n s m u s t b e d i s c a r d e d b e f o r e t h e r e s t o f t h e
* unwind s e c t i o n s g e t i n c l u d e d .
* /
/ DISCARD/ : {
* ( .ARM .exidx .exit .text )
* ( .ARM .extab .exit .text )
ARM_ C P U _ D I S C A R D ( * ( . A R M . e x i d x . c p u e x i t . t e x t ) )
ARM_ C P U _ D I S C A R D ( * ( . A R M . e x t a b . c p u e x i t . t e x t ) )
ARM: fix vmlinux.lds.S discarding sections
We are seeing linker errors caused by sections being discarded, despite
the linker script trying to keep them. The result is (eg):
`.exit.text' referenced in section `.alt.smp.init' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
`.exit.text' referenced in section `.alt.smp.init' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o
This is the relevent part of the linker script (reformatted to make it
clearer):
| SECTIONS
| {
| /*
| * unwind exit sections must be discarded before the rest of the
| * unwind sections get included.
| */
| /DISCARD/ : {
| *(.ARM.exidx.exit.text)
| *(.ARM.extab.exit.text)
| }
| ...
| .exit.text : {
| *(.exit.text)
| *(.memexit.text)
| }
| ...
| /DISCARD/ : {
| *(.exit.text)
| *(.memexit.text)
| *(.exit.data)
| *(.memexit.data)
| *(.memexit.rodata)
| *(.exitcall.exit)
| *(.discard)
| *(.discard.*)
| }
| }
Now, this is what the linker manual says about discarded output sections:
| The special output section name `/DISCARD/' may be used to discard
| input sections. Any input sections which are assigned to an output
| section named `/DISCARD/' are not included in the output file.
No questions, no exceptions. It doesn't say "unless they are listed
before the /DISCARD/ section." Now, this is what asn-generic/vmlinux.lds.S
says:
| /*
| * Default discarded sections.
| *
| * Some archs want to discard exit text/data at runtime rather than
| * link time due to cross-section references such as alt instructions,
| * bug table, eh_frame, etc. DISCARDS must be the last of output
| * section definitions so that such archs put those in earlier section
| * definitions.
| */
And guess what - the list _always_ includes .exit.text etc.
Now, what's actually happening is that the linker is reading the script,
and it finds the first /DISCARD/ output section at the beginning of the
script. It continues reading the script, and finds the 'DISCARD' macro
at the end, which having been postprocessed results in another
/DISCARD/ output section. As the linker already contains the earlier
/DISCARD/ output section, it adds it to that existing section, so it
effectively is placed at the start. This can be seen by using the -M
option to ld:
| Linker script and memory map
|
| 0xc037c080 jiffies = jiffies_64
|
| /DISCARD/
| *(.ARM.exidx.exit.text)
| *(.ARM.extab.exit.text)
| *(.exit.text)
| *(.memexit.text)
| *(.exit.data)
| *(.memexit.data)
| *(.memexit.rodata)
| *(.exitcall.exit)
| *(.discard)
| *(.discard.*)
|
| 0xc0008000 . = 0xc0008000
|
| .head.text 0xc0008000 0x1d0
| 0xc0008000 _text = .
| *(.head.text)
| .head.text 0xc0008000 0x1d0 arch/arm/kernel/head.o
| 0xc0008000 stext
|
| .text 0xc0008200 0x2d78d0
| 0xc0008200 _stext = .
| 0xc0008200 __exception_text_start = .
| *(.exception.text)
| .exception.text
| ...
As you can see, all the discarded sections are grouped together - and
as a result of it being the first output section, they all appear before
any other section.
The result is that not only is the unwind information discarded (as
intended), but also the .exit.text, despite us wanting to have the
.exit.text preserved.
We can't move the unwind information elsewhere, because it'll then be
included even when we do actually discard the .exit.text (and similar)
sections.
So, work around this by avoiding the generic DISCARDS macro, and instead
conditionalize the sections to be discarded ourselves. This avoids the
ambiguity in how the linker assigns input sections to output sections,
making our script less dependent on undocumented linker behaviour.
Reported-by: Rob Herring <robherring2@gmail.com>
Tested-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-09-20 23:35:15 +01:00
ARM_ E X I T _ D I S C A R D ( E X I T _ T E X T )
ARM_ E X I T _ D I S C A R D ( E X I T _ D A T A )
EXIT_ C A L L
2011-05-26 11:25:33 +01:00
# ifndef C O N F I G _ M M U
2015-03-24 10:41:09 +01:00
* ( .text .fixup )
2011-05-26 11:25:33 +01:00
* ( _ _ ex_ t a b l e )
# endif
# ifndef C O N F I G _ S M P _ O N _ U P
* ( .alt .smp .init )
# endif
ARM: fix vmlinux.lds.S discarding sections
We are seeing linker errors caused by sections being discarded, despite
the linker script trying to keep them. The result is (eg):
`.exit.text' referenced in section `.alt.smp.init' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
`.exit.text' referenced in section `.alt.smp.init' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o
This is the relevent part of the linker script (reformatted to make it
clearer):
| SECTIONS
| {
| /*
| * unwind exit sections must be discarded before the rest of the
| * unwind sections get included.
| */
| /DISCARD/ : {
| *(.ARM.exidx.exit.text)
| *(.ARM.extab.exit.text)
| }
| ...
| .exit.text : {
| *(.exit.text)
| *(.memexit.text)
| }
| ...
| /DISCARD/ : {
| *(.exit.text)
| *(.memexit.text)
| *(.exit.data)
| *(.memexit.data)
| *(.memexit.rodata)
| *(.exitcall.exit)
| *(.discard)
| *(.discard.*)
| }
| }
Now, this is what the linker manual says about discarded output sections:
| The special output section name `/DISCARD/' may be used to discard
| input sections. Any input sections which are assigned to an output
| section named `/DISCARD/' are not included in the output file.
No questions, no exceptions. It doesn't say "unless they are listed
before the /DISCARD/ section." Now, this is what asn-generic/vmlinux.lds.S
says:
| /*
| * Default discarded sections.
| *
| * Some archs want to discard exit text/data at runtime rather than
| * link time due to cross-section references such as alt instructions,
| * bug table, eh_frame, etc. DISCARDS must be the last of output
| * section definitions so that such archs put those in earlier section
| * definitions.
| */
And guess what - the list _always_ includes .exit.text etc.
Now, what's actually happening is that the linker is reading the script,
and it finds the first /DISCARD/ output section at the beginning of the
script. It continues reading the script, and finds the 'DISCARD' macro
at the end, which having been postprocessed results in another
/DISCARD/ output section. As the linker already contains the earlier
/DISCARD/ output section, it adds it to that existing section, so it
effectively is placed at the start. This can be seen by using the -M
option to ld:
| Linker script and memory map
|
| 0xc037c080 jiffies = jiffies_64
|
| /DISCARD/
| *(.ARM.exidx.exit.text)
| *(.ARM.extab.exit.text)
| *(.exit.text)
| *(.memexit.text)
| *(.exit.data)
| *(.memexit.data)
| *(.memexit.rodata)
| *(.exitcall.exit)
| *(.discard)
| *(.discard.*)
|
| 0xc0008000 . = 0xc0008000
|
| .head.text 0xc0008000 0x1d0
| 0xc0008000 _text = .
| *(.head.text)
| .head.text 0xc0008000 0x1d0 arch/arm/kernel/head.o
| 0xc0008000 stext
|
| .text 0xc0008200 0x2d78d0
| 0xc0008200 _stext = .
| 0xc0008200 __exception_text_start = .
| *(.exception.text)
| .exception.text
| ...
As you can see, all the discarded sections are grouped together - and
as a result of it being the first output section, they all appear before
any other section.
The result is that not only is the unwind information discarded (as
intended), but also the .exit.text, despite us wanting to have the
.exit.text preserved.
We can't move the unwind information elsewhere, because it'll then be
included even when we do actually discard the .exit.text (and similar)
sections.
So, work around this by avoiding the generic DISCARDS macro, and instead
conditionalize the sections to be discarded ourselves. This avoids the
ambiguity in how the linker assigns input sections to output sections,
making our script less dependent on undocumented linker behaviour.
Reported-by: Rob Herring <robherring2@gmail.com>
Tested-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-09-20 23:35:15 +01:00
* ( .discard )
* ( .discard . * )
2011-05-26 11:25:33 +01:00
}
2005-10-29 21:44:56 +01:00
# ifdef C O N F I G _ X I P _ K E R N E L
2006-01-03 17:28:33 +00:00
. = XIP_ V I R T _ A D D R ( C O N F I G _ X I P _ P H Y S _ A D D R ) ;
2005-10-29 21:44:56 +01:00
# else
2006-01-03 17:28:33 +00:00
. = PAGE_ O F F S E T + T E X T _ O F F S E T ;
2005-10-29 21:44:56 +01:00
# endif
2011-07-05 22:56:41 +01:00
.head .text : {
2011-07-06 10:53:22 +01:00
_ text = . ;
2011-07-05 22:56:41 +01:00
HEAD_ T E X T
}
2014-04-03 17:28:11 -07:00
# ifdef C O N F I G _ A R M _ K E R N M E M _ P E R M S
. = ALIGN( 1 < < S E C T I O N _ S H I F T ) ;
# endif
2011-07-06 10:39:34 +01:00
.text : { /* Real text segment */
2011-07-06 10:53:22 +01:00
_ stext = . ; /* Text and read-only data */
2015-03-18 07:35:01 +01:00
IDMAP_ T E X T
2011-07-06 10:39:34 +01:00
_ _ exception_ t e x t _ s t a r t = . ;
* ( .exception .text )
_ _ exception_ t e x t _ e n d = . ;
IRQENTRY_ T E X T
TEXT_ T E X T
SCHED_ T E X T
LOCK_ T E X T
KPROBES_ T E X T
* ( .gnu .warning )
* ( .glue_7 )
* ( .glue_7t )
. = ALIGN( 4 ) ;
* ( .got ) /* Global offset table */
ARM_ C P U _ K E E P ( P R O C _ I N F O )
}
2014-04-03 13:29:50 -07:00
# ifdef C O N F I G _ D E B U G _ R O D A T A
. = ALIGN( 1 < < S E C T I O N _ S H I F T ) ;
# endif
2011-07-06 10:39:34 +01:00
RO_ D A T A ( P A G E _ S I Z E )
2012-10-29 19:19:34 +01:00
. = ALIGN( 4 ) ;
_ _ 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 = . ;
# ifdef C O N F I G _ M M U
* ( _ _ ex_ t a b l e )
# endif
_ _ stop_ _ _ e x _ t a b l e = . ;
}
2011-07-06 10:39:34 +01:00
# ifdef C O N F I G _ A R M _ U N W I N D
/ *
* Stack u n w i n d i n g t a b l e s
* /
. = ALIGN( 8 ) ;
.ARM .unwind_idx : {
_ _ start_ u n w i n d _ i d x = . ;
* ( .ARM .exidx * )
_ _ stop_ u n w i n d _ i d x = . ;
}
.ARM .unwind_tab : {
_ _ start_ u n w i n d _ t a b = . ;
* ( .ARM .extab * )
_ _ stop_ u n w i n d _ t a b = . ;
}
# endif
2012-12-14 16:46:17 +01:00
NOTES
2011-07-06 10:39:34 +01:00
_ etext = . ; /* End of text and rodata section */
# ifndef C O N F I G _ X I P _ K E R N E L
2014-04-03 17:28:11 -07:00
# ifdef C O N F I G _ A R M _ K E R N M E M _ P E R M S
. = ALIGN( 1 < < S E C T I O N _ S H I F T ) ;
# else
2011-07-06 10:39:34 +01:00
. = ALIGN( P A G E _ S I Z E ) ;
2014-04-03 17:28:11 -07:00
# endif
2011-07-06 10:39:34 +01:00
_ _ init_ b e g i n = . ;
# endif
2013-07-04 12:03:31 +01:00
/ *
* The v e c t o r s a n d s t u b s a r e r e l o c a t a b l e c o d e , a n d t h e
* only t h i n g t h a t m a t t e r s i s t h e i r r e l a t i v e o f f s e t s
* /
_ _ vectors_ s t a r t = . ;
.vectors 0 : AT( _ _ v e c t o r s _ s t a r t ) {
* ( .vectors )
}
. = _ _ vectors_ s t a r t + S I Z E O F ( . v e c t o r s ) ;
_ _ vectors_ e n d = . ;
_ _ stubs_ s t a r t = . ;
.stubs 0x1000 : AT( _ _ s t u b s _ s t a r t ) {
* ( .stubs )
}
. = _ _ stubs_ s t a r t + S I Z E O F ( . s t u b s ) ;
_ _ stubs_ e n d = . ;
2011-07-06 10:39:34 +01:00
2011-07-05 22:56:41 +01:00
INIT_ T E X T _ S E C T I O N ( 8 )
.exit .text : {
ARM_ E X I T _ K E E P ( E X I T _ T E X T )
}
.init .proc .info : {
2010-10-01 15:37:05 +01:00
ARM_ C P U _ D I S C A R D ( P R O C _ I N F O )
2011-07-05 22:56:41 +01:00
}
.init .arch .info : {
2005-04-16 15:20:36 -07:00
_ _ arch_ i n f o _ b e g i n = . ;
2011-07-05 22:56:41 +01:00
* ( .arch .info .init )
2005-04-16 15:20:36 -07:00
_ _ arch_ i n f o _ e n d = . ;
2011-07-05 22:56:41 +01:00
}
.init .tagtable : {
2005-04-16 15:20:36 -07:00
_ _ tagtable_ b e g i n = . ;
2011-07-05 22:56:41 +01:00
* ( .taglist .init )
2005-04-16 15:20:36 -07:00
_ _ tagtable_ e n d = . ;
2011-07-05 22:56:41 +01:00
}
2010-09-04 10:47:48 +01:00
# ifdef C O N F I G _ S M P _ O N _ U P
2011-07-05 22:56:41 +01:00
.init .smpalt : {
2010-09-04 10:47:48 +01:00
_ _ smpalt_ b e g i n = . ;
2011-07-05 22:56:41 +01:00
* ( .alt .smp .init )
2010-09-04 10:47:48 +01:00
_ _ smpalt_ e n d = . ;
2011-07-05 22:56:41 +01:00
}
2010-09-04 10:47:48 +01:00
# endif
2011-07-05 22:56:41 +01:00
.init .pv_table : {
ARM: P2V: introduce phys_to_virt/virt_to_phys runtime patching
This idea came from Nicolas, Eric Miao produced an initial version,
which was then rewritten into this.
Patch the physical to virtual translations at runtime. As we modify
the code, this makes it incompatible with XIP kernels, but allows us
to achieve this with minimal loss of performance.
As many translations are of the form:
physical = virtual + (PHYS_OFFSET - PAGE_OFFSET)
virtual = physical - (PHYS_OFFSET - PAGE_OFFSET)
we generate an 'add' instruction for __virt_to_phys(), and a 'sub'
instruction for __phys_to_virt(). We calculate at run time (PHYS_OFFSET
- PAGE_OFFSET) by comparing the address prior to MMU initialization with
where it should be once the MMU has been initialized, and place this
constant into the above add/sub instructions.
Once we have (PHYS_OFFSET - PAGE_OFFSET), we can calculate the real
PHYS_OFFSET as PAGE_OFFSET is a build-time constant, and save this for
the C-mode PHYS_OFFSET variable definition to use.
At present, we are unable to support Realview with Sparsemem enabled
as this uses a complex mapping function, and MSM as this requires a
constant which will not fit in our math instruction.
Add a module version magic string for this feature to prevent
incompatible modules being loaded.
Tested-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Tested-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-01-04 19:09:43 +00:00
_ _ pv_ t a b l e _ b e g i n = . ;
2011-07-05 22:56:41 +01:00
* ( .pv_table )
ARM: P2V: introduce phys_to_virt/virt_to_phys runtime patching
This idea came from Nicolas, Eric Miao produced an initial version,
which was then rewritten into this.
Patch the physical to virtual translations at runtime. As we modify
the code, this makes it incompatible with XIP kernels, but allows us
to achieve this with minimal loss of performance.
As many translations are of the form:
physical = virtual + (PHYS_OFFSET - PAGE_OFFSET)
virtual = physical - (PHYS_OFFSET - PAGE_OFFSET)
we generate an 'add' instruction for __virt_to_phys(), and a 'sub'
instruction for __phys_to_virt(). We calculate at run time (PHYS_OFFSET
- PAGE_OFFSET) by comparing the address prior to MMU initialization with
where it should be once the MMU has been initialized, and place this
constant into the above add/sub instructions.
Once we have (PHYS_OFFSET - PAGE_OFFSET), we can calculate the real
PHYS_OFFSET as PAGE_OFFSET is a build-time constant, and save this for
the C-mode PHYS_OFFSET variable definition to use.
At present, we are unable to support Realview with Sparsemem enabled
as this uses a complex mapping function, and MSM as this requires a
constant which will not fit in our math instruction.
Add a module version magic string for this feature to prevent
incompatible modules being loaded.
Tested-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Tested-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-01-04 19:09:43 +00:00
_ _ pv_ t a b l e _ e n d = . ;
2011-07-05 22:56:41 +01:00
}
.init .data : {
# ifndef C O N F I G _ X I P _ K E R N E L
INIT_ D A T A
# endif
2009-10-02 16:32:47 -04:00
INIT_ S E T U P ( 1 6 )
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
2011-07-05 22:56:41 +01:00
}
2005-04-16 15:20:36 -07:00
# ifndef C O N F I G _ X I P _ K E R N E L
2011-07-05 22:56:41 +01:00
.exit .data : {
2011-02-21 10:13:36 +00:00
ARM_ E X I T _ K E E P ( E X I T _ D A T A )
2005-04-16 15:20:36 -07:00
}
2011-07-05 22:56:41 +01:00
# endif
2005-04-16 15:20:36 -07:00
ARM: 7428/1: Prevent KALLSYM size mismatch on ARM.
ARM builds seem to be plagued by an occasional build error:
Inconsistent kallsyms data
This is a bug - please report about it
Try "make KALLSYMS_EXTRA_PASS=1" as a workaround
The problem has to do with alignment of some sections by the linker.
The kallsyms data is built in two passes by first linking the kernel
without it, and then linking the kernel again with the symbols
included. Normally, this just shifts the symbols, without changing
their order, and the compression used by the kallsyms gives the same
result.
On non SMP, the per CPU data is empty. Depending on the where the
alignment ends up, it can come out as either:
+-------------------+
| last text segment |
+-------------------+
/* padding */
+-------------------+ <- L1_CACHE_BYTES alignemnt
| per cpu (empty) |
+-------------------+
__per_cpu_end:
/* padding */
__data_loc:
+-------------------+ <- THREAD_SIZE alignment
| data |
+-------------------+
or
+-------------------+
| last text segment |
+-------------------+
/* padding */
+-------------------+ <- L1_CACHE_BYTES alignemnt
| per cpu (empty) |
+-------------------+
__per_cpu_end:
/* no padding */
__data_loc:
+-------------------+ <- THREAD_SIZE alignment
| data |
+-------------------+
if the alignment satisfies both. Because symbols that have the same
address are sorted by 'nm -n', the second case will be in a different
order than the first case. This changes the compression, changing the
size of the kallsym data, causing the build failure.
The KALLSYMS_EXTRA_PASS=1 workaround usually works, but it is still
possible to have the alignment change between the second and third
pass. It's probably even possible for it to never reach a fixedpoint.
The problem only occurs on non-SMP, when the per-cpu data is empty,
and when the data segment has alignment (and immediately follows the
text segments). Fix this by only including the per_cpu section on
SMP, when it is not empty.
Signed-off-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-06-20 22:52:24 +01:00
# ifdef C O N F I G _ S M P
2012-01-20 11:55:54 +01:00
PERCPU_ S E C T I O N ( L 1 _ C A C H E _ B Y T E S )
ARM: 7428/1: Prevent KALLSYM size mismatch on ARM.
ARM builds seem to be plagued by an occasional build error:
Inconsistent kallsyms data
This is a bug - please report about it
Try "make KALLSYMS_EXTRA_PASS=1" as a workaround
The problem has to do with alignment of some sections by the linker.
The kallsyms data is built in two passes by first linking the kernel
without it, and then linking the kernel again with the symbols
included. Normally, this just shifts the symbols, without changing
their order, and the compression used by the kallsyms gives the same
result.
On non SMP, the per CPU data is empty. Depending on the where the
alignment ends up, it can come out as either:
+-------------------+
| last text segment |
+-------------------+
/* padding */
+-------------------+ <- L1_CACHE_BYTES alignemnt
| per cpu (empty) |
+-------------------+
__per_cpu_end:
/* padding */
__data_loc:
+-------------------+ <- THREAD_SIZE alignment
| data |
+-------------------+
or
+-------------------+
| last text segment |
+-------------------+
/* padding */
+-------------------+ <- L1_CACHE_BYTES alignemnt
| per cpu (empty) |
+-------------------+
__per_cpu_end:
/* no padding */
__data_loc:
+-------------------+ <- THREAD_SIZE alignment
| data |
+-------------------+
if the alignment satisfies both. Because symbols that have the same
address are sorted by 'nm -n', the second case will be in a different
order than the first case. This changes the compression, changing the
size of the kallsym data, causing the build failure.
The KALLSYMS_EXTRA_PASS=1 workaround usually works, but it is still
possible to have the alignment change between the second and third
pass. It's probably even possible for it to never reach a fixedpoint.
The problem only occurs on non-SMP, when the per-cpu data is empty,
and when the data segment has alignment (and immediately follows the
text segments). Fix this by only including the per_cpu section on
SMP, when it is not empty.
Signed-off-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-06-20 22:52:24 +01:00
# endif
2009-10-02 16:32:47 -04:00
2005-04-16 15:20:36 -07:00
# ifdef C O N F I G _ X I P _ K E R N E L
_ _ data_ l o c = A L I G N ( 4 ) ; /* location in binary */
2006-01-03 17:28:33 +00:00
. = PAGE_ O F F S E T + T E X T _ O F F S E T ;
2005-04-16 15:20:36 -07:00
# else
2014-04-03 17:28:11 -07:00
# ifdef C O N F I G _ A R M _ K E R N M E M _ P E R M S
. = ALIGN( 1 < < S E C T I O N _ S H I F T ) ;
2005-04-16 15:20:36 -07:00
# else
2005-05-05 13:11:00 +01:00
. = ALIGN( T H R E A D _ S I Z E ) ;
2014-04-03 17:28:11 -07:00
# endif
2014-09-26 03:30:59 +01:00
_ _ init_ e n d = . ;
2005-04-16 15:20:36 -07:00
_ _ data_ l o c = . ;
# endif
.data : AT( _ _ d a t a _ l o c ) {
2008-12-01 11:53:07 +00:00
_ data = . ; /* address in memory */
2009-05-30 14:00:17 +01:00
_ sdata = . ;
2005-04-16 15:20:36 -07:00
/ *
* first, t h e i n i t t a s k u n i o n , a l i g n e d
* to a n 8 1 9 2 b y t e b o u n d a r y .
* /
2009-10-02 16:32:47 -04:00
INIT_ T A S K _ D A T A ( T H R E A D _ S I Z E )
2005-04-16 15:20:36 -07:00
# ifdef C O N F I G _ X I P _ K E R N E L
2009-06-24 23:38:56 +01:00
. = ALIGN( P A G E _ S I Z E ) ;
2005-04-16 15:20:36 -07:00
_ _ init_ b e g i n = . ;
2008-01-20 14:15:03 +01:00
INIT_ D A T A
2011-02-21 10:13:36 +00:00
ARM_ E X I T _ K E E P ( E X I T _ D A T A )
2009-06-24 23:38:56 +01:00
. = ALIGN( P A G E _ S I Z E ) ;
2005-04-16 15:20:36 -07:00
_ _ init_ e n d = . ;
# endif
2009-10-02 16:32:47 -04:00
NOSAVE_ D A T A
2012-01-20 11:55:54 +01:00
CACHELINE_ A L I G N E D _ D A T A ( L 1 _ C A C H E _ B Y T E S )
READ_ M O S T L Y _ D A T A ( L 1 _ C A C H E _ B Y T E S )
2005-04-16 15:20:36 -07:00
/ *
* and t h e u s u a l d a t a s e c t i o n
* /
2007-05-17 13:38:44 +02:00
DATA_ D A T A
2005-04-16 15:20:36 -07:00
CONSTRUCTORS
_ edata = . ;
}
2007-02-22 16:18:09 +01:00
_ edata_ l o c = _ _ d a t a _ l o c + S I Z E O F ( . d a t a ) ;
2005-04-16 15:20:36 -07:00
2009-09-15 17:30:37 +01:00
# ifdef C O N F I G _ H A V E _ T C M
/ *
* We a l i g n e v e r y t h i n g t o a p a g e b o u n d a r y s o w e c a n
* free i t a f t e r i n i t h a s c o m m e n c e d a n d T C M c o n t e n t s h a v e
* been c o p i e d t o i t s d e s t i n a t i o n .
* /
.tcm_start : {
. = ALIGN( P A G E _ S I Z E ) ;
_ _ tcm_ s t a r t = . ;
_ _ itcm_ s t a r t = . ;
}
/ *
* Link t h e s e t o t h e I T C M R A M
* Put V M A t o t h e T C M a d d r e s s a n d L M A t o t h e c o m m o n R A M
* and w e ' l l u p l o a d t h e c o n t e n t s f r o m R A M t o T C M a n d f r e e
* the u s e d R A M a f t e r t h a t .
* /
.text_itcm ITCM_OFFSET : AT( _ _ i t c m _ s t a r t )
{
_ _ sitcm_ t e x t = . ;
* ( .tcm .text )
* ( .tcm .rodata )
. = ALIGN( 4 ) ;
_ _ eitcm_ t e x t = . ;
}
/ *
* Reset t h e d o t p o i n t e r , t h i s i s n e e d e d t o c r e a t e t h e
* relative _ _ d t c m _ s t a r t b e l o w ( t o b e u s e d a s e x t e r n i n c o d e ) .
* /
. = ADDR( . t c m _ s t a r t ) + S I Z E O F ( . t c m _ s t a r t ) + S I Z E O F ( . t e x t _ i t c m ) ;
.dtcm_start : {
_ _ dtcm_ s t a r t = . ;
}
/* TODO: add remainder of ITCM as well, that can be used for data! */
.data_dtcm DTCM_OFFSET : AT( _ _ d t c m _ s t a r t )
{
. = ALIGN( 4 ) ;
_ _ sdtcm_ d a t a = . ;
* ( .tcm .data )
. = ALIGN( 4 ) ;
_ _ edtcm_ d a t a = . ;
}
/* Reset the dot pointer or the linker gets confused */
. = ADDR( . d t c m _ s t a r t ) + S I Z E O F ( . d a t a _ d t c m ) ;
/* End marker for freeing TCM copy in linked object */
.tcm_end : AT( A D D R ( . d t c m _ s t a r t ) + S I Z E O F ( . d a t a _ d t c m ) ) {
. = ALIGN( P A G E _ S I Z E ) ;
_ _ tcm_ e n d = . ;
}
# endif
2009-10-02 16:32:47 -04:00
BSS_ S E C T I O N ( 0 , 0 , 0 )
_ end = . ;
STABS_ D E B U G
2005-04-16 15:20:36 -07:00
}
2005-11-17 16:43:14 +00:00
/ *
* These m u s t n e v e r b e e m p t y
* If y o u h a v e t o c o m m e n t t h e s e t w o a s s e r t s t a t e m e n t s o u t , y o u r
* binutils i s t o o o l d ( f o r o t h e r r e a s o n s a s w e l l )
* /
2005-04-16 15:20:36 -07:00
ASSERT( ( _ _ p r o c _ i n f o _ e n d - _ _ p r o c _ i n f o _ b e g i n ) , " m i s s i n g C P U s u p p o r t " )
ASSERT( ( _ _ a r c h _ i n f o _ e n d - _ _ a r c h _ i n f o _ b e g i n ) , " n o m a c h i n e r e c o r d d e f i n e d " )
ARM, arm64: kvm: get rid of the bounce page
The HYP init bounce page is a runtime construct that ensures that the
HYP init code does not cross a page boundary. However, this is something
we can do perfectly well at build time, by aligning the code appropriately.
For arm64, we just align to 4 KB, and enforce that the code size is less
than 4 KB, regardless of the chosen page size.
For ARM, the whole code is less than 256 bytes, so we tweak the linker
script to align at a power of 2 upper bound of the code size
Note that this also fixes a benign off-by-one error in the original bounce
page code, where a bounce page would be allocated unnecessarily if the code
was exactly 1 page in size.
On ARM, it also fixes an issue with very large kernels reported by Arnd
Bergmann, where stub sections with linker emitted veneers could erroneously
trigger the size/alignment ASSERT() in the linker script.
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2015-03-19 16:42:26 +00:00
2013-04-12 19:12:04 +01:00
/ *
ARM, arm64: kvm: get rid of the bounce page
The HYP init bounce page is a runtime construct that ensures that the
HYP init code does not cross a page boundary. However, this is something
we can do perfectly well at build time, by aligning the code appropriately.
For arm64, we just align to 4 KB, and enforce that the code size is less
than 4 KB, regardless of the chosen page size.
For ARM, the whole code is less than 256 bytes, so we tweak the linker
script to align at a power of 2 upper bound of the code size
Note that this also fixes a benign off-by-one error in the original bounce
page code, where a bounce page would be allocated unnecessarily if the code
was exactly 1 page in size.
On ARM, it also fixes an issue with very large kernels reported by Arnd
Bergmann, where stub sections with linker emitted veneers could erroneously
trigger the size/alignment ASSERT() in the linker script.
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2015-03-19 16:42:26 +00:00
* The H Y P i n i t c o d e c a n ' t b e m o r e t h a n a p a g e l o n g ,
* and s h o u l d n o t c r o s s a p a g e b o u n d a r y .
2013-04-12 19:12:04 +01:00
* The a b o v e c o m m e n t a p p l i e s a s w e l l .
* /
2015-03-24 17:48:07 +00:00
ASSERT( _ _ h y p _ i d m a p _ t e x t _ e n d - ( _ _ h y p _ i d m a p _ t e x t _ s t a r t & P A G E _ M A S K ) < = P A G E _ S I Z E ,
ARM, arm64: kvm: get rid of the bounce page
The HYP init bounce page is a runtime construct that ensures that the
HYP init code does not cross a page boundary. However, this is something
we can do perfectly well at build time, by aligning the code appropriately.
For arm64, we just align to 4 KB, and enforce that the code size is less
than 4 KB, regardless of the chosen page size.
For ARM, the whole code is less than 256 bytes, so we tweak the linker
script to align at a power of 2 upper bound of the code size
Note that this also fixes a benign off-by-one error in the original bounce
page code, where a bounce page would be allocated unnecessarily if the code
was exactly 1 page in size.
On ARM, it also fixes an issue with very large kernels reported by Arnd
Bergmann, where stub sections with linker emitted veneers could erroneously
trigger the size/alignment ASSERT() in the linker script.
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2015-03-19 16:42:26 +00:00
" HYP i n i t c o d e t o o b i g o r m i s a l i g n e d " )