This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH,take 2,trunk+2.21.1] Re: Fix link order problem with LD plugin API.
- From: Dave Korn <dave dot korn dot cygwin at gmail dot com>
- To: Dave Korn <dave dot korn dot cygwin at gmail dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 03 Feb 2011 06:10:26 +0000
- Subject: Re: [PATCH,take 2,trunk+2.21.1] Re: Fix link order problem with LD plugin API.
- References: <4D437207.4040903@gmail.com> <AANLkTino6tHjPdxZAaixhPfJKEX-mLeH8KaA5GkmDRFn@mail.gmail.com> <AANLkTik6PH6WTFq_yRy1ceLwOu0u+t_LuRv4wyCCwgsk@mail.gmail.com> <AANLkTimqcPcy0QBBVB5o-wADx_kkzoKDmMFB0hS-bUaK@mail.gmail.com> <4D439979.1010302@gmail.com> <AANLkTimW9tZSSdgaVGfRBTwtvNHjH5wXZKicodc4KXs9@mail.gmail.com> <4D461D1F.8020800@gmail.com> <20110203051145.GV9489@bubble.grove.modra.org>
On 03/02/2011 05:11, Alan Modra wrote:
> On Mon, Jan 31, 2011 at 02:23:27AM +0000, Dave Korn wrote:
>> * ldlang.h (lang_input_statement_type): Add new 'claim_archive' flag.
>> * ldmain.c (add_archive_element): Set it if the member is claimed.
>> * ldlang.c (new_afile): Initialise claim_archive and claimed members.
>> (find_replacements_insert_point): New helper function.
>> (lang_process): After adding and opening replacement files passed
>> from plugin, splice them into correct place in statement list and
>> file chains to preserve critical link order.
>> (lang_list_insert_after): New helper function.
>> (lang_list_remove_tail): Likewise.
>
> OK.
>
>> + /* Are we adding at the very end of the list? */
>> + if (*field == NULL)
>> + {
>> + /* (*field == NULL) should imply (destlist->tail == field),
>> + if not then the element isn't really in the DESTLIST. */
>> + ASSERT (destlist->tail == field);
>> + /* Yes, append to and update tail pointer. */
>> + *(destlist->tail) = srclist->head;
>> + destlist->tail = srclist->tail;
>> + }
>> + else
>> + {
>> + /* We're inserting in the middle somewhere. */
>> + *(srclist->tail) = *field;
>> + *field = srclist->head;
>> + }
>
> Maybe this instead?
>
> *(srclist->tail) = *field;
> *field = srclist->head;
> if (destlist->tail == field)
> destlist->tail = srclist->tail;
Seems like a good plan. I notice that I omitted #ifdef ENABLE_PLUGINS
guards around those new functions, which, being static, will cause unused
warnings. Respin shortly, along with a series of other patches (in
particular, something to get rid of those stray left-over symbols when the IR
symtabs in the input files mention something that ltrans subsequently decides
it can optimise away.)
cheers,
DaveK