From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28179 invoked by alias); 7 Feb 2015 12:50:31 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 28170 invoked by uid 89); 7 Feb 2015 12:50:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f175.google.com Received: from mail-ob0-f175.google.com (HELO mail-ob0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 07 Feb 2015 12:50:29 +0000 Received: by mail-ob0-f175.google.com with SMTP id va2so18055296obc.6 for ; Sat, 07 Feb 2015 04:50:27 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.60.134.10 with SMTP id pg10mr5751632oeb.0.1423313427469; Sat, 07 Feb 2015 04:50:27 -0800 (PST) Received: by 10.76.134.102 with HTTP; Sat, 7 Feb 2015 04:50:27 -0800 (PST) In-Reply-To: <20150207094240.GD14796@bubble.grove.modra.org> References: <20150205135440.GA27203@gmail.com> <20150207094240.GD14796@bubble.grove.modra.org> Date: Sat, 07 Feb 2015 12:50:00 -0000 Message-ID: Subject: Re: [PATCH 1/8] PR ld/17878: Add bfd_maybe_object_p From: "H.J. Lu" To: Binutils Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-02/txt/msg00090.txt.bz2 On Sat, Feb 7, 2015 at 1:42 AM, Alan Modra wrote: > On Thu, Feb 05, 2015 at 05:54:40AM -0800, H.J. Lu wrote: >> This patch adds bfd_maybe_object_p which is similar to >> >> bfd_check_format (abfd, bfd_object) >> >> The difference is bfd_maybe_object_p takes an argument to indicate if a >> compiler plug-in library is applied. When a compiler plug-in library is >> active, it also returns TRUE if the file is not an archive or a coredump >> file. > > Hmm, in other words, if it is unknown. (bfd_format takes the values > bfd_unknown, bfd_object, bfd_archive, bfd_core.) Yes. >> +bfd_boolean >> +bfd_maybe_object_p (bfd *abfd, bfd_boolean plugin_active_p) >> +{ >> + /* LTO IR object file may look like a bfd_object file or a file which >> + is not bfd_core nor bfd_archive. */ >> + return (bfd_check_format (abfd, bfd_object) >> + || (plugin_active_p >> + && !bfd_check_format (abfd, bfd_core) >> + && !bfd_check_format (abfd, bfd_archive))); >> +} > > I find this really strange. If plugins are active then you're > willing to accept anything except cores and archives. To throw out > cores and archives you'll be iterating over all compiled-in bfd > targets, asking "is this a core file", then asking "is this an > archive". That's quite a bit of processing, and won't exclude your > average text file! LTO IR could be stored in the average text file. The new plug tests use this feature. We can add a new type, bfd_maybe_object. > I think you need to find a way of answering the question "is this a > file accepted by a plugin?" in a more robust way. One possibility is > merging the linker handling of plugins into the bfd plugin support. > I have considered it before. This approach has many implications. If we do this, we need to add bfd_plugin_object and bfd_all_object. bfd_all_object includes bfd_object and bfd_plugin_object. We need bfd_plugin_object so that we won't update dummy BFD info from the LTO IR input. Let me take another look. -- H.J.