public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: John David Anglin <dave.anglin@bell.net>
To: Carlos O'Donell <carlos@redhat.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	GNU C Library <libc-alpha@sourceware.org>,
	Carlos O'Donell <carlos@systemhalted.org>
Subject: Re: [committed] Return to caller when _dl_fixup fails on hppa
Date: Sun, 23 Jul 2017 23:58:00 -0000	[thread overview]
Message-ID: <B509681B-F4FB-459D-950B-DEB8131115A4@bell.net> (raw)
In-Reply-To: <b5579ffc-6401-6511-96c6-0d7bcf076c6c@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

On 2017-07-17, at 7:11 AM, Carlos O'Donell wrote:

> On 07/17/2017 03:10 AM, Andreas Schwab wrote:
>> This information should be added in a comment.
> 
> Dave, Thanks for all the fixes. I agree with Andreas, this should be
> documented with a comment.

I committed the attached comment update.  I tied it to the BZ report so it's clear what we
are trying to fix.

At this time, Debian has a local patch which removes __gmon_start__ from crtn.S on hppa.

Dave
--
John David Anglin	dave.anglin@bell.net



[-- Attachment #2: dl-trampoline-v3.S.d.txt --]
[-- Type: text/plain, Size: 1497 bytes --]

2017-07-23  John David Anglin  <danglin@gcc.gnu.org>

	[BZ 19170]
	* sysdeps/hppa/dl-trampoline.S (_dl_runtime_resolve): Revise comment.

diff --git a/sysdeps/hppa/dl-trampoline.S b/sysdeps/hppa/dl-trampoline.S
index f1294a931f..3165c6f0e2 100644
--- a/sysdeps/hppa/dl-trampoline.S
+++ b/sysdeps/hppa/dl-trampoline.S
@@ -82,9 +82,19 @@ _dl_runtime_resolve:
 	bl	_dl_fixup,%rp
 	copy	%r21,%r19		/* set fixup func ltp */
 
-	/* Sometimes a final executable may attempt to call an undefined
-	   weak function (e.g., __gmon_start__).  Return if the function
-	   was not resolved by _dl_fixup */
+	/* While the linker will set a function pointer to NULL when it
+	   encounters an undefined weak function, we need to dynamically
+	   detect removed weak functions.  The issue arises because a weak
+	   __gmon_start__ function was added to shared executables to work
+	   around issues in _init that are now resolved.  The presence of
+	   __gmon_start__ in every shared library breaks the linker
+	   `--as-needed' option.  This __gmon_start__ function does nothing
+	   but removal is tricky.  Depending on the binding, removal can
+	   cause an application using it to fault.  The call to _dl_fixup
+	   returns NULL when a function isn't resolved.  In order to help
+	   with __gmon_start__ removal, we return directly to the caller
+	   when _dl_fixup returns NULL.  This check could be removed when
+	   BZ 19170 is fixed.  */
 	comib,=	0,%r28,1f
 
 	/* Load up the returned func descriptor */

      parent reply	other threads:[~2017-07-23 17:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-16 17:50 John David Anglin
2017-07-16 18:53 ` Andreas Schwab
2017-07-16 19:46   ` John David Anglin
2017-07-16 21:31     ` Andreas Schwab
2017-07-16 22:02       ` John David Anglin
2017-07-17  7:10         ` Andreas Schwab
2017-07-17 11:11           ` Carlos O'Donell
2017-07-17 11:52             ` John David Anglin
2017-07-23 23:58             ` John David Anglin [this message]

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=B509681B-F4FB-459D-950B-DEB8131115A4@bell.net \
    --to=dave.anglin@bell.net \
    --cc=carlos@redhat.com \
    --cc=carlos@systemhalted.org \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@linux-m68k.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).