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] Fix GOT relocation overflow on SPARC.
Date: Sat, 10 Feb 2018 02:13:00 -0000	[thread overview]
Message-ID: <a8735c82b8519d8b18915765ca983fc07154a17d@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT a8735c82b8519d8b18915765ca983fc07154a17d ***

Author: Eric Botcazou <ebotcazou@gcc.gnu.org>
Branch: master
Commit: a8735c82b8519d8b18915765ca983fc07154a17d

Fix GOT relocation overflow on SPARC.

There are 2 failures left in the linker testsuite on SPARC64/Linux and
they are caused by 2 different issues leading to the same end effect:
the overflow of the relocation section for the GOT, i.e. the linker
generates too many dynamic relocations for the GOT wrt the size of the
relocation section, leading to memory corruption and missing relocations
in the final binary.

The first issue was introduced by:
  https://sourceware.org/ml/binutils/2017-06/msg00368.html
which makes the linker generate more R_SPARC_RELATIVE relocations for
the GOT without adjusting the size of the relocation section.  This is
fixed by (1) preventively adjusting this size in allocate_dynrelocs and
(2) generating R_SPARC_NONE if needed when R_SPARC_GOTDATA_OP is relaxed.

The second issue is that we generate a GOT relocation for an undefined
weak symbol with non-default visibility in a PIC binary without accounting
for that  in the size of the relocation section.  Since the address of the
symbol should resolve to 0 at run time, it is fixed by not generating the
relocation at all, i.e. leaving the GOT entry zeroed.

bfd/
	* elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Reorder conditions.
	(sparc_elf_append_rela): Assert that there is enough room in section.
	(_bfd_sparc_elf_copy_indirect_symbol): Fix formatting.
	(_bfd_sparc_elf_adjust_dynamic_symbol): Minor tweak.
	(allocate_dynrelocs): Remove outdated comments and reorder conditions.
	For a symbol subject to a GOT relocation, reserve a slot in the
	relocation section if the symbol isn't dynamic and we are in PIC mode.
	(_bfd_sparc_elf_relocate_section) <R_SPARC_GOTDATA_OP>: If relocation
	is relaxed and a slot was reserved, generate a R_SPARC_NONE relocation.
	<R_SPARC_GOTDATA_OP_HIX22>: Adjust comments.
	<R_SPARC_PC10>: Reorder conditions.  Remove always-false assertion.
	(_bfd_sparc_elf_finish_dynamic_symbol): Rename local_undefweak into
	resolved_to_zero.  Do not generate a dynamic GOT relocation for an
	undefined weak symbol with non-default visibility.  Remove superfluous
	'else' and fix formatting.


             reply	other threads:[~2018-02-10  2:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-10  2:13 sergiodj+buildbot [this message]
2018-02-10  2:13 ` Failures on Fedora-i686, branch master sergiodj+buildbot
2018-02-10  2:30 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-02-10  2:36 ` Failures on Fedora-s390x-m64, " sergiodj+buildbot
2018-02-10  2:47 ` Failures on Fedora-x86_64-native-gdbserver-m64, " sergiodj+buildbot
2018-02-10  3:02 ` Failures on Fedora-x86_64-cc-with-index, " sergiodj+buildbot
2018-02-10 20:04 ` Failures on Debian-s390x-m64, " sergiodj+buildbot
2018-02-10 20:20 ` Failures on Debian-s390x-native-extended-gdbserver-m64, " sergiodj+buildbot
2018-02-11  4:47 ` Failures on Ubuntu-AArch32-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-02-11  5:19 ` Failures on Ubuntu-AArch32-native-gdbserver-m32, " sergiodj+buildbot
2018-02-12  8:14 ` Failures on Ubuntu-AArch64-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=a8735c82b8519d8b18915765ca983fc07154a17d@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).