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: Alan Modra <amodra at gmail dot com>
- To: Dave Korn <dave dot korn dot cygwin at gmail dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 3 Feb 2011 15:41:45 +1030
- 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>
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