]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/binutils-tumbl.git/commitdiff
PR ld/15222
authorAlan Modra <amodra@bigpond.net.au>
Tue, 5 Mar 2013 03:11:30 +0000 (03:11 +0000)
committerAlan Modra <amodra@bigpond.net.au>
Tue, 5 Mar 2013 03:11:30 +0000 (03:11 +0000)
ld/
* ldlang.c (lang_size_sections_1): When given an lma_region align
LMA as per VMA only if lma_region is the same as region.
ld/testsuite/
* ld-scripts/rgn-at6.s, * ld-scripts/rgn-at6.t, * ld-scripts/rgn-at6.d,
* ld-scripts/rgn-at7.t, * ld-scripts/rgn-at7.d: New tests.

ld/ChangeLog
ld/ldlang.c
ld/testsuite/ChangeLog
ld/testsuite/ld-scripts/rgn-at6.d [new file with mode: 0644]
ld/testsuite/ld-scripts/rgn-at6.s [new file with mode: 0644]
ld/testsuite/ld-scripts/rgn-at6.t [new file with mode: 0644]
ld/testsuite/ld-scripts/rgn-at7.d [new file with mode: 0644]
ld/testsuite/ld-scripts/rgn-at7.t [new file with mode: 0644]

index 670b51e7fe6d4f0d4bbd7bf1e105b1093b2b1e59..20c59c77ca67ed30e209fc5ddf9bffcd4639ffd9 100644 (file)
@@ -1,3 +1,9 @@
+2013-03-05  Alan Modra  <amodra@gmail.com>
+
+       PR ld/15222
+       * ldlang.c (lang_size_sections_1): When given an lma_region align
+       LMA as per VMA only if lma_region is the same as region.
+
 2013-01-22  Alan Modra  <amodra@gmail.com>
 
        Apply mainline patches
index 01c12df2c5250d826964bbbb6438b11f231eaad6..459f277a3ea5baa2f38e7b95db0ac9ef67d648b8 100644 (file)
@@ -4961,6 +4961,13 @@ lang_size_sections_1
              {
                bfd_vma lma = os->lma_region->current;
 
+               /* When LMA_REGION is the same as REGION, align the LMA
+                  as we did for the VMA, possibly including alignment
+                  from the bfd section.  If a different region, then
+                  only align according to the value in the output
+                  statement.  */
+               if (os->lma_region != os->region)
+                 section_alignment = os->section_alignment;
                if (section_alignment > 0)
                  lma = align_power (lma, section_alignment);
                os->bfd_section->lma = lma;
index 2d963681789f40cbc87b974399a4b796fbe71c59..6d516e08a42b63b2cce969ce6df05b8677c988e7 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-05  Alan Modra  <amodra@gmail.com>
+
+       * ld-scripts/rgn-at6.s, * ld-scripts/rgn-at6.t, * ld-scripts/rgn-at6.d,
+       * ld-scripts/rgn-at7.t, * ld-scripts/rgn-at7.d: New tests.
+
 2013-02-12  Yufeng Zhang  <yufeng.zhang@arm.com>
 
        * ld-aarch64/emit-relocs-264.d: Append the '-Mno-aliases' option to
diff --git a/ld/testsuite/ld-scripts/rgn-at6.d b/ld/testsuite/ld-scripts/rgn-at6.d
new file mode 100644 (file)
index 0000000..80f9b8a
--- /dev/null
@@ -0,0 +1,9 @@
+#source: rgn-at6.s
+#ld: -T rgn-at6.t
+#objdump: -h --wide
+#xfail: rx-*-*
+# Test that lma is aligned as for vma when lma_region==region.
+
+#...
+.* 0+10000 +0+10000 .*
+.* 0+10100 +0+10100 .*
diff --git a/ld/testsuite/ld-scripts/rgn-at6.s b/ld/testsuite/ld-scripts/rgn-at6.s
new file mode 100644 (file)
index 0000000..20571bc
--- /dev/null
@@ -0,0 +1,6 @@
+ .text
+ .long 0
+
+ .data
+ .p2align 8
+ .long 0
diff --git a/ld/testsuite/ld-scripts/rgn-at6.t b/ld/testsuite/ld-scripts/rgn-at6.t
new file mode 100644 (file)
index 0000000..0408dcd
--- /dev/null
@@ -0,0 +1,11 @@
+MEMORY
+{
+  ram : ORIGIN = 0x10000, LENGTH = 0x10000
+}
+
+SECTIONS
+{
+  .text : {*(.text)} > ram AT> ram
+  .data : ALIGN (16) {*(.data)} > ram AT> ram
+  /DISCARD/ : {*(*)}
+}
diff --git a/ld/testsuite/ld-scripts/rgn-at7.d b/ld/testsuite/ld-scripts/rgn-at7.d
new file mode 100644 (file)
index 0000000..a12ca17
--- /dev/null
@@ -0,0 +1,9 @@
+#source: rgn-at6.s
+#ld: -T rgn-at7.t
+#objdump: -h --wide
+#xfail: rx-*-*
+# Test that lma is only aligned by script when lma_region!=region.
+
+#...
+.* 0+10000 +0+20000 .*
+.* 0+10100 +0+20010 .*
diff --git a/ld/testsuite/ld-scripts/rgn-at7.t b/ld/testsuite/ld-scripts/rgn-at7.t
new file mode 100644 (file)
index 0000000..c1f2789
--- /dev/null
@@ -0,0 +1,12 @@
+MEMORY
+{
+  ram : ORIGIN = 0x10000, LENGTH = 0x10000
+  rom : ORIGIN = 0x20000, LENGTH = 0x10000
+}
+
+SECTIONS
+{
+  .text : {*(.text)} > ram AT> rom
+  .data : ALIGN (16) {*(.data)} > ram AT> rom
+  /DISCARD/ : {*(*)}
+}