public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: sergiodj+buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] MIPS/LD: Fix crashing with a discarded dynamic relocation section
Date: Fri, 20 Jul 2018 12:54:00 -0000	[thread overview]
Message-ID: <db841b6fcd8b3bc2e6d6774e81c14dfbb9ac815d@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT db841b6fcd8b3bc2e6d6774e81c14dfbb9ac815d ***

Author: Maciej W. Rozycki <macro@mips.com>
Branch: master
Commit: db841b6fcd8b3bc2e6d6774e81c14dfbb9ac815d

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.


             reply	other threads:[~2018-07-20 12:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-20 12:54 sergiodj+buildbot [this message]
2018-07-20 12:54 ` Failures on Debian-s390x-native-gdbserver-m64, branch master sergiodj+buildbot
2018-07-20 13:09 ` Failures on Debian-s390x-m64, " sergiodj+buildbot
2018-07-20 13:38 ` Failures on Debian-s390x-native-extended-gdbserver-m64, " sergiodj+buildbot
2018-07-21 11:25 ` Failures on Fedora-i686, " sergiodj+buildbot
2018-07-21 11:49 ` Failures on Fedora-x86_64-m32, " sergiodj+buildbot
2018-07-21 12:25 ` Failures on Fedora-x86_64-cc-with-index, " sergiodj+buildbot
2018-07-21 12:28 ` *** COMPILATION FAILED *** Failures on Fedora-x86_64-w64-mingw32, branch master *** BREAKAGE *** sergiodj+buildbot
2018-07-21 12:54 ` Failures on Fedora-x86_64-m64, branch master sergiodj+buildbot
2018-07-21 12:55 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " sergiodj+buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=db841b6fcd8b3bc2e6d6774e81c14dfbb9ac815d@gdb-build \
    --to=sergiodj+buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).