xtensa: move #include <linker/common-*.ld> up

Move linker/common-rom.ld between .rodata sections so that it's together
with other immutable data.
Move linker/common-ram.ld before the .bss section, so that .bss does not
appear between data sections, which had two consequences:
- there's a .bss-sized gap in the ELF image, and
- PHDR segment that covers .bss overlaps the segment that covers .data,
  resulting in the following xt-run warning:

  ( [ sample_controller ] load_bfd ) *WARNING* Executable segment
    [ 60004d60, 600079a7 ] overlaps an existing executable segment

Change-Id: I2db46f4656e240016fe60883057cc000b6377180
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
Max Filippov 2017-02-16 08:59:30 -08:00 committed by Andrew Boie
commit 59926490be
13 changed files with 208 additions and 195 deletions

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram0_seg :sram0_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
dram1_0_seg : org = 0x3FFC0000, len = 0x20000
@ -418,6 +430,8 @@ SECTIONS
_sram_rodata_end = ABSOLUTE(.);
} >sram0_seg :sram0_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -522,6 +536,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >sram0_seg :sram0_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -588,19 +604,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram0_seg :sram0_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram19_seg :sram19_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
dport0_0_seg : org = 0x3FFC0000, len = 0x20000
@ -424,6 +436,8 @@ SECTIONS
_sram_rodata_end = ABSOLUTE(.);
} >sram19_seg :sram19_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -528,6 +542,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >sram19_seg :sram19_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -594,19 +610,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram19_seg :sram19_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram20_seg :sram20_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
sram1_seg : org = 0x00002000, len = 0x178
@ -304,6 +316,8 @@ SECTIONS
_sram_rodata_end = ABSOLUTE(.);
} >sram20_seg :sram20_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -404,6 +418,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >sram20_seg :sram20_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -495,19 +511,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram20_seg :sram20_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram19_seg :sram19_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
srom0_seg : org = 0x40000000, len = 0x2E0
@ -428,6 +440,8 @@ SECTIONS
_sram_rodata_end = ABSOLUTE(.);
} >sram19_seg :sram19_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -532,6 +546,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >sram19_seg :sram19_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -598,19 +614,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram19_seg :sram19_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram19_seg :sram19_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
srom0_seg : org = 0x40000000, len = 0x2E0
@ -428,6 +440,8 @@ SECTIONS
_sram_rodata_end = ABSOLUTE(.);
} >sram19_seg :sram19_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -532,6 +546,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >sram19_seg :sram19_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -598,19 +614,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram19_seg :sram19_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram0_seg :sram0_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
dram0_0_seg : org = 0x3FFE0000, len = 0x20000
@ -258,6 +270,8 @@ SECTIONS
_sram_rodata_end = ABSOLUTE(.);
} >sram0_seg :sram0_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -360,6 +374,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >sram0_seg :sram0_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -427,19 +443,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram0_seg :sram0_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram19_seg :sram19_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
dram1_0_seg : org = 0x3FFC0000, len = 0x20000
@ -428,6 +440,8 @@ SECTIONS
_sram_rodata_end = ABSOLUTE(.);
} >sram19_seg :sram19_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -532,6 +546,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >sram19_seg :sram19_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -598,19 +614,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram19_seg :sram19_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram9_seg :sram9_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
srom0_seg : org = 0x50000000, len = 0x2E0
@ -208,6 +220,8 @@ SECTIONS
_sram_rodata_end = ABSOLUTE(.);
} >sram9_seg :sram9_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -308,6 +322,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >sram9_seg :sram9_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -374,19 +390,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram9_seg :sram9_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram9_seg :sram9_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
srom0_seg : org = 0x50000000, len = 0x2E0
@ -208,6 +220,8 @@ SECTIONS
_sram_rodata_end = ABSOLUTE(.);
} >sram9_seg :sram9_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -308,6 +322,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >sram9_seg :sram9_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -374,19 +390,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram9_seg :sram9_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram13_seg :sram13_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
srom0_seg : org = 0x50000000, len = 0x300
@ -255,6 +267,8 @@ SECTIONS
_sram_rodata_end = ABSOLUTE(.);
} >sram13_seg :sram13_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -355,6 +369,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >sram13_seg :sram13_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -421,19 +437,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram13_seg :sram13_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION dram0_0_seg :dram0_0_phdr
#define ROMABLE_REGION iram0_7_seg :iram0_7_phdr
MEMORY
{
dram0_0_seg : org = 0x60000000, len = 0x20000
@ -99,6 +111,8 @@ SECTIONS
_dram0_rodata_end = ABSOLUTE(.);
} >dram0_0_seg :dram0_0_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -198,6 +212,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >dram0_0_seg :dram0_0_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -346,19 +362,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION dram0_0_seg :dram0_0_phdr
#define ROMABLE_REGION iram0_7_seg :iram0_7_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram0_0_seg :sram0_0_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
dram0_0_seg : org = 0x60000000, len = 0x20000
@ -99,6 +111,8 @@ SECTIONS
_dram0_rodata_end = ABSOLUTE(.);
} >dram0_0_seg :dram0_0_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -198,6 +212,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >dram0_0_seg :dram0_0_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -346,19 +362,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram0_0_seg :sram0_0_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}

View file

@ -10,6 +10,18 @@
* Linker script for the Xtensa platform.
*/
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram0_seg :sram0_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
MEMORY
{
dram1_0_seg : org = 0x3FFC0000, len = 0x20000
@ -418,6 +430,8 @@ SECTIONS
_sram_rodata_end = ABSOLUTE(.);
} >sram0_seg :sram0_phdr
#include <linker/common-rom.ld>
.rodata : ALIGN(4)
{
_rodata_start = ABSOLUTE(.);
@ -522,6 +536,8 @@ SECTIONS
_data_end = ABSOLUTE(.);
} >sram0_seg :sram0_phdr
#include <linker/common-ram.ld>
.bss (NOLOAD) : ALIGN(8)
{
. = ALIGN (8);
@ -588,19 +604,4 @@ SECTIONS
{
KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*))
}
#define _LINKER
#define _ASMLANGUAGE
#include <autoconf.h>
#include <sections.h>
#include <linker-defs.h>
#include <linker-tool.h>
#define RAMABLE_REGION sram0_seg :sram0_phdr
#define ROMABLE_REGION srom1_seg :srom1_phdr
#include <linker/common-rom.ld>
#include <linker/common-ram.ld>
}