diff options
author | Alan Modra <amodra@gmail.com> | 2020-11-28 08:45:02 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-11-28 18:31:32 +1030 |
commit | 8d748d1dc56406228c2c76de2563859213364cbf (patch) | |
tree | 46df0c063155a202e2d84c698042b8df29f9ccf2 /ld | |
parent | ed5e05a2cf20d3eb473966c17e4c5b57889a9093 (diff) | |
download | fsf-binutils-gdb-8d748d1dc56406228c2c76de2563859213364cbf.zip fsf-binutils-gdb-8d748d1dc56406228c2c76de2563859213364cbf.tar.gz fsf-binutils-gdb-8d748d1dc56406228c2c76de2563859213364cbf.tar.bz2 |
PR26907, segment contains empty SHT_NOBITS section
Section ordering is important for _bfd_elf_map_sections_to_segments
and assign_file_positions_for_load_sections, which are only prepared
to handle sections in increasing LMA order. When zero size sections
are involved it is possible to have multiple sections at the same LMA.
In that case the zero size sections must sort before any non-zero size
sections regardless of their types.
bfd/
PR 26907
* elf.c (elf_sort_sections): Don't sort zero size !load sections
after load sections.
ld/
* testsuite/ld-elf/pr26907.ld,
* testsuite/ld-elf/pr26907.s,
* testsuite/ld-elf/pr26907.d: New test.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr26907.d | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr26907.ld | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr26907.s | 9 |
4 files changed, 31 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index fbc2d8a..b6d1aef 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2020-11-28 Alan Modra <amodra@gmail.com> + + * testsuite/ld-elf/pr26907.ld, + * testsuite/ld-elf/pr26907.s, + * testsuite/ld-elf/pr26907.d: New test. + 2020-11-27 Jozef Lawrynowicz <jozef.l@mittosystems.com> * emulparams/armelf.sh (OTHER_SECTIONS): Remove .noinit section diff --git a/ld/testsuite/ld-elf/pr26907.d b/ld/testsuite/ld-elf/pr26907.d new file mode 100644 index 0000000..1efb8cc --- /dev/null +++ b/ld/testsuite/ld-elf/pr26907.d @@ -0,0 +1,9 @@ +#ld: -T pr26907.ld +#readelf: -lW +#xfail: dlx-*-* ft32-*-* h8300-*-* ip2k-*-* m32r*-*-elf* m32r*-*-rtems* +#xfail: moxie-*-* msp430-*-* mt-*-* pru*-*-* visium-*-* + +#failif +#... + +LOAD +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x0+ 0x0+ .* +#... diff --git a/ld/testsuite/ld-elf/pr26907.ld b/ld/testsuite/ld-elf/pr26907.ld new file mode 100644 index 0000000..2cce1ee --- /dev/null +++ b/ld/testsuite/ld-elf/pr26907.ld @@ -0,0 +1,7 @@ +ENTRY (_start) +SECTIONS +{ + .text : { *(.text) } + .bss : { . = .; *(.bss) } + .data : { *(.data) } +} diff --git a/ld/testsuite/ld-elf/pr26907.s b/ld/testsuite/ld-elf/pr26907.s new file mode 100644 index 0000000..13b3a54 --- /dev/null +++ b/ld/testsuite/ld-elf/pr26907.s @@ -0,0 +1,9 @@ + .text + .global _start +_start: + .quad 0 + + .data + .quad 0 + + .section .bss,"aw",%nobits |