[PATCH] [lld] add InputGraph to process Command line arguments

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Jul 25 10:00:10 PDT 2013


On 25 July 2013 12:43, Shankar Easwaran <shankare at codeaurora.org> wrote:
> Hi Rafael,
>
> The current implementation / design handles like how you mentioned but
> Inputs need to know to what group do they belong for how to process them.
> The InputElement as part of each control node, has a parent associated with
> it.
>
> In the below example :-
>
> lld main.o --start-group libc.a libma --as-needed libpthread.so
> --no-as-needed --end-group -o a.out
>
> libc.a libm.a are part of a group and that information would be needed when
> you process the group.

We need to represent a group. The group has to have a list of
libraries in it (or, as an optimization, it can have the actual
members of those libraries). When selecting which members of a group
(i.e., the individual .o files) are to be added to the link, we should
have the group at hand, so I don't think we even need a member or an
archive to link to the group.

In summary, I think we can use an api like

addObjectFIleToLink(...) // add a .o to the link unconditionally.
addArchiveToLink() //Walk the archive members and add those that
satisfy a currently undefined symbol
addBeginEndLibToLink() // Similar, but add a set of files from a
--begin-lib/--end-lib
addGroupToLink()// The difference in here is that this function
iterates over the archive members until no member is added to the
link.

> May be the name needs to be changed ... I am open for suggestions.
>
> Thanks
>
> Shankar Easwaran
>

Cheers,
Rafael



More information about the llvm-commits mailing list