From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22700 invoked by alias); 26 Feb 2011 00:46:02 -0000 Received: (qmail 22688 invoked by uid 22791); 26 Feb 2011 00:46:02 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-wy0-f169.google.com (HELO mail-wy0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 26 Feb 2011 00:45:57 +0000 Received: by mail-wy0-f169.google.com with SMTP id 11so2568837wyi.0 for ; Fri, 25 Feb 2011 16:45:56 -0800 (PST) Received: by 10.227.134.144 with SMTP id j16mr2681872wbt.70.1298681156559; Fri, 25 Feb 2011 16:45:56 -0800 (PST) Received: from [192.168.2.99] (cpc2-cmbg8-0-0-cust61.5-4.cable.virginmedia.com [82.6.108.62]) by mx.google.com with ESMTPS id y29sm1025304wbd.16.2011.02.25.16.45.54 (version=SSLv3 cipher=OTHER); Fri, 25 Feb 2011 16:45:55 -0800 (PST) Message-ID: <4D684D30.805@gmail.com> Date: Sat, 26 Feb 2011 00:46:00 -0000 From: Dave Korn User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: "binutils@sourceware.org" Subject: [2/6][PATCH] Do not use dummy bfd suffix for recognition, make it human-readable instead. References: <4D684CB8.6020106@gmail.com> <4D684D00.70803@gmail.com> In-Reply-To: <4D684D00.70803@gmail.com> Content-Type: multipart/mixed; boundary="------------010402030302090103040704" 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 X-SW-Source: 2011-02/txt/msg00330.txt.bz2 This is a multi-part message in MIME format. --------------010402030302090103040704 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 486 Hi list, Removes the ugly name suffix from the dummy IR BFDs as previously discussed. ld/ChangeLog: 2011-02-20 Dave Korn <... * plugin.c (IRONLY_SUFFIX): Revise to nicely human-readable form. (IRONLY_SUFFIX_LEN): Delete. (plugin_get_ir_dummy_bfd): Don't append IRONLY_SUFFIX. (is_ir_dummy_bfd): Don't look for suffix; check claimed flag of enclosing lang input statement instead. Think this one is straightforward and uncontroversial now. cheers, DaveK --------------010402030302090103040704 Content-Type: text/x-c; name="002ld-plugin-api-no-ironly-suffix.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="002ld-plugin-api-no-ironly-suffix.diff" Content-length: 2246 >From 5284753e8fae37a619fee7683f234cfdf2dbc05d Mon Sep 17 00:00:00 2001 From: Dave Korn Date: Sat, 19 Feb 2011 23:24:14 +0000 Subject: [PATCH] Do not use dummy bfd suffix for recognition, make it human-readable instead. ld/ChangeLog: 2011-02-20 Dave Korn <... * plugin.c (IRONLY_SUFFIX): Revise to nicely human-readable form. (IRONLY_SUFFIX_LEN): Delete. (plugin_get_ir_dummy_bfd): Don't append IRONLY_SUFFIX. (is_ir_dummy_bfd): Don't look for suffix; check claimed flag of enclosing lang input statement instead. --- ld/plugin.c | 24 ++++++++++-------------- 1 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ld/plugin.c b/ld/plugin.c index 6e3f923..c1672f6 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -38,12 +38,8 @@ /* The suffix to append to the name of the real (claimed) object file when generating a dummy BFD to hold the IR symbols sent from the - plugin. */ -#define IRONLY_SUFFIX ".ironly\004" - -/* This is sizeof an array of chars, not sizeof a const char *. We - also have to avoid inadvertently counting the trailing NUL. */ -#define IRONLY_SUFFIX_LEN (sizeof (IRONLY_SUFFIX) - 1) + plugin. For cosmetic use only; appears in maps, crefs etc. */ +#define IRONLY_SUFFIX " (symbol from plugin)" /* Stores a single argument passed to a plugin. */ typedef struct plugin_arg @@ -250,14 +246,14 @@ plugin_get_ir_dummy_bfd (const char *name, bfd *srctemplate) static bfd_boolean is_ir_dummy_bfd (const bfd *abfd) { - size_t namlen; - - if (abfd == NULL) - return FALSE; - namlen = strlen (abfd->filename); - if (namlen < IRONLY_SUFFIX_LEN) - return FALSE; - return !strcmp (abfd->filename + namlen - IRONLY_SUFFIX_LEN, IRONLY_SUFFIX); + /* ABFD can sometimes legitimately be NULL, e.g. when called from one + of the linker callbacks for a symbol in the *ABS* or *UND* sections. + Likewise, the usrdata field may be NULL if ABFD was added by the + backend without a corresponding input statement, as happens e.g. + when processing DT_NEEDED dependencies. */ + return abfd + && abfd->usrdata + && ((lang_input_statement_type *)(abfd->usrdata))->claimed; } /* Helpers to convert between BFD and GOLD symbol formats. */ --------------010402030302090103040704--