[PATCH] [ELF] Support --defsym option to define an absolute symbol.

Rui Ueyama ruiu at google.com
Fri Mar 28 09:57:15 PDT 2014


On Fri, Mar 28, 2014 at 9:53 AM, Rui Ueyama <ruiu at google.com> wrote:

> On Fri, Mar 28, 2014 at 9:42 AM, Shankar Kalpathi Easwaran <
> shankarke at gmail.com> wrote:
>
>>
>>   Ok, I agree about that its more complex to have the complete --defsym
>> option.
>>
>>   Once the above comment is fixed, this patch LGTM.
>>
>>
>> ================
>> Comment at: lib/Core/LinkingContext.cpp:59-61
>> @@ -58,5 +58,5 @@
>>
>> -std::unique_ptr<File> LinkingContext::createUndefinedSymbolFile() const {
>> -  return createUndefinedSymbolFile("command line option -u");
>> +std::unique_ptr<File> LinkingContext::createCommandLineFile() const {
>> +  return createCommandLineFile("<command line option -u or --defsym>");
>>  }
>>
>> ----------------
>> Can we use a separate string for -u and --defsym. We could have a
>> createCommandLineFile with a StringRef like how PECOFF does, so that we can
>> support more command line defined by various options.
>
>
> It's actually pretty odd that we have a piece of code in LinkingContext
> that creates what seems ELF-specific thing ("<command line option -u or
> --defsym>"). Need to be refactored. Anyways I'll create a separate file for
> --defsym.
>

It turned out that it's not that easy -- each *Flavor*LinkingContext is
expected to create at most one file for its internal use. If it doesn't
need one, createCommandLIneFile return a nullptr, or a file instance
otherwise. That's working well, so we should keep it. Let's go with a
single file here.


>> http://llvm-reviews.chandlerc.com/D3208
>>
>> BRANCH
>>   defsym
>>
>> ARCANIST PROJECT
>>   lld
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140328/f6dd050b/attachment.html>


More information about the llvm-commits mailing list