From 1faf99eb496fe2f39a8fe7f1f4d24c1534feb123 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 25 Nov 2019 08:56:22 +0000 Subject: [PATCH 2/4] Add generic test for non-contiguous memory regions 2020-01-06 Christophe Lyon ld/ * testsuite/ld-elf/non-contiguous.d: New. * testsuite/ld-elf/non-contiguous.ld: New. * testsuite/ld-elf/non-contiguous.s: New. Change-Id: Ia81d08450956f0fee7eff365ab23060f4882703b --- ld/testsuite/ld-elf/non-contiguous.d | 31 +++++++++++++++++++++++++++++++ ld/testsuite/ld-elf/non-contiguous.ld | 35 +++++++++++++++++++++++++++++++++++ ld/testsuite/ld-elf/non-contiguous.s | 21 +++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 ld/testsuite/ld-elf/non-contiguous.d create mode 100644 ld/testsuite/ld-elf/non-contiguous.ld create mode 100644 ld/testsuite/ld-elf/non-contiguous.s diff --git a/ld/testsuite/ld-elf/non-contiguous.d b/ld/testsuite/ld-elf/non-contiguous.d new file mode 100644 index 0000000..078b733 --- /dev/null +++ b/ld/testsuite/ld-elf/non-contiguous.d @@ -0,0 +1,31 @@ +#name: non-contiguous +#source: non-contiguous.s +#as: -mlittle-endian +#ld: --enable-non-contiguous-regions -T non-contiguous.ld -EL +#objdump: -rdsh +#xfail: [is_generic] +# These targets do not support -mlittle-endian +#skip: avr* hppa* m68hc* metag* nios2* + +.*: file format .* + +Sections: +Idx Name Size VMA * LMA * File off Algn + 0 \.raml 0000000c 0*1fff0000 0*1fff0000 .* 2\*\*0 + CONTENTS, ALLOC, LOAD, DATA + 1 \.ramu 00000014 0*20000000 0*1fff000c .* 2\*\*0 + CONTENTS, ALLOC, LOAD, DATA + 2 \.ramz 0000003c 0*20040000 0*20000014 .* 2\*\*0 + CONTENTS, ALLOC, LOAD, DATA + + +Contents of section .raml: + 1fff0000 01000000 02000000 03000000 ............ +Contents of section .ramu: + 20000000 04000000 05000000 06000000 07000000 ................ + 20000010 08000000 .... +Contents of section .ramz: + 20040000 09090909 09090909 09090909 09090909 ................ + 20040010 09090909 09090909 09090909 09090909 ................ + 20040020 09090909 09090909 09090909 09090909 ................ + 20040030 09090909 09090909 09090909 ............ diff --git a/ld/testsuite/ld-elf/non-contiguous.ld b/ld/testsuite/ld-elf/non-contiguous.ld new file mode 100644 index 0000000..3e23087 --- /dev/null +++ b/ld/testsuite/ld-elf/non-contiguous.ld @@ -0,0 +1,35 @@ +/* + section .data.1 fits in .raml + sections .data.2 .data.3 fit in .ramu + section .data.4 fits in .ramz +*/ +MEMORY +{ + RAML (rwx) : ORIGIN = 0x1FFF0000, LENGTH = 0x00014 + RAMU (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00040 + RAMZ (rwx) : ORIGIN = 0x20040000, LENGTH = 0x00040 +} + +SECTIONS +{ + /* Ignore this target specific info in output comparison. */ + /DISCARD/ : { *(.ARM.attributes) } + .raml : AT ( ADDR (.text) + SIZEOF (.text) ) + { _raml_start = . ; + *(.boot) ; + *(.data) *(.data.*) ; + _raml_end = . ; + } > RAML + + .ramu : AT ( ADDR (.raml) + SIZEOF (.raml) ) + { _ramu_start = . ; + *(.data) *(.data.*) ; + _ramu_end = . ; + } > RAMU + + .ramz : AT ( ADDR (.ramu) + SIZEOF (.ramu) ) + { _ramz_start = . ; + *(.data) *(.data.*) ; + _ramz_end = . ; + } > RAMZ +} diff --git a/ld/testsuite/ld-elf/non-contiguous.s b/ld/testsuite/ld-elf/non-contiguous.s new file mode 100644 index 0000000..8e2d581 --- /dev/null +++ b/ld/testsuite/ld-elf/non-contiguous.s @@ -0,0 +1,21 @@ + .section .data.1 + # Fit in RAML + .4byte 1 + .4byte 2 + .4byte 3 + + .section .data.2 + # Fit in RAMU + .4byte 4 + .4byte 5 + .4byte 6 + + .section .data.3 + # Fit in RAMU + .4byte 7 + .4byte 8 + + .section .data.4 + # Fit in RAMZ + .fill 0x3c, 1, 9 + -- 2.7.4