You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/01/29 18:40:17 UTC
[incubator-nuttx] 05/07: boards/arm/lpc17xx_40xx/lx_cpu/: increase
sections alignment and fix .ARM.exidx overlap.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit e7ed720699e8698d83c2e582f46306d8d2fb69a6
Author: Pavel Pisa <pp...@pikron.com>
AuthorDate: Fri Jan 29 15:38:46 2021 +0100
boards/arm/lpc17xx_40xx/lx_cpu/: increase sections alignment and fix .ARM.exidx overlap.
The ARMv7 specifies minimal alignment to be 8 for EABI. Ensure
that sections are placed with even greater minimal alignment.
Sections final alignment should be adjusted according
to alignment of their inputs, but for some reasons some
combinations lead to .ARM.exidx overlap with .data.
When alignment is increased then the direct fetch of the
fill location
_eronly = ABSOLUTE(.);
does not match with final LMA placement of the .data section.
Use constructs which should result in matching .data LMA
address for all cases
_eronly = ABSOLUTE(.);
Signed-off-by: Pavel Pisa <pp...@pikron.com>
---
.../arm/lpc17xx_40xx/lx_cpu/scripts/link-flash-app.ld | 14 +++++++-------
.../arm/lpc17xx_40xx/lx_cpu/scripts/link-flash-boot.ld | 14 +++++++-------
boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-sdram.ld | 17 ++++++++---------
3 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-flash-app.ld b/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-flash-app.ld
old mode 100644
new mode 100755
index 9e6aaed..85b5060
--- a/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-flash-app.ld
+++ b/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-flash-app.ld
@@ -78,25 +78,23 @@ SECTIONS
_etext = ABSOLUTE(.);
} > FLASH
- .init_section : ALIGN(4) {
+ .init_section : ALIGN(16) {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > FLASH
- .ARM.extab : {
+ .ARM.extab : ALIGN(16) {
*(.ARM.extab*)
} > FLASH
- .ARM.exidx : ALIGN(4) {
+ .ARM.exidx : ALIGN(16) {
__exidx_start = ABSOLUTE(.);
*(.ARM.exidx*)
__exidx_end = ABSOLUTE(.);
} > FLASH
- _eronly = ABSOLUTE(.);
-
- .data : ALIGN(4) {
+ .data : ALIGN(16) {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
@@ -105,7 +103,9 @@ SECTIONS
_edata = ABSOLUTE(.);
} > SRAM AT > FLASH
- .bss : ALIGN(4) {
+ _eronly = LOADADDR(.data);
+
+ .bss : ALIGN(16) {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
diff --git a/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-flash-boot.ld b/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-flash-boot.ld
index 02d9c14..e9a80ef 100644
--- a/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-flash-boot.ld
+++ b/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-flash-boot.ld
@@ -76,25 +76,23 @@ SECTIONS
_etext = ABSOLUTE(.);
} > FLASH
- .init_section : ALIGN(4) {
+ .init_section : ALIGN(16) {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > FLASH
- .ARM.extab : {
+ .ARM.extab : ALIGN(16) {
*(.ARM.extab*)
} > FLASH
- .ARM.exidx : ALIGN(4) {
+ .ARM.exidx : ALIGN(16) {
__exidx_start = ABSOLUTE(.);
*(.ARM.exidx*)
__exidx_end = ABSOLUTE(.);
} > FLASH
- _eronly = ABSOLUTE(.);
-
- .data : ALIGN(4) {
+ .data : ALIGN(16) {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
@@ -103,7 +101,9 @@ SECTIONS
_edata = ABSOLUTE(.);
} > SRAM AT > FLASH
- .bss : ALIGN(4) {
+ _eronly = LOADADDR(.data);
+
+ .bss : ALIGN(16) {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
diff --git a/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-sdram.ld b/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-sdram.ld
index 423d2af..cab2f72 100644
--- a/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-sdram.ld
+++ b/boards/arm/lpc17xx_40xx/lx_cpu/scripts/link-sdram.ld
@@ -79,26 +79,23 @@ SECTIONS
_etext = ABSOLUTE(.);
} > SDRAM
- .init_section : {
+ .init_section : ALIGN(16) {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > SDRAM
- .ARM.extab : {
+ .ARM.extab : ALIGN(16) {
*(.ARM.extab*)
} > SDRAM
- __exidx_start = ABSOLUTE(.);
- .ARM.exidx : {
+ .ARM.exidx : ALIGN(16) {
+ __exidx_start = ABSOLUTE(.);
*(.ARM.exidx*)
+ __exidx_end = ABSOLUTE(.);
} > SDRAM
- __exidx_end = ABSOLUTE(.);
-
- _eronly = ABSOLUTE(.);
-
- .data : {
+ .data : ALIGN(16) {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
@@ -107,6 +104,8 @@ SECTIONS
_edata = ABSOLUTE(.);
} > SRAM AT > SDRAM
+ _eronly = LOADADDR(.data);
+
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)