qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: qemu-devel@nongnu.org
Cc: Max Filippov <jcmvbkbc@gmail.com>
Subject: [PATCH 3/4] tests/tcg/xtensa: tidy test linker script
Date: Thu, 11 Jan 2024 20:21:27 -0800	[thread overview]
Message-ID: <20240112042128.3569220-4-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <20240112042128.3569220-1-jcmvbkbc@gmail.com>

Drop MEMORY clause and related size definitions and output section
region specifications. Drop .rodata output section as the tests don't
use it. Add DATA_SEGMENT_ALIGN/DATA_SEGMENT_END around .data and .bss to
let the linker make an RW segment for data. Reserve 1M for stack instead
of almost 128M.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 tests/tcg/xtensa/linker.ld.S | 34 +++++++++++-----------------------
 1 file changed, 11 insertions(+), 23 deletions(-)

diff --git a/tests/tcg/xtensa/linker.ld.S b/tests/tcg/xtensa/linker.ld.S
index ac89b0054ee4..0e21eee31ccc 100644
--- a/tests/tcg/xtensa/linker.ld.S
+++ b/tests/tcg/xtensa/linker.ld.S
@@ -10,9 +10,8 @@
 #define XCHAL_WINDOW_UF12_VECOFS  0x00000140
 #endif
 
-#define RAM_SIZE 0x08000000  /* 128M */
-#define ROM_SIZE 0x00001000  /* 4k */
 #define VECTORS_RESERVED_SIZE 0x1000
+#define STACK_SIZE 0x00100000
 
 #if XCHAL_HAVE_BE
 OUTPUT_FORMAT("elf32-xtensa-be")
@@ -21,18 +20,13 @@ OUTPUT_FORMAT("elf32-xtensa-le")
 #endif
 ENTRY(_start)
 
-MEMORY {
-    ram : ORIGIN = XCHAL_VECBASE_RESET_VADDR, LENGTH = RAM_SIZE
-    rom : ORIGIN = XCHAL_RESET_VECTOR_VADDR, LENGTH = ROM_SIZE
-}
-
 SECTIONS
 {
-    .init :
+    .init XCHAL_RESET_VECTOR_VADDR :
     {
         *(.init)
         *(.init.*)
-    } > rom
+    }
 
 #if XCHAL_HAVE_WINDOWED
     .vector.window XCHAL_WINDOW_VECTORS_VADDR :
@@ -119,23 +113,16 @@ SECTIONS
         *(.vector.kernel.*)
         *(.vector.user.*)
         *(.vector.double.*)
-    } > ram
+    }
 
     .text :
     {
         _ftext = .;
         *(.text .stub .text.* .gnu.linkonce.t.* .literal .literal.*)
         _etext = .;
-    } > ram
+    }
 
-    .rodata :
-    {
-        . = ALIGN(4);
-        _frodata = .;
-        *(.rodata .rodata.* .gnu.linkonce.r.*)
-        *(.rodata1)
-        _erodata = .;
-    } > ram
+    . = DATA_SEGMENT_ALIGN(0x1000, 0x1000);
 
     .data :
     {
@@ -146,7 +133,7 @@ SECTIONS
         _gp = ALIGN(16);
         *(.sdata .sdata.* .gnu.linkonce.s.*)
         _edata = .;
-    } > ram
+    }
 
     .bss :
     {
@@ -160,7 +147,8 @@ SECTIONS
         *(COMMON)
         _ebss = .;
         _end = .;
-    } > ram
-}
+    }
 
-PROVIDE(_fstack = (ORIGIN(ram) & 0xf0000000) + LENGTH(ram) - 16);
+    . = DATA_SEGMENT_END(.);
+    _fstack = ALIGN(. + STACK_SIZE, 16);
+}
-- 
2.39.2



  parent reply	other threads:[~2024-01-12  4:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12  4:21 [PATCH 0/4] target/xtensa: provide configuration with MPU Max Filippov
2024-01-12  4:21 ` [PATCH 1/4] target/xtensa: add translation for wsr.mpucfg Max Filippov
2024-01-12  4:21 ` [PATCH 2/4] target/xtensa: import sample_controller32 core Max Filippov
2024-01-12  4:21 ` Max Filippov [this message]
2024-01-12  4:21 ` [PATCH 4/4] tests/tcg/xtensa: fix SR test for configs with MPU Max Filippov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240112042128.3569220-4-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).