From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 1622F3844046 for ; Tue, 15 Dec 2020 16:50:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1622F3844046 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-242-Hsl4xlAsN4SdLkW4eU3TnQ-1; Tue, 15 Dec 2020 11:50:40 -0500 X-MC-Unique: Hsl4xlAsN4SdLkW4eU3TnQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1700CE647; Tue, 15 Dec 2020 16:50:39 +0000 (UTC) Received: from [10.36.116.255] (ovpn-116-255.ams2.redhat.com [10.36.116.255]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C70E5D9D7; Tue, 15 Dec 2020 16:50:38 +0000 (UTC) Subject: Re: [PATCH] dependency list for static libraries To: Jeff Law , Jim Wilson Cc: Binutils References: <53b8973b-40a4-2550-3307-66d7f13707d5@symas.com> <9889c54b-4dd3-2275-6621-c2391cfd268d@redhat.com> <31f9062e-175d-06e9-695a-797c7ee11420@symas.com> <58620dc1-3bb9-aaae-b476-ebb613ecb627@redhat.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> From: Nick Clifton Organization: Red Hat Message-ID: <3bfc2ea0-d49d-a194-18e0-57c007fd3746@redhat.com> Date: Tue, 15 Dec 2020 16:50:37 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="------------7083C0F1FF599B47AC6EB092" Content-Language: en-GB X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP 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: Tue, 15 Dec 2020 16:50:44 -0000 This is a multi-part message in MIME format. --------------7083C0F1FF599B47AC6EB092 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Jim, Hi Jeff, Would one or both of you mind trying out the attached patch ? I think that it should work, although I am not sure if it ought to be extended so that the all_symbols_read and cleanup plugin functions are actually called. Cheers Nick --------------7083C0F1FF599B47AC6EB092 Content-Type: text/x-patch; charset=UTF-8; name="plugin.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="plugin.patch" diff --git a/bfd/plugin.c b/bfd/plugin.c index bed98520da..3a52554141 100644 --- a/bfd/plugin.c +++ b/bfd/plugin.c @@ -127,10 +127,10 @@ message (int level ATTRIBUTE_UNUSED, struct plugin_list_entry { /* These must be initialized for each IR object with LTO wrapper. */ - ld_plugin_claim_file_handler claim_file; - ld_plugin_all_symbols_read_handler all_symbols_read; - ld_plugin_all_symbols_read_handler cleanup_handler; - bfd_boolean has_symbol_type; + ld_plugin_claim_file_handler claim_file; + ld_plugin_all_symbols_read_handler all_symbols_read_handler; + ld_plugin_cleanup_handler cleanup_handler; + bfd_boolean has_symbol_type; struct plugin_list_entry *next; @@ -158,6 +158,23 @@ register_claim_file (ld_plugin_claim_file_handler handler) return LDPS_OK; } +static enum ld_plugin_status +register_all_symbols_read (ld_plugin_all_symbols_read_handler handler) +{ + BFD_ASSERT (current_plugin != NULL); + current_plugin->all_symbols_read_handler = handler; + return LDPS_OK; +} + +/* Register a cleanup handler. */ +static enum ld_plugin_status +register_cleanup (ld_plugin_cleanup_handler handler) +{ + BFD_ASSERT (current_plugin != NULL); + current_plugin->cleanup_handler = handler; + return LDPS_OK; +} + static enum ld_plugin_status add_symbols (void * handle, int nsyms, @@ -256,7 +273,7 @@ try_load_plugin (const char * pname, bfd_boolean build_list_p) { void *plugin_handle; - struct ld_plugin_tv tv[5]; + struct ld_plugin_tv tv[7]; int i; ld_plugin_onload onload; enum ld_plugin_status status; @@ -329,6 +346,14 @@ try_load_plugin (const char * pname, tv[i].tv_tag = LDPT_ADD_SYMBOLS_V2; tv[i].tv_u.tv_add_symbols = add_symbols_v2; + ++i; + tv[i].tv_tag = LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK; + tv[i].tv_u.tv_register_all_symbols_read = register_all_symbols_read; + + ++i; + tv[i].tv_tag = LDPT_REGISTER_CLEANUP_HOOK; + tv[i].tv_u.tv_register_cleanup = register_cleanup; + ++i; tv[i].tv_tag = LDPT_NULL; tv[i].tv_u.tv_val = 0; --------------7083C0F1FF599B47AC6EB092--