From patchwork Sun Jul 23 17:01:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 792573 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-82352-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="LlJIVDCl"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xFrQG0HYkz9sMN for ; Mon, 24 Jul 2017 03:01:57 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; q=dns; s=default; b= SmjQEC/PObNeTXY7FxFFZj2EIDWNYZ+27LE5BgwBDbWWw3YTozojpPa7VBt53fS3 uz1yoUrZzTKnUUPpAm0+A28XlioXEklxOHJcxuFK0cP0iEGBogOKwHiG8P/BocGK yX1wGdXhpMHYz68uIGXnDefdbdQhYevk/faZhsIghf0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; s=default; bh=ZJC LuXnl3qW4yznQoiE/kZ7AQdE=; b=LlJIVDClh/0piu1WB+4qLMBimAmB447iXi6 /SJutCL+RI3zkE79TYfOjLgjrFm609K1hYqHBXdF2Wcik3v1waDIjr5nd0f+Pbuv mgc5lfgySLiHio/u0ng1k7DCOiId4f4d26So6aZprNLZdoQY9OUcb/o+9Oa+N0Xn nktUh7WU= Received: (qmail 23190 invoked by alias); 23 Jul 2017 17:01:48 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 22199 invoked by uid 89); 23 Jul 2017 17:01:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 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=H*c:sk:Apple-M, ltp X-HELO: mtlfep02.bell.net Subject: Re: [committed] Return to caller when _dl_fixup fails on hppa Mime-Version: 1.0 (Apple Message framework v1085) From: John David Anglin In-Reply-To: Date: Sun, 23 Jul 2017 13:01:43 -0400 Cc: Andreas Schwab , GNU C Library , Carlos O'Donell Message-Id: References: <3C95024E-2059-4D16-B135-EFB4A57D5591@bell.net> <87r2xggqnr.fsf@linux-m68k.org> <140DEBFA-778E-4912-853A-74DE078A95F5@bell.net> <87mv84gjbf.fsf@linux-m68k.org> <859EA4CC-A29C-4E31-97D5-57A9598DB5C6@bell.net> To: Carlos O'Donell 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 [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 */