From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zmcc-2-mx.zmailcloud.com (zmcc-2-mx.zmailcloud.com [52.37.197.7]) by sourceware.org (Postfix) with ESMTPS id 65A88387540F for ; Wed, 16 Dec 2020 18:34:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 65A88387540F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=symas.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hyc@symas.com Received: from zmcc-2.zmailcloud.com (zmcc-2-mta-1.zmailcloud.com [146.148.52.56]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by zmcc-2-mx.zmailcloud.com (Postfix) with ESMTPS id 94DD540519; Wed, 16 Dec 2020 12:34:05 -0600 (CST) Received: from zmcc-2.zmailcloud.com (localhost [127.0.0.1]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTPS id 21A51D06F6; Wed, 16 Dec 2020 12:34:05 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTP id 09ABDD06F4; Wed, 16 Dec 2020 12:34:05 -0600 (CST) DKIM-Filter: OpenDKIM Filter v2.10.3 zmcc-2-mta-1.zmailcloud.com 09ABDD06F4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=symas.com; s=37C7994C-28CA-11EA-A30F-68F90BB9D764; t=1608143645; bh=sj3zHZr3+g7E2JcAB5sgoaLyIzTCql8DRfnMSRz/PLg=; h=To:From:Message-ID:Date:MIME-Version; b=Zqp8OKWv+iVEeTn/g43bUw+0zE+p+fq0NyocIchD66k85ilvJJ9nTLIPDuajiv92E C8jtMyjGpGmHSfSCX5eiQxYRioq4B0ud5CF/WHhhr7eV7GepZgBEpIwqYcqBWdmPFF bLt2y0ncN7uvaF3k/SyFAZJmBL1cFDt85cr0NK3Hab5V85zdu1MUPrPEyKOiIu1HtE Ck+cjxzvbDDZ8BvTbyqDtRrvGOSLbiMCSj3naj+vyGWM0YM4rFmvA6/DkFauYjenZJ BWcOVArTqe6F2TKb+V4Vsj2/SooMBLMAJALcfdFM3bZ+J8N6+vKiLsibfhBU9DrCcG W16156lvBNThg== Received: from zmcc-2.zmailcloud.com ([127.0.0.1]) by localhost (zmcc-2-mta-1.zmailcloud.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id sU90rZpc0vD3; Wed, 16 Dec 2020 12:34:04 -0600 (CST) Received: from [192.168.1.155] (unknown [84.203.30.25]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTPSA id B7679CE88D; Wed, 16 Dec 2020 12:34:03 -0600 (CST) Subject: Re: [PATCH] ld: Call plugin hooks only if they are available To: "H.J. Lu" , Nick Clifton Cc: Cary Coutant , Binutils References: <53b8973b-40a4-2550-3307-66d7f13707d5@symas.com> <1aaf4429-074c-7912-e6e6-4d2f82d6ef10@redhat.com> <7b118db2-9502-c45e-9f47-6b6f6a5f9646@symas.com> <7dba4046-3d50-c7e6-915d-08bf590bf057@redhat.com> <7b124cd4-529b-0069-3044-9d733a4e4e5c@symas.com> <20ad87a3-283d-7e49-9c2e-ed13001f6c87@symas.com> <70139665-0b8c-63dc-3a9d-b24a25bd8122@redhat.com> <2475d2a6-c63e-6dac-0f56-fa9acb6f20de@symas.com> <0e9925e6-512b-0ed6-8846-a86a40fb0a47@redhat.com> <3bfc2ea0-d49d-a194-18e0-57c007fd3746@redhat.com> <7ce0403d-00ac-d853-3af8-c612a6eaa1d0@redhat.com> From: Howard Chu Message-ID: <5329641c-0689-1f8a-cfbd-d728087b4ebf@symas.com> Date: Wed, 16 Dec 2020 18:34:01 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_RED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2020 18:34:08 -0000 H.J. Lu wrote: > On Wed, Dec 16, 2020 at 3:16 AM Nick Clifton via Binutils > wrote: >> >> Hi Howard, >> >>>> Why not just make the new plugin disable itself if the host tool >>>> doesn't provide the all_symbols_read entry point? >>> >>> Yeah, that'd be fine too. Just noop/silently exit if entry points are missing. >>> I can write that up if folks agree it's better. >> >> Please do. >> >> It turns out that my proposed fix breaks the LTO plugin, so it is a no-go. :-( >> > > I am going to check this in if there are no objections today. > diff --git a/ld/libdep_plugin.c b/ld/libdep_plugin.c index 2a7fdc4d0b..37ad7c7f97 100644 --- a/ld/libdep_plugin.c +++ b/ld/libdep_plugin.c @@ -346,20 +346,10 @@ onload (struct ld_plugin_tv *tv) return LDPS_ERR; } (*tv_register_claim_file) (onclaim_file); - if (!tv_register_all_symbols_read) - { - TV_MESSAGE (LDPL_FATAL, "No register_all_symbols_read hook"); - fflush (NULL); - return LDPS_ERR; - } - (*tv_register_all_symbols_read) (onall_symbols_read); - if (!tv_register_cleanup) - { - TV_MESSAGE (LDPL_FATAL, "No register_cleanup hook"); - fflush (NULL); - return LDPS_ERR; - } - (*tv_register_cleanup) (oncleanup); + if (tv_register_all_symbols_read) + (*tv_register_all_symbols_read) (onall_symbols_read); + if (tv_register_cleanup) + (*tv_register_cleanup) (oncleanup); fflush (NULL); return LDPS_OK; } The plugin shouldn't register any hooks at all, if any of these aren't available. There's no point in doing the register_claim_file, that will just be wasted work. -- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/