[llvm-commits] [lld] Support reading archive libraries
Nick Kledzik
kledzik at apple.com
Fri Nov 2 12:03:21 PDT 2012
On Nov 2, 2012, at 11:55 AM, Shankar Easwaran wrote:
> Hi Nick,
>>> The ReaderArchiveOptions gets constructed using the command line flags thats passed to lld, along with the Reader. For the ReaderArchiveOptions to be created within ReaderELF,
>>> the command line options (or) the appropriate flags that were read from the command line would be needed.
>>>
>>> Currently all the Readers(createReader*) take in ReaderOptionsELF only.
>>
>>
>> You just defined class ReaderOptionsArchive with one constructor:
>>
>> ReaderOptionsArchive(Reader *reader, int argc, char *argv[]);
>>
>> but it never uses the command line args. Why not add another constructor:
>
> I was going and planning to add a command line flag -whole-archive(similiar to the ld option) and construct the ReaderArchiveOptions based on that information.
Except that that option name is different on different platforms (It is -force_load on Darwin). The Options objects really should not be taking arc/argv. They should have a set of fields to set (e.g. _isForceLoad) and some other command line parser knows how to set those fields.
>
> I will change ReaderELF so that it takes ReaderArchiveOptions along with ReaderELFOptions.
That is a better way! Have each reader that wants to support archives take a ReaderArchiveOptions argument.
>>
>> ReaderOptionsArchive(Reader *reader);
>>
>> Other readers can use that constructor until the command line option handling is worked out.
>
> Ok, will add that interface.
>
> When the command line options need to be handled, wouldnt this have a problem ?
We want to have a programatic interface as the base (so non-command line tools can use lld as a library). On top of that we have a command line processor for each platform which takes a default ReaderOptionsArchive and default ReaderOptionsELF, then tweaks them based on the command line arguments.
-Nick
More information about the llvm-commits
mailing list