ld/
authorNathan Sidwell <nathan@codesourcery.com>
Mon, 28 Apr 2008 12:45:34 +0000 (12:45 +0000)
committerNathan Sidwell <nathan@codesourcery.com>
Mon, 28 Apr 2008 12:45:34 +0000 (12:45 +0000)
* 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
ld/ldlang.c
ld/testsuite/ChangeLog
ld/testsuite/ld-scripts/rgn-over.exp
ld/testsuite/ld-scripts/rgn-over8-ok.d [new file with mode: 0644]
ld/testsuite/ld-scripts/rgn-over8.s [new file with mode: 0644]
ld/testsuite/ld-scripts/rgn-over8.t [new file with mode: 0644]

index 33899e5..16c2169 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-28  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * ldlang.c (lang_size_sections_1): Don't check LMA overflow on
+       non-load sections.
+
 2008-04-25  Michael Frysinger  <vapier@gentoo.org>
 
        * configure.tgt (bfin-*-linux-uclibc*): Set targ_emul to elf32bfinfd
index cbf46fc..3c24b66 100644 (file)
@@ -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);
index b2d61e0..6374667 100644 (file)
@@ -1,3 +1,10 @@
+2008-04-28  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * 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  <nathan@codesourcery.com>
 
        * ld-vxworks/plt-mips1.s: New.
index 509f7ff..05a7071 100644 (file)
@@ -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 (file)
index 0000000..dda54aa
--- /dev/null
@@ -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 (file)
index 0000000..b80510d
--- /dev/null
@@ -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 (file)
index 0000000..7623b19
--- /dev/null
@@ -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/ : { *(*) }
+}