public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] MSP430: Improve simulator linker scripts
@ 2020-08-07 10:46 Jozef Lawrynowicz
  2020-08-07 10:48 ` [PATCH 1/2] MSP430: Word align __*_array_start symbols in sim " Jozef Lawrynowicz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jozef Lawrynowicz @ 2020-08-07 10:46 UTC (permalink / raw)
  To: newlib

The following patches improve and fix issues with the MSP430 simulator
linker scripts.

Successfully regtested the GCC DejaGNU C and C++ testsuites for
msp430-elf. The changes fix some tests, and allow new tests to build and
subsequently pass, thanks to the newly increased memory region size.

If the patches are acceptable, I would appreciate it if someone would
commit them for me, as I do not have write access.

Jozef Lawrynowicz (2):
  MSP430: Word align __*_array_start symbols in sim linker scripts
  MSP430: Increase the amount of main memory available in sim ld scripts

 libgloss/msp430/msp430-sim.ld   | 6 +++++-
 libgloss/msp430/msp430xl-sim.ld | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

-- 
2.27.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] MSP430: Word align __*_array_start symbols in sim linker scripts
  2020-08-07 10:46 [PATCH 0/2] MSP430: Improve simulator linker scripts Jozef Lawrynowicz
@ 2020-08-07 10:48 ` Jozef Lawrynowicz
  2020-08-07 10:49 ` [PATCH 2/2] MSP430: Increase the amount of main memory available in sim ld scripts Jozef Lawrynowicz
  2020-08-07 13:17 ` [PATCH 0/2] MSP430: Improve simulator linker scripts Corinna Vinschen
  2 siblings, 0 replies; 4+ messages in thread
From: Jozef Lawrynowicz @ 2020-08-07 10:48 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

__{preinit,init,fini}_array_start symbols must be word aligned in
linker scripts. If the section preceding the __*_array_start symbol
has an odd size, then a NULL byte will be present between the start
symbol and the .*_array section itself, when the section gets
automatically word-aligned.

This results in a branch to an invalid address when the CRT startup
code tries to run through the functions listed in the array sections.

[-- Attachment #2: 0001-MSP430-Word-align-__-_array_start-symbols-in-sim-lin.patch --]
[-- Type: text/plain, Size: 2246 bytes --]

From de115144d05ecbaa82c9c737cc261715ca4b7d67 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Mon, 3 Aug 2020 19:09:46 +0100
Subject: [PATCH 1/2] MSP430: Word align __*_array_start symbols in sim linker
 scripts

__{preinit,init,fini}_array_start symbols must be word aligned in
linker scripts. If the section preceding the __*_array_start symbol
has an odd size, then a NULL byte will be present between the start
symbol and the .*_array section itself, when the section gets
automatically word-aligned.

This results in a branch to an invalid address when the CRT startup
code tries to run through the functions listed in the array sections.
---
 libgloss/msp430/msp430-sim.ld   | 4 ++++
 libgloss/msp430/msp430xl-sim.ld | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/libgloss/msp430/msp430-sim.ld b/libgloss/msp430/msp430-sim.ld
index fadd137e8..5c0e3b7a7 100644
--- a/libgloss/msp430/msp430-sim.ld
+++ b/libgloss/msp430/msp430-sim.ld
@@ -42,14 +42,18 @@ SECTIONS
     . = ALIGN(2);
     *(.rodata1)
 
+    . = ALIGN(2);
     KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
+    . = ALIGN(2);
     PROVIDE (__preinit_array_start = .);
     KEEP (*(.preinit_array))
     PROVIDE (__preinit_array_end = .);
+    . = ALIGN(2);
     PROVIDE (__init_array_start = .);
     KEEP (*(SORT(.init_array.*)))
     KEEP (*(.init_array))
     PROVIDE (__init_array_end = .);
+    . = ALIGN(2);
     PROVIDE (__fini_array_start = .);
     KEEP (*(.fini_array))
     KEEP (*(SORT(.fini_array.*)))
diff --git a/libgloss/msp430/msp430xl-sim.ld b/libgloss/msp430/msp430xl-sim.ld
index 125b7d897..5126e398a 100644
--- a/libgloss/msp430/msp430xl-sim.ld
+++ b/libgloss/msp430/msp430xl-sim.ld
@@ -68,13 +68,16 @@ SECTIONS
 
     . = ALIGN(2);
     KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
+    . = ALIGN(2);
     PROVIDE (__preinit_array_start = .);
     KEEP (*(.preinit_array))
     PROVIDE (__preinit_array_end = .);
+    . = ALIGN(2);
     PROVIDE (__init_array_start = .);
     KEEP (*(SORT(.init_array.*)))
     KEEP (*(.init_array))
     PROVIDE (__init_array_end = .);
+    . = ALIGN(2);
     PROVIDE (__fini_array_start = .);
     KEEP (*(.fini_array))
     KEEP (*(SORT(.fini_array.*)))
-- 
2.27.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] MSP430: Increase the amount of main memory available in sim ld scripts
  2020-08-07 10:46 [PATCH 0/2] MSP430: Improve simulator linker scripts Jozef Lawrynowicz
  2020-08-07 10:48 ` [PATCH 1/2] MSP430: Word align __*_array_start symbols in sim " Jozef Lawrynowicz
@ 2020-08-07 10:49 ` Jozef Lawrynowicz
  2020-08-07 13:17 ` [PATCH 0/2] MSP430: Improve simulator linker scripts Corinna Vinschen
  2 siblings, 0 replies; 4+ messages in thread
From: Jozef Lawrynowicz @ 2020-08-07 10:49 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 148 bytes --]

The main memory region of the GDB simulator ends at address 0xFFBF,
but the simulator linker scripts do not make full use of this available
memory.

[-- Attachment #2: 0002-MSP430-Increase-the-amount-of-main-memory-available-.patch --]
[-- Type: text/plain, Size: 1471 bytes --]

From 61f3d212741acee583e21ff2c2808775584ecad6 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Mon, 3 Aug 2020 19:38:23 +0100
Subject: [PATCH 2/2] MSP430: Increase the amount of main memory available in
 sim ld scripts

The main memory region of the GDB simulator ends at address 0xFFBF,
but the simulator linker scripts do not make full use of this available
memory.
---
 libgloss/msp430/msp430-sim.ld   | 2 +-
 libgloss/msp430/msp430xl-sim.ld | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgloss/msp430/msp430-sim.ld b/libgloss/msp430/msp430-sim.ld
index 5c0e3b7a7..4af48398e 100644
--- a/libgloss/msp430/msp430-sim.ld
+++ b/libgloss/msp430/msp430-sim.ld
@@ -19,7 +19,7 @@ INCLUDE intr_vectors.ld
 
 MEMORY
 {
-  RAM (w) : ORIGIN = 0x00500, LENGTH = 0x0eb00
+  RAM (w) : ORIGIN = 0x00500, LENGTH = 0x0fac0 /* END=0xffbf */
 }
 
 SECTIONS
diff --git a/libgloss/msp430/msp430xl-sim.ld b/libgloss/msp430/msp430xl-sim.ld
index 5126e398a..8d03b5c38 100644
--- a/libgloss/msp430/msp430xl-sim.ld
+++ b/libgloss/msp430/msp430xl-sim.ld
@@ -26,7 +26,7 @@ INCLUDE intr_vectors.ld
 MEMORY
 {
   RAM (rw)     : ORIGIN = 0x00500, LENGTH = 0x01b00
-  ROM (rx)     : ORIGIN = 0x02000, LENGTH = 0x0df00
+  ROM (rx)     : ORIGIN = 0x02000, LENGTH = 0x0dfc0
   /* The regions from intr_vectors.ld go here.  */
   HIFRAM (rw)  : ORIGIN = 0x10000, LENGTH = 0x80000
   HIROM (rx)   : ORIGIN = 0x90000, LENGTH = 0x70000
-- 
2.27.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] MSP430: Improve simulator linker scripts
  2020-08-07 10:46 [PATCH 0/2] MSP430: Improve simulator linker scripts Jozef Lawrynowicz
  2020-08-07 10:48 ` [PATCH 1/2] MSP430: Word align __*_array_start symbols in sim " Jozef Lawrynowicz
  2020-08-07 10:49 ` [PATCH 2/2] MSP430: Increase the amount of main memory available in sim ld scripts Jozef Lawrynowicz
@ 2020-08-07 13:17 ` Corinna Vinschen
  2 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2020-08-07 13:17 UTC (permalink / raw)
  To: Jozef Lawrynowicz; +Cc: newlib

On Aug  7 11:46, Jozef Lawrynowicz wrote:
> The following patches improve and fix issues with the MSP430 simulator
> linker scripts.
> 
> Successfully regtested the GCC DejaGNU C and C++ testsuites for
> msp430-elf. The changes fix some tests, and allow new tests to build and
> subsequently pass, thanks to the newly increased memory region size.
> 
> If the patches are acceptable, I would appreciate it if someone would
> commit them for me, as I do not have write access.
> 
> Jozef Lawrynowicz (2):
>   MSP430: Word align __*_array_start symbols in sim linker scripts
>   MSP430: Increase the amount of main memory available in sim ld scripts
> 
>  libgloss/msp430/msp430-sim.ld   | 6 +++++-
>  libgloss/msp430/msp430xl-sim.ld | 5 ++++-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> -- 
> 2.27.0

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-07 13:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 10:46 [PATCH 0/2] MSP430: Improve simulator linker scripts Jozef Lawrynowicz
2020-08-07 10:48 ` [PATCH 1/2] MSP430: Word align __*_array_start symbols in sim " Jozef Lawrynowicz
2020-08-07 10:49 ` [PATCH 2/2] MSP430: Increase the amount of main memory available in sim ld scripts Jozef Lawrynowicz
2020-08-07 13:17 ` [PATCH 0/2] MSP430: Improve simulator linker scripts Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).