From: John David Anglin <dave.anglin@bell.net>
To: GNU C Library <libc-alpha@sourceware.org>
Cc: Carlos O'Donell <carlos@systemhalted.org>
Subject: [committed] Return to caller when _dl_fixup fails on hppa
Date: Sun, 16 Jul 2017 17:50:00 -0000 [thread overview]
Message-ID: <3C95024E-2059-4D16-B135-EFB4A57D5591@bell.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 769 bytes --]
The attached change modifies _dl_runtime_resolve to return to its caller when _dl_fixup
fails. This can occur on hppa when the caller attempts to call an undefined weak function.
The old code would fault when _dl_fixup fails.
The most problematic function in this regard is __gmon_start__. Currently, it is linked into
every shared object. This breaks the --as-needed ld option.
On Debian, we have an additional patch to treat __gmon_start__ as a true weak symbol.
I don't plan to apply this change as it becomes tricky to rebuild a distribution. Rebuilding
a shared library removes __gmon_start__ and this may break a package using the library.
This isn't a problem after everything is rebuilt.
Dave
--
John David Anglin dave.anglin@bell.net
[-- Attachment #2: dl-trampoline.S.d.txt --]
[-- Type: text/plain, Size: 989 bytes --]
2017-07-16 John David Anglin <danglin@gcc.gnu.org>
* 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..f1294a931f 100644
--- a/sysdeps/hppa/dl-trampoline.S
+++ b/sysdeps/hppa/dl-trampoline.S
@@ -82,6 +82,11 @@ _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 */
+ comib,= 0,%r28,1f
+
/* Load up the returned func descriptor */
copy %r28, %r22
copy %r29, %r19
@@ -107,6 +112,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
next reply other threads:[~2017-07-16 17:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-16 17:50 John David Anglin [this message]
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
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=3C95024E-2059-4D16-B135-EFB4A57D5591@bell.net \
--to=dave.anglin@bell.net \
--cc=carlos@systemhalted.org \
--cc=libc-alpha@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).