public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
* [2.25 COMMITTED] hppa: Return to caller if dl_fixup fails to resolve callee on hppa
@ 2017-01-01  0:00 John David Anglin
  0 siblings, 0 replies; only message in thread
From: John David Anglin @ 2017-01-01  0:00 UTC (permalink / raw)
  To: Libc-stable Mailing List

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

This is commit 1903b38c6599129d9c09d5cffc9ca7cbeb50b100 with revised comment.

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



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

2017-08-12  John David Anglin  <danglin@gcc.gnu.org>

	[BZ 19170]
	* sysdeps/hppa/dl-trampoline.S (_dl_runtime_resolve): Return to caller
	if _dl_fixup fails.

diff --git a/sysdeps/hppa/dl-trampoline.S b/sysdeps/hppa/dl-trampoline.S
index 856339bffe..3165c6f0e2 100644
--- a/sysdeps/hppa/dl-trampoline.S
+++ b/sysdeps/hppa/dl-trampoline.S
@@ -82,6 +82,21 @@ _dl_runtime_resolve:
 	bl	_dl_fixup,%rp
 	copy	%r21,%r19		/* set fixup func ltp */
 
+	/* 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 */
 	copy	%r28, %r22
 	copy	%r29, %r19
@@ -107,6 +122,13 @@ _dl_runtime_resolve:
 	/* Jump to new function, but return to previous function */
 	bv	%r0(%r22)
 	ldw	-20(%sp),%rp
+
+1:
+	/* Return to previous function */
+	ldw	-148(%sp),%rp
+	bv	%r0(%rp)
+	ldo	-128(%sp),%sp
+
         .EXIT
         .PROCEND
 	cfi_endproc

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-12 22:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-01  0:00 [2.25 COMMITTED] hppa: Return to caller if dl_fixup fails to resolve callee on hppa John David Anglin

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).