From a2cab75396adb33c5e660c37048151fb6732a040 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Mon, 28 Apr 2008 12:45:34 +0000 Subject: [PATCH] ld/ * ldlang.c (lang_size_sections_1): Don't check LMA overflow on non-load sections. ld/testsuite/ * ld-scripts/rgn-over.exp: Allow -ok file names to pass. * ld-scripts/rgn-over8.s: New. * ld-scripts/rgn-over8.t: New. * ld-scripts/rgn-over8-ok.d: New. --- ld/ChangeLog | 5 +++++ ld/ldlang.c | 3 ++- ld/testsuite/ChangeLog | 7 +++++++ ld/testsuite/ld-scripts/rgn-over.exp | 20 +++++++++++--------- ld/testsuite/ld-scripts/rgn-over8-ok.d | 12 ++++++++++++ ld/testsuite/ld-scripts/rgn-over8.s | 7 +++++++ ld/testsuite/ld-scripts/rgn-over8.t | 13 +++++++++++++ 7 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 ld/testsuite/ld-scripts/rgn-over8-ok.d create mode 100644 ld/testsuite/ld-scripts/rgn-over8.s create mode 100644 ld/testsuite/ld-scripts/rgn-over8.t diff --git a/ld/ChangeLog b/ld/ChangeLog index 33899e5267b..16c21695f61 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2008-04-28 Nathan Sidwell + + * ldlang.c (lang_size_sections_1): Don't check LMA overflow on + non-load sections. + 2008-04-25 Michael Frysinger * configure.tgt (bfin-*-linux-uclibc*): Set targ_emul to elf32bfinfd diff --git a/ld/ldlang.c b/ld/ldlang.c index cbf46fc1dae..3c24b66c199 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -4699,7 +4699,8 @@ lang_size_sections_1 os_region_check (os, os->region, os->addr_tree, os->bfd_section->vma); - if (os->lma_region != NULL && os->lma_region != os->region) + if (os->lma_region != NULL && os->lma_region != os->region + && (os->bfd_section->flags & SEC_LOAD)) { os->lma_region->current = os->bfd_section->lma + TO_ADDR (os->bfd_section->size); diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index b2d61e0ec48..6374667d226 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2008-04-28 Nathan Sidwell + + * ld-scripts/rgn-over.exp: Allow -ok file names to pass. + * ld-scripts/rgn-over8.s: New. + * ld-scripts/rgn-over8.t: New. + * ld-scripts/rgn-over8-ok.d: New. + 2008-04-21 Nathan Sidwell * ld-vxworks/plt-mips1.s: New. diff --git a/ld/testsuite/ld-scripts/rgn-over.exp b/ld/testsuite/ld-scripts/rgn-over.exp index 509f7ff328f..05a70718b57 100644 --- a/ld/testsuite/ld-scripts/rgn-over.exp +++ b/ld/testsuite/ld-scripts/rgn-over.exp @@ -36,17 +36,19 @@ foreach test_file $test_list { verbose $test_name run_dump_test $test_name - set testname "[file tail $test_name] (map check)" - if [file exists $map_file] { - # compare the map file to the expectations in the .d file - # (run_dump_test can't do that). - if [regexp_diff $map_file $test_file] { - fail $testname + if { ! [regexp ".*-ok.d" $test_file] } { + set testname "[file tail $test_name] (map check)" + if [file exists $map_file] { + # compare the map file to the expectations in the .d file + # (run_dump_test can't do that). + if [regexp_diff $map_file $test_file] { + fail $testname + } else { + pass $testname + } } else { - pass $testname + untested $testname } - } else { - untested $testname } } set LDFLAGS $old_ldflags diff --git a/ld/testsuite/ld-scripts/rgn-over8-ok.d b/ld/testsuite/ld-scripts/rgn-over8-ok.d new file mode 100644 index 00000000000..dda54aad83e --- /dev/null +++ b/ld/testsuite/ld-scripts/rgn-over8-ok.d @@ -0,0 +1,12 @@ +# name: rgn-over8 +# source: rgn-over8.s +# ld: -T rgn-over8.t +# objdump: -w -h + +.*: file format .* + +Sections: +Idx +Name +Size +VMA +LMA +File off +Algn +Flags + 0 .text 0+0000400 0+0000000 0+0000000 [0-9a-f]+ 2\*\*0 CONTENTS, ALLOC, LOAD, READONLY, CODE + 1 .data 0+0000400 0+0001000 0+0000400 [0-9a-f]+ 2\*\*0 CONTENTS, ALLOC, LOAD, DATA + 2 .bss 0+0000400 0+0001400 0+0000800 [0-9a-f]+ 2\*\*0 ALLOC diff --git a/ld/testsuite/ld-scripts/rgn-over8.s b/ld/testsuite/ld-scripts/rgn-over8.s new file mode 100644 index 00000000000..b80510d26c0 --- /dev/null +++ b/ld/testsuite/ld-scripts/rgn-over8.s @@ -0,0 +1,7 @@ + .text + .globl main + .zero 1024 + .data + .zero 1024 + .bss + .zero 1024 diff --git a/ld/testsuite/ld-scripts/rgn-over8.t b/ld/testsuite/ld-scripts/rgn-over8.t new file mode 100644 index 00000000000..7623b19a037 --- /dev/null +++ b/ld/testsuite/ld-scripts/rgn-over8.t @@ -0,0 +1,13 @@ +/* Memory region overflow tests: bss to LMA doesn't cause overflow. */ + +MEMORY { + rom (rwx) : ORIGIN = 0, LENGTH = 2048 + ram (rwx) : ORIGIN = 0x1000, LENGTH = 2048 +} +_start = 0x0; +SECTIONS { + .text : { *(.text) } >rom AT>rom + .data : { *(.data) } >ram AT>rom + .bss : { *(.bss) } >ram AT>rom + /DISCARD/ : { *(*) } +} -- 2.30.2