+2018-09-14 Maciej W. Rozycki <macro@mips.com>
+ Maciej W. Rozycki <macro@linux-mips.org>
+
+ * ldexp.c (fold_binary): Always make the result of SEGMENT_START
+ section-relative.
+ * testsuite/ld-scripts/segment-start.d: New test.
+ * testsuite/ld-scripts/segment-start.ld: New test linker script.
+ * testsuite/ld-scripts/segment-start.s: New test source.
+ * testsuite/ld-scripts/script.exp: Run the new test.
+
2018-09-14 Maciej W. Rozycki <macro@linux-mips.org>
* ldexp.c (fold_binary): Check that `config.maxpagesize' is
operand, binary.rhs is first operand. */
if (expld.result.valid_p && tree->type.node_code == SEGMENT_START)
{
+ bfd_vma value = expld.result.value;
const char *segment_name;
segment_type *seg;
"isn't multiple of maximum page size\n"),
segment_name);
seg->used = TRUE;
- new_rel_from_abs (seg->value);
+ value = seg->value;
break;
}
+ new_rel_from_abs (value);
return;
}
run_dump_test "align-with-input"
run_dump_test "pr20302"
+
+run_dump_test "segment-start" {{name (default)}}
+run_dump_test "segment-start" {{name (overridden)} \
+ {ld -Ttext-segment=0x10000000}}
--- /dev/null
+#PROG: nm
+#name: SEGMENT_START expression not absolute
+#source: segment-start.s
+#ld: -e 0 -u __executable_start -T segment-start.ld
+#xfail: mmix-*-* pdp11-*-* powerpc-*-aix* powerpc-*-beos* rs6000-*-* sh-*-pe
+#xfail: c30-*-*aout* tic30-*-*aout* c54x*-*-*coff* tic54x-*-*coff*
+# XFAIL targets that are not expected to handle SEGMENT_START correctly.
+
+# Make sure `__executable_start' is regular:
+#
+# 10000000 T __executable_start
+#
+# not absolute:
+#
+# 10000000 A __executable_start
+
+#...
+0*10000000 T __executable_start
+#pass
--- /dev/null
+SECTIONS
+{
+ PROVIDE (__executable_start = SEGMENT_START ("text-segment", 0x10000000));
+ .text : { *(.text) }
+ .data : { *(.data) }
+ .bss : { *(.bss) }
+ .loader : { *(.loader) }
+ .symtab : { *(.symtab) }
+ .strtab : { *(.strtab) }
+ .shstrtab : { *(.shstrtab) }
+ /DISCARD/ : { *(*) }
+}
--- /dev/null
+ .text
+ .space 16