gdb/testsuite: allow gdb.base/overlays.exp to compile for m32r

The gdb.base/overlays.exp test is only currently supported on m32r
baremetal targets, however, when I configure a toolchain for m32r-elf
the test does not compile.

This commit updates the linker script, fixes some TCL errors in the
exp file, and adds some missing includes to the source file so that
the test does compile.

With this test, when run against an m32r-elf toolchain the test mostly
passes, but there are a couple of failures, these are GDB issues and
will be addressed in a later commit.

gdb/testsuite/ChangeLog:

	* gdb.base/m32r.ld: Remove SEARCH_DIR line.  Add MEMORY regions,
	make use of regions throughout.
	* gdb.base/overlays.exp: Enclose string with variableds in "..",
	not {...}.
	* gdb.base/ovlymgr.c: Add 'string.h' and 'stdlib.h' includes.
This commit is contained in:
Andrew Burgess 2020-09-13 21:53:08 +01:00
parent 3ce6300ea8
commit ed3bdac42c
4 changed files with 58 additions and 38 deletions

View File

@ -1,3 +1,11 @@
2020-10-06 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.base/m32r.ld: Remove SEARCH_DIR line. Add MEMORY regions,
make use of regions throughout.
* gdb.base/overlays.exp: Enclose string with variableds in "..",
not {...}.
* gdb.base/ovlymgr.c: Add 'string.h' and 'stdlib.h' includes.
2020-10-05 Hannes Domani <ssbssa@yahoo.de>
* gdb.base/call-sc.c: Fix return struct on stack test case.

View File

@ -2,34 +2,43 @@ OUTPUT_FORMAT("elf32-m32r", "elf32-m32r",
"elf32-m32r")
OUTPUT_ARCH(m32r)
ENTRY(_start)
SEARCH_DIR(/usr/cygnus/m32r-961018/H-sparc-sun-sunos4.1//lib);
MEMORY
{
RAM : ORIGIN = 0x208000, LENGTH = 0x100000
OVLY_1 : ORIGIN = 0x300000, LENGTH = 0x40000
OVLY_2 : ORIGIN = 0x340000, LENGTH = 0x40000
OVLY_3 : ORIGIN = 0x380000, LENGTH = 0x40000
OVLY_4 : ORIGIN = 0x3c0000, LENGTH = 0x40000
OVLY_STORAGE : ORIGIN = 0x400000, LENGTH = 0x100000
}
/* Do we need any of these for elf?
__DYNAMIC = 0; */
SECTIONS
{
OVERLAY 0x300000 : AT (0x400000)
{
.ovly0 { foo.o(.text) }
.ovly1 { bar.o(.text) }
}
OVERLAY 0x380000 : AT (0x480000)
{
.ovly2 { baz.o(.text) }
.ovly3 { grbx.o(.text) }
}
OVERLAY 0x340000 : AT (0x440000)
{
.data00 { foo.o(.data) }
.data01 { bar.o(.data) }
}
OVERLAY 0x3C0000 : AT (0x4C0000)
{
.data02 { baz.o(.data) }
.data03 { grbx.o(.data) }
}
OVERLAY :
{
.ovly0 { */overlays2.o(.text) }
.ovly1 { */overlays3.o(.text) }
} >OVLY_1 AT>OVLY_STORAGE
OVERLAY :
{
.ovly2 { */overlays4.o(.text) }
.ovly3 { */overlays5.o(.text) }
} >OVLY_3 AT>OVLY_STORAGE
OVERLAY :
{
.data00 { */overlays2.o(.data) }
.data01 { */overlays3.o(.data) }
} >OVLY_2 AT>OVLY_STORAGE
OVERLAY :
{
.data02 { */overlays4.o(.data) }
.data03 { */overlays5.o(.data) }
} >OVLY_4 AT>OVLY_STORAGE
/* Read-only sections, merged into text segment: */
. = 0x208000;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
@ -54,20 +63,21 @@ SECTIONS
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init : { *(.init) } =0
.plt : { *(.plt) }
.init : { *(.init) } >RAM AT>RAM =0
.plt : { *(.plt) } >RAM AT>RAM
.text :
{
*(.text)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t*)
} =0
} >RAM AT>RAM =0
_etext = .;
PROVIDE (etext = .);
.fini : { *(.fini) } =0
.rodata : { *(.rodata) *(.gnu.linkonce.r*) }
.rodata1 : { *(.rodata1) }
.fini : { *(.fini) } >RAM AT>RAM =0
.rodata : { *(.rodata) *(.gnu.linkonce.r*) } >RAM AT>RAM
.rodata1 : { *(.rodata1) } >RAM AT>RAM
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN(32) + (ALIGN(8) & (32 - 1));
@ -120,21 +130,21 @@ SECTIONS
LONG((_novlys - _ovly_table) / 16);
CONSTRUCTORS
}
.data1 : { *(.data1) }
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
.got : { *(.got.plt) *(.got)}
.dynamic : { *(.dynamic) }
} >RAM AT>RAM
.data1 : { *(.data1) } >RAM AT>RAM
.ctors : { *(.ctors) } >RAM AT>RAM
.dtors : { *(.dtors) } >RAM AT>RAM
.got : { *(.got.plt) *(.got)} >RAM AT>RAM
.dynamic : { *(.dynamic) } >RAM AT>RAM
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
.sdata : { *(.sdata) }
.sdata : { *(.sdata) } >RAM AT>RAM
_edata = .;
PROVIDE (edata = .);
__bss_start = .;
.sbss : { *(.sbss) *(.scommon) }
.bss : { *(.dynbss) *(.bss) *(COMMON) }
.sbss : { *(.sbss) *(.scommon) } >RAM AT>RAM
.bss : { *(.dynbss) *(.bss) *(COMMON) } >RAM AT>RAM
_end = . ;
PROVIDE (end = .);
/* Stabs debugging sections. */

View File

@ -38,7 +38,7 @@ standard_testfile overlays.c ovlymgr.c foo.c bar.c baz.c grbx.c
if {[build_executable $testfile.exp $testfile \
[list $srcfile $srcfile2 $srcfile3 $srcfile4 $srcfile5 $srcfile6] \
{debug ldscript=-Wl,-T$linker_script}] == -1} {
"debug ldscript=-Wl,-T$linker_script"] == -1} {
untested "failed to compile"
return -1
}

View File

@ -4,6 +4,8 @@
*/
#include "ovlymgr.h"
#include <string.h>
#include <stdlib.h>
/* Local functions and data: */