[committed] Return to caller when _dl_fixup fails on hppa
Commit Message
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
2017-07-23 John David Anglin <danglin@gcc.gnu.org>
[BZ 19170]
* sysdeps/hppa/dl-trampoline.S (_dl_runtime_resolve): Revise comment.
@@ -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 */