{
const char *name = h->root.root.string;
size_t len = strlen (name);
+ asection *altos = NULL;
+ bfd_vma value = os->vma + os->size;
if (len > 8 && name[0] == '_' && name[1] == '_'
&& (!strncmp (name + 2, "start_", 6)
- || !strcmp (name + len - 6, "_start")))
- {
- bfd_vma value = os->vma + os->size;
-
- os = bfd_sections_find_if (info->output_bfd,
- section_start_symbol, &value);
-
- if (os != NULL)
- ensure_precisely_bounded_section (os, htab,
- c64_pad_section);
- }
+ || !strcmp (name + len - 6, "_start"))
+ && ((altos = bfd_sections_find_if
+ (info->output_bfd, section_start_symbol, &value))
+ != NULL))
+ ensure_precisely_bounded_section (altos, htab,
+ c64_pad_section);
/* XXX We're overfitting here because the offset of H within
the output section is not yet resolved and ldscript
defined symbols do not have input section information. */
- else
- ensure_precisely_bounded_section (os, htab,
- c64_pad_section);
+ ensure_precisely_bounded_section (os, htab, c64_pad_section);
}
}
}
run_dump_test_lp64 "morello-sec-round-data-only"
run_dump_test_lp64 "morello-sec-round-include-relro"
run_dump_test_lp64 "morello-pcc-bounds-include-readonly"
+run_dump_test_lp64 "morello-sec-round-choose-linker-syms"
run_dump_test_lp64 "morello-tlsdesc"
run_dump_test_lp64 "morello-tlsdesc-static"
run_dump_test_lp64 "morello-tlsdesc-staticpie"
--- /dev/null
+# Checking that we include RELRO sections in PCC bounds.
+#
+# Check is done using the fragment values to show what the size of the PCC
+# bounds is given as, and we reorder sections so that at least one RELRO
+# section is ater all READONLY ALLOC section.
+#
+# Test only works if we have relro, so is unsupported bare-metal.
+#
+# Test is implemented by ensuring that the .data.rel.ro is the last section in
+# the RELRO segment, and that .data is directly after it. This is ensured with
+# a linker script. If we don't include RELRO in our PCC bounds then
+# .data.rel.ro will not be within the range of the `obj` capability (since the
+# .data.rel.ro section itself is marked as being writeable).
+#
+#source: morello-sec-round-choose-linker-syms.s
+#as: -march=morello+c64
+#ld: -static -T morello-sec-round-choose-linker-syms.ld
+#objdump: --section-headers -j .data.rel.ro
+
+.*: file format .*
+#...
+.* \.data\.rel\.ro 00010020 [0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 2\*\*5
+#pass
--- /dev/null
+SECTIONS {
+ . = SEGMENT_START("text-segment", SIZEOF_HEADERS);
+ .text : { *(.text) }
+ .dynamic : { *(.dynamic) }
+ .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
+ .data.rel.ro : {
+ __data_relro_start = .;
+ *(.data.rel.ro*)
+ }
+ .data : { *(.data) }
+}
+
--- /dev/null
+.arch morello+c64
+
+ .section .data.rel.ro.local,"aw",@progbits
+ .asciz "Hello there ;-)"
+ .zero 0x10000
+
+ .data
+data_start:
+ .chericap __data_relro_start
+ .text
+
+obj:
+
+ adrp c0, data_start
+ add c0, c0, :lo12:data_start
+ ldr c0, [c0]