[PATCH,take 2,trunk+2.21.1] Re: Fix link order problem with LD plugin API.
Alan Modra
amodra@gmail.com
Thu Feb 3 05:12:00 GMT 2011
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;
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list