aboutsummaryrefslogtreecommitdiff
path: root/bfd/cpu-m10200.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@mips.com>2018-07-20 13:21:33 +0100
committerMaciej W. Rozycki <macro@mips.com>2018-07-20 13:21:33 +0100
commitdb841b6fcd8b3bc2e6d6774e81c14dfbb9ac815d (patch)
tree5dc8f055e8d4a0d2ce9ef102046f01802c632bec /bfd/cpu-m10200.c
parent0458ca44409420c3d5cdbbb21561ee71fd930d31 (diff)
downloadgdb-db841b6fcd8b3bc2e6d6774e81c14dfbb9ac815d.zip
gdb-db841b6fcd8b3bc2e6d6774e81c14dfbb9ac815d.tar.gz
gdb-db841b6fcd8b3bc2e6d6774e81c14dfbb9ac815d.tar.bz2
MIPS/LD: Fix crashing with a discarded dynamic relocation section
Fix a crash that occurs in `_bfd_mips_elf_finish_dynamic_sections' if a dynamic relocation section has been created, but marked to be discarded by an assignment to the /DISCARD/ output section in a linker script. In that case the output section is the absolute section, which has no ELF section data attached, so trying to set its `sh_size' parameter causes a null pointer dereference. This is only done as the value for the DT_RELSZ dynamic entry is being set, so fix the problem by not creating DT_REL, DT_RELSZ or DT_RELENT dynamic entries in the first place if the dynamic relocation section will not be output, as with no dynamic relocation data present these would not serve their purpose anyway. Add a generic ELF test case to verify that no dynamic relocation data is reported in the dynamic segment. bfd/ * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Do not create DT_REL, DT_RELSZ or DT_RELENT dynamic entries if the dynamic relocation section will be discarded from output. (_bfd_mips_elf_finish_dynamic_sections) <DT_RELSZ>: Assert that the dynamic relocation section will be retained in output. ld/ * testsuite/ld-elf/reloc-discard.d: New test. * testsuite/ld-elf/reloc-discard.ld: New test linker script. * testsuite/ld-elf/reloc-discard.s: New test source.
Diffstat (limited to 'bfd/cpu-m10200.c')
0 files changed, 0 insertions, 0 deletions