Allow a second -T<section>=<addr> to override a previous version on the same linker...
authorNick Clifton <nickc@redhat.com>
Mon, 27 Jun 2016 15:35:58 +0000 (16:35 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 27 Jun 2016 15:35:58 +0000 (16:35 +0100)
PR ld/20302
* lexsup.c (set_segment_start): If resetting the start address of
a section, remember to generate a new script element as well.
* testsuite/ld-scripts/pr20302.d: New test.
* testsuite/ld-scripts/scripts.exp: Run the new test.

ld/ChangeLog
ld/lexsup.c
ld/testsuite/ld-scripts/pr20302.d [new file with mode: 0644]
ld/testsuite/ld-scripts/script.exp

index 50adaee6199668d4d26bca65f6ab90a0c68b6240..c1b7f45c03d798059edaeebed1663f917dcd7406 100644 (file)
@@ -1,3 +1,11 @@
+2016-06-27  Nick Clifton  <nickc@redhat.com>
+
+       PR ld/20302
+       * lexsup.c (set_segment_start): If resetting the start address of
+       a section, remember to generate a new script element as well.
+       * testsuite/ld-scripts/pr20302.d: New test.
+       * testsuite/ld-scripts/scripts.exp: Run the new test.
+
 2016-06-24  Alan Modra  <amodra@gmail.com>
 
        * testsuite/ld-aarch64/aarch64-elf.exp (aarch64_choose_ilp32_emul):
index 7f8146ca357d1174d02906dd9badea0e37d2d363..6d28e9142b090814dd9dd0637e4a44da5732a91a 100644 (file)
@@ -1686,6 +1686,7 @@ set_segment_start (const char *section, char *valstr)
     if (strcmp (seg->name, name) == 0)
       {
        seg->value = val;
+       lang_section_start (section, exp_intop (val), seg);
        return;
       }
   /* There was no existing value so we must create a new segment
diff --git a/ld/testsuite/ld-scripts/pr20302.d b/ld/testsuite/ld-scripts/pr20302.d
new file mode 100644 (file)
index 0000000..ec655dd
--- /dev/null
@@ -0,0 +1,12 @@
+#ld: -Tdata=0x1000 -Tdata=0x2000 -Tcross2.t
+#source: align2a.s
+#objdump: -h
+#notarget: rx-*-* *-*-aout *-*-netbsd x86_64-*-cygwin *-*-vms
+# RX uses non standard section names.
+# AOUT and NETBSD  have fixed address for the data section.
+# x86_64 Cygwin biases all start addresses to be > 2Gb.
+# VMS targets need extra libraries.
+
+#...
+  . \.data[    ]+0+[0-9a-f]+[  ]+0+02000[      ]+0+02000.*
+#pass
index b178cb3d2ea3d3cebef1032e7616b18126536bbd..1b19202818f948cd8d114027a311d13ac14001cf 100644 (file)
@@ -230,3 +230,4 @@ foreach test_script $test_script_list {
 }
 
 run_dump_test "align-with-input"
+run_dump_test "pr20302"