This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[SH] Adjust stack area for simulator
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: binutils <binutils at sourceware dot org>
- Date: Thu, 07 Apr 2016 22:19:42 +0900
- Subject: [SH] Adjust stack area for simulator
- Authentication-results: sourceware.org; auth=none
Hi,
When using the default configuration, sh-sim runs effectively with
something like 3 MBytes of RAM. This is because the stack base address
is set to 0x300000 in the default linker script.
When using sh-sim for running the GCC testsuite, the limited RAM
results in a bunch of "heap stack collision" type of errors. The
attached patch raises the stack base address and VM memory size to
around 1 GByte. Although that seems a lot, on modern systems it should
be fine, as not all reserved memory will be committed, if it's not
touched. With this, running the GCC with e.g. -j12 shows no problems
and in turn quite some failures disappear.
Cheers,
Oleg
ld/ChangeLog:
* emulparams/shelf.sh: Set stack area to 0x3FFFFF00.
sim/ChangeLog:
* sh/interp.c (sim_memory_size): Default init to 30.
(parse_and_set_memory_size): Adjust upper bound to 31.
diff --git a/ld/emulparams/shelf.sh b/ld/emulparams/shelf.sh
index 5757b81..83680a6 100644
--- a/ld/emulparams/shelf.sh
+++ b/ld/emulparams/shelf.sh
@@ -18,13 +18,13 @@ CTOR_START='___ctors = .;'
CTOR_END='___ctors_end = .;'
DTOR_START='___dtors = .;'
DTOR_END='___dtors_end = .;'
-# This is like setting STACK_ADDR to 0x300000, except that the setting can
+# This is like setting STACK_ADDR to 0x3FFFFF00, except that the setting can
# be overridden, e.g. --defsym _stack=0x0f00, and that we put an extra
# sentinal value at the bottom.
# N.B. We can't use PROVIDE to set the default value in a symbol because
# the address is needed to place the .stack section, which in turn is needed
# to hold the sentinel value(s).
-test -z "$CREATE_SHLIB" && OTHER_SECTIONS=" .stack ${RELOCATING-0}${RELOCATING+(DEFINED(_stack) ? _stack : 0x300000)} :
+test -z "$CREATE_SHLIB" && OTHER_SECTIONS=" .stack ${RELOCATING-0}${RELOCATING+(DEFINED(_stack) ? _stack : 0x3FFFFF00)} :
{
${RELOCATING+_stack = .;}
*(.stack)
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 2f02e69..072f71d 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -741,7 +741,7 @@ do { \
#if defined(__GO32__)
int sim_memory_size = 19;
#else
-int sim_memory_size = 24;
+int sim_memory_size = 30;
#endif
static int sim_profile_size = 17;
@@ -2495,10 +2495,10 @@ parse_and_set_memory_size (const char *str)
int n;
n = strtol (str, NULL, 10);
- if (n > 0 && n <= 24)
+ if (n > 0 && n <= 31)
sim_memory_size = n;
else
- callback->printf_filtered (callback, "Bad memory size %d; must be 1 to 24, inclusive\n", n);
+ callback->printf_filtered (callback, "Bad memory size %d; must be 1 to 31, inclusive\n", n);
}
void