From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79595 invoked by alias); 16 Jul 2017 17:50:21 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 79568 invoked by uid 89); 16 Jul 2017 17:50:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 spammy=1076, ltp, Hx-languages-length:1747 X-HELO: torfep01.bell.net From: John David Anglin Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: multipart/mixed; boundary=Apple-Mail-48-81689322 Date: Sun, 16 Jul 2017 17:50:00 -0000 Subject: [committed] Return to caller when _dl_fixup fails on hppa Cc: Carlos O'Donell To: GNU C Library Message-Id: <3C95024E-2059-4D16-B135-EFB4A57D5591@bell.net> X-SW-Source: 2017-07/txt/msg00584.txt.bz2 --Apple-Mail-48-81689322 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Content-length: 764 The attached change modifies _dl_runtime_resolve to return to its caller wh= en _dl_fixup fails. This can occur on hppa when the caller attempts to call an undefine= d 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 we= ak symbol. I don't plan to apply this change as it becomes tricky to rebuild a distrib= ution. 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 --Apple-Mail-48-81689322 Content-Disposition: attachment; filename=dl-trampoline.S.d.txt Content-Type: text/plain; name="dl-trampoline.S.d.txt" Content-Transfer-Encoding: 7bit Content-length: 989 2017-07-16 John David Anglin * 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 --Apple-Mail-48-81689322--