diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-03-29 03:29:29 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-03-29 04:14:27 -0400 |
commit | aac18a6996e57cd1d1c32d3fd418c4950c5001bf (patch) | |
tree | feed2219b6704021bb4598c5d1d6e1a5158e6a4e | |
parent | 4f5cce88bf504a2f0010f7ad384003984da6ce00 (diff) | |
download | fsf-binutils-gdb-aac18a6996e57cd1d1c32d3fd418c4950c5001bf.zip fsf-binutils-gdb-aac18a6996e57cd1d1c32d3fd418c4950c5001bf.tar.gz fsf-binutils-gdb-aac18a6996e57cd1d1c32d3fd418c4950c5001bf.tar.bz2 |
sim: mcore: drop sbrk support
The sbrk syscall assumes the sbrk region starts after the bss and the
current implementation requires a bss section to exist. Since there
is no requirement for programs to have a bss in general, we want to
drop this check. However, there is still the sbrk syscall that wants
to know about the region.
Since libgloss doesn't actually use the sbrk syscall (it implements
sbrk in its own way), and the sim really shouldn't enforce a specific
memory layout on programs, lets simply delete sbrk support. Now it
always returns an error.
-rw-r--r-- | sim/mcore/ChangeLog | 6 | ||||
-rw-r--r-- | sim/mcore/interp.c | 42 |
2 files changed, 9 insertions, 39 deletions
diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog index c309a05..f6089c8 100644 --- a/sim/mcore/ChangeLog +++ b/sim/mcore/ChangeLog @@ -1,3 +1,9 @@ +2015-03-29 Mike Frysinger <vapier@gentoo.org> + + * interp.c (heap_ptr, int_sbrk): Delete. + (handle_trap1): Change case 69 (sbrk) to always return -1. + (sim_load): Delete bss checks and heap_ptr setup. + 2015-03-16 Mike Frysinger <vapier@gentoo.org> * interp.c: Strip trailing whitespace. diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c index 4eb1a59..b06bd1f 100644 --- a/sim/mcore/interp.c +++ b/sim/mcore/interp.c @@ -38,7 +38,6 @@ typedef long int word; typedef unsigned long int uword; static int target_big_endian = 0; -static unsigned long heap_ptr = 0; host_callback * callback; @@ -174,21 +173,6 @@ static int issue_messages = 0; #define PARM4 5 #define RET1 2 /* register for return values. */ -static long -int_sbrk (int inc_bytes) -{ - long addr; - - addr = heap_ptr; - - heap_ptr += inc_bytes; - - if (issue_messages && heap_ptr>cpu.gr[0]) - fprintf (stderr, "Warning: heap_ptr overlaps stack!\n"); - - return addr; -} - static void wbat (word x, word v) { @@ -588,8 +572,10 @@ handle_trap1 (void) break; case 69: + /* Historically this was sbrk(), but no one used it, and the + implementation didn't actually work, so it's a stub now. */ a[0] = (unsigned long) (cpu.gr[PARM1]); - cpu.gr[RET1] = int_sbrk (a[0]); + cpu.gr[RET1] = -1; break; default: @@ -1871,7 +1857,6 @@ sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty) { bfd * handle; - asection * s_bss; handle = bfd_openr (prog, 0); /* could be "mcore" */ if (!handle) @@ -1890,27 +1875,6 @@ sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty) return SIM_RC_FAIL; } - /* Look for that bss section. */ - s_bss = bfd_get_section_by_name (handle, ".bss"); - - if (!s_bss) - { - printf("``%s'' has no bss section.\n", prog); - return SIM_RC_FAIL; - } - - /* Appropriately paranoid would check that we have - a traditional text/data/bss ordering within memory. */ - - /* figure the end of the bss section */ -#if 0 - printf ("bss section at 0x%08x for 0x%08x bytes\n", - (unsigned long) bfd_get_section_vma (handle, s_bss), - (unsigned long) bfd_section_size (handle, s_bss)); -#endif - heap_ptr = ((unsigned long) bfd_get_section_vma (handle, s_bss) - + (unsigned long) bfd_section_size (handle, s_bss)); - /* Clean up after ourselves. */ bfd_close (handle); |