Checks
Commit Message
This fixes a bug with the .note.spu_name section flags, which were
made SEC_LOAD without SEC_ALLOC. That combination doesn't really make
sense and led to odd layout behaviour. In addition .note.spu_name
now uses the normal note alignment, with some tweaks to keep its file
offset 16 byte aligned. This tends to work better in the testsuite
when the standard scripts are not used and the note is merged with
other notes.
bfd/
* elf32-spu.c (spu_elf_create_sections): Remove SEC_LOAD from
.note.spu_name, and align to 4 bytes.
(spu_elf_fake_sections): Tweak .note.spu_name output section
alignment for layout.
(spu_elf_final_write_processing): New function.
(elf_backend_final_write_processing): Define.
binutils/
* testsuite/binutils-all/objcopy.exp (pr25662): Don't xfail spu.
ld/
* testsuite/ld-elf/orphan-region.d: Don't xfail spu.
* testsuite/ld-elf/pr23658-1e.d: Likewise.
* testsuite/ld-scripts/provide-8.d: Likewise.
* testsuite/ld-spu/ovl.d: Remove commented out old matches.
Adjust expected overlay file offset.
* testsuite/ld-spu/ovl2.d: Likewise.
@@ -583,10 +583,10 @@ spu_elf_create_sections (struct bfd_link_info *info)
ibfd = info->input_bfds;
/* This should really be SEC_LINKER_CREATED, but then we'd need
to write out the section ourselves. */
- flags = SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+ flags = SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
s = bfd_make_section_anyway_with_flags (ibfd, SPU_PTNOTE_SPUNAME, flags);
if (s == NULL
- || !bfd_set_section_alignment (s, 4))
+ || !bfd_set_section_alignment (s, 2))
return false;
/* Because we didn't set SEC_LINKER_CREATED we need to set the
proper section type. */
@@ -5342,10 +5342,32 @@ spu_elf_fake_sections (bfd *obfd ATTRIBUTE_UNUSED,
asection *sec)
{
if (strcmp (sec->name, SPU_PTNOTE_SPUNAME) == 0)
- hdr->sh_type = SHT_NOTE;
+ {
+ hdr->sh_type = SHT_NOTE;
+ hdr->sh_addralign = 16;
+ }
return true;
}
+/* .note.spu_name is read by the PPU from the object, and possibly
+ needs the file offset to be aligned to 16 bytes. We used to simply
+ call bfd_set_section_alignment to set the alignment to 16, but if
+ left like that it triggers a readelf warning. Now for layout we
+ tweak the alignment to 16 in spu_elf_fake_sections, and restore it
+ to 4 here. */
+
+static bool
+spu_elf_final_write_processing (bfd *abfd)
+{
+ asection *sec = bfd_get_section_by_name (abfd, SPU_PTNOTE_SPUNAME);
+ if (sec != NULL)
+ {
+ struct bfd_elf_section_data *esd = elf_section_data (sec);
+ esd->this_hdr.sh_addralign = 4;
+ }
+ return _bfd_elf_final_write_processing (abfd);
+}
+
/* Tweak phdrs before writing them out. */
static bool
@@ -5539,6 +5561,7 @@ spu_elf_size_sections (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
#define elf_backend_modify_headers spu_elf_modify_headers
#define elf_backend_init_file_header spu_elf_init_file_header
#define elf_backend_fake_sections spu_elf_fake_sections
+#define elf_backend_final_write_processing spu_elf_final_write_processing
#define elf_backend_special_sections spu_elf_special_sections
#define bfd_elf32_bfd_final_link spu_elf_final_link
@@ -1556,7 +1556,6 @@ run_dump_test "pr23633"
run_dump_test "set-section-alignment"
setup_xfail "hppa*-*-*"
-setup_xfail "spu-*-*"
clear_xfail "hppa*64*-*-hpux*" "hppa*-*-linux*" "hppa*-*-lites*"
clear_xfail "hppa*-*-*n*bsd*" "hppa*-*-*elf*"
if { [istarget pdp11-*-*] } {
@@ -1,9 +1,9 @@
#source: orphan-region.s
#ld: -T orphan-region.ld -N -z stack-size=0 --no-warn-rwx-segments
#readelf: -S -l --wide
-#xfail: [uses_genelf] hppa*64*-*-hpux* spu-*-*
+#xfail: [uses_genelf] hppa*64*-*-hpux*
# if not using elf.em, you don't get fancy orphan handling
-# spu twiddles LOAD range, hppa64 adds PHDR
+# hppa64 adds PHDR
#...
\[[ 0-9]+\] \.text[ \t]+PROGBITS[ \t]+0*40000000[ \t]+.*
@@ -14,7 +14,7 @@
#xfail: cr16-* crx-* visium-*
# The following targets place .note.gnu.build-id in unusual places.
#xfail: *-*-hpux*
-#xfail: arc*-* avr-* m68hc1*-* microblaze*-* nds32*-* spu-*-* xstormy16-*-*
+#xfail: arc*-* avr-* m68hc1*-* microblaze*-* nds32*-* xstormy16-*-*
#noxfail: microblaze*-linux*
#...
@@ -1,7 +1,7 @@
#source: provide-5.s
#ld: -T provide-8.t
#nm: -B
-#xfail: mmix-*-* spu-*-*
+#xfail: mmix-*-*
# Placing a symbol outside of the image isn't well-defined in PE.
#notarget: *-*-pe *-*-mingw* *-*-cygwin
@@ -70,30 +70,6 @@ Disassembly of section \.text:
.* ila \$79,1076 # 434
.* bra? .* <__ovly_load>.*
-#00000330 <00000000\.ovl_call\.f1_a1>:
-#.* bra?sl \$75,.* <__ovly_load>.*
-#.*00 04 04 00.*
-#
-#00000338 <00000000\.ovl_call\.f2_a1>:
-#.* bra?sl \$75,.* <__ovly_load>.*
-#.*00 04 04 04.*
-#
-#00000340 <00000000\.ovl_call\.f1_a2>:
-#.* bra?sl \$75,.* <__ovly_load>.*
-#.*00 08 04 00.*
-#
-#00000348 <00000000\.ovl_call\.f2_a2>:
-#.* bra?sl \$75,.* <__ovly_load>.*
-#.*00 08 04 24.*
-#
-#00000350 <00000000\.ovl_call\.f4_a1>:
-#.* bra?sl \$75,.* <__ovly_load>.*
-#.*00 04 04 10.*
-#
-#00000358 <00000000.ovl_call.14:8>:
-#.* bra?sl \$75,.* <__ovly_load>.*
-#.*00 08 04 34.*
-
Disassembly of section \.ov_a1:
00000400 <f1_a1>:
@@ -150,13 +126,11 @@ Disassembly of section .data:
00000450 <_ovly_table>:
450: 00 00 04 00 .*
454: 00 00 00 20 .*
-# 458: 00 00 03 40 .*
- 458: 00 00 01 00 .*
+ 458: 00 00 00 e0 .*
45c: 00 00 00 01 .*
460: 00 00 04 00 .*
464: 00 00 00 40 .*
-# 468: 00 00 03 60 .*
- 468: 00 00 01 20 .*
+ 468: 00 00 01 00 .*
46c: 00 00 00 01 .*
00000470 <_ovly_buf_table>:
@@ -103,13 +103,11 @@ Disassembly of section \.data:
00000430 <_ovly_table>:
.*00 00 04 00 .*
.*00 00 00 20 .*
-#.*00 00 03 10 .*
-.*00 00 01 00 .*
+.*00 00 00 e0 .*
.*00 00 00 01 .*
.*00 00 04 00 .*
.*00 00 00 20 .*
-#.*00 00 03 20 .*
-.*00 00 01 20 .*
+.*00 00 01 00 .*
.*00 00 00 01 .*
00000450 <_ovly_buf_table>: