[PATCH,take 2,trunk+2.21.1] Re: Fix link order problem with LD plugin API.
Dave Korn
dave.korn.cygwin@gmail.com
Thu Feb 3 05:44:00 GMT 2011
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
More information about the Binutils
mailing list