Summary: | ld -r may create reloc sections with unordered relocs | ||
---|---|---|---|
Product: | binutils | Reporter: | Alan Modra <amodra> |
Component: | ld | Assignee: | Alan Modra <amodra> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bruno |
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | 2.26 | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Bug Depends on: | |||
Bug Blocks: | 18867 |
Description
Alan Modra
2014-12-01 10:21:42 UTC
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gdb and binutils". The branch, master has been updated via 53df40a43c968f4d97754226d62775d1fe665459 (commit) from 621661e3faf809d4f28bb84e94e30c1c8a8cc933 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=53df40a43c968f4d97754226d62775d1fe665459 commit 53df40a43c968f4d97754226d62775d1fe665459 Author: Alan Modra <amodra@gmail.com> Date: Wed Dec 3 22:00:18 2014 +1030 Sort relocs output by ld -r bfd/ PR 17666 * elflink.c: Include bfd_stdint.h. (cmp_ext32l_r_offset, cmp_ext32b_r_offset, cmp_ext64l_r_offset, cmp_ext64b_r_offset): New functions. (elf_link_adjust_relocs): Sort relocs. Free reloc hashes after sorting invalidates. ld/testsuite/ * ld-powerpc/vxworks-relax.rd: Update for reloc sorting. * ld-powerpc/vxworks-relax-2.rd: Likewise. * ld-sh/sh64/reldl32.rd: Likewise. * ld-sh/sh64/reldl64.rd: Likewise. ----------------------------------------------------------------------- Summary of changes: bfd/ChangeLog | 9 ++ bfd/elflink.c | 158 ++++++++++++++++++++++++++++ ld/testsuite/ChangeLog | 7 ++ ld/testsuite/ld-powerpc/vxworks-relax-2.rd | 4 +- ld/testsuite/ld-powerpc/vxworks-relax.rd | 4 +- ld/testsuite/ld-sh/sh64/reldl32.rd | 4 +- ld/testsuite/ld-sh/sh64/reldl64.rd | 4 +- 7 files changed, 182 insertions(+), 8 deletions(-) fixed This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gdb and binutils". The branch, master has been updated via 28dbcedc7b1282b93c3f25c4e42ae71b44e8e2a8 (commit) from 4e3272393ff1ab2c07d9fa209d2ae82954f7954c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=28dbcedc7b1282b93c3f25c4e42ae71b44e8e2a8 commit 28dbcedc7b1282b93c3f25c4e42ae71b44e8e2a8 Author: Alan Modra <amodra@gmail.com> Date: Tue Dec 9 14:32:22 2014 +1030 Don't sort ld -r relocs for mips HI16/LO16 are deliberately put adjacent, which might mean relocs are then not sorted by r_offset. See tc-mips.c:mips_frob_file. Don't undo the HI16/LO16 sorting. PR 17666 * elf-bfd.h (struct elf_backend_data): Add sort_relocs_p. * elfxx-target.h (elf_backend_sort_relocs_p): Define. (elfNN_bed): Init new field. * elflink.c (elf_link_adjust_relocs): Conditionally sort. (bfd_elf_final_link): Control sorting of relocs. * elfxx-mips.c (_bfd_mips_elf_sort_relocs_p): New function. * elfxx-mips.h (_bfd_mips_elf_sort_relocs_p): Declare. * elf32-mips.c (elf_backend_sort_relocs_p): Define. * elf64-mips.c (elf_backend_sort_relocs_p): Define. ----------------------------------------------------------------------- Summary of changes: bfd/ChangeLog | 13 +++++++++++++ bfd/elf-bfd.h | 5 +++++ bfd/elf32-mips.c | 2 ++ bfd/elf64-mips.c | 1 + bfd/elflink.c | 51 +++++++++++++++++++++++++++++---------------------- bfd/elfxx-mips.c | 12 ++++++++++++ bfd/elfxx-mips.h | 2 ++ bfd/elfxx-target.h | 4 ++++ 8 files changed, 68 insertions(+), 22 deletions(-) The binutils-2_25-branch branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ccfa71befe7824964304d73e35f4e68a3f06306c commit ccfa71befe7824964304d73e35f4e68a3f06306c Author: Alan Modra <amodra@gmail.com> Date: Wed Dec 3 22:00:18 2014 +1030 Sort relocs output by ld -r bfd/ PR 17666 * elflink.c: Include bfd_stdint.h. (cmp_ext32l_r_offset, cmp_ext32b_r_offset, cmp_ext64l_r_offset, cmp_ext64b_r_offset): New functions. (elf_link_adjust_relocs): Sort relocs. Free reloc hashes after sorting invalidates. ld/testsuite/ * ld-powerpc/vxworks-relax.rd: Update for reloc sorting. * ld-powerpc/vxworks-relax-2.rd: Likewise. * ld-sh/sh64/reldl32.rd: Likewise. * ld-sh/sh64/reldl64.rd: Likewise. The binutils-2_25-branch branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=90e052f660418098b65f2b2245712ead75288d27 commit 90e052f660418098b65f2b2245712ead75288d27 Author: Alan Modra <amodra@gmail.com> Date: Tue Dec 9 14:32:22 2014 +1030 Don't sort ld -r relocs for mips HI16/LO16 are deliberately put adjacent, which might mean relocs are then not sorted by r_offset. See tc-mips.c:mips_frob_file. Don't undo the HI16/LO16 sorting. PR 17666 * elf-bfd.h (struct elf_backend_data): Add sort_relocs_p. * elfxx-target.h (elf_backend_sort_relocs_p): Define. (elfNN_bed): Init new field. * elflink.c (elf_link_adjust_relocs): Conditionally sort. (bfd_elf_final_link): Control sorting of relocs. * elfxx-mips.c (_bfd_mips_elf_sort_relocs_p): New function. * elfxx-mips.h (_bfd_mips_elf_sort_relocs_p): Declare. * elf32-mips.c (elf_backend_sort_relocs_p): Define. * elf64-mips.c (elf_backend_sort_relocs_p): Define. A symptom of unsorted relocators after partial linking, is the following message at final linking: /usr/bin/ld: error in qq.o(.eh_frame); no .eh_frame_hdr table will be created. Also see bug #16345. This fix seems to solve the problem from that report. |