[lld] r265206 - PR27104: Add -mllvm option
Sean Silva via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 1 21:14:52 PDT 2016
On Fri, Apr 1, 2016 at 7:41 PM, Rui Ueyama <ruiu at google.com> wrote:
> On Fri, Apr 1, 2016 at 6:39 PM, Sean Silva via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: silvas
>> Date: Fri Apr 1 20:39:56 2016
>> New Revision: 265206
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=265206&view=rev
>> Log:
>> PR27104: Add -mllvm option
>>
>> The argv[0] is based on the analogous thing in clang.
>>
>> Modified:
>> lld/trunk/ELF/Config.h
>> lld/trunk/ELF/Driver.cpp
>> lld/trunk/ELF/LTO.cpp
>> lld/trunk/ELF/Options.td
>> lld/trunk/test/ELF/lto/ltopasses-basic.ll
>>
>> Modified: lld/trunk/ELF/Config.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=265206&r1=265205&r2=265206&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/Config.h (original)
>> +++ lld/trunk/ELF/Config.h Fri Apr 1 20:39:56 2016
>> @@ -91,6 +91,7 @@ struct Configuration {
>> uint16_t EMachine = llvm::ELF::EM_NONE;
>> uint64_t EntryAddr = -1;
>> unsigned LtoO;
>> + std::vector<const char *> MLlvm = {"lld (LLVM option parsing)"};
>> unsigned Optimize;
>> };
>>
>>
>> Modified: lld/trunk/ELF/Driver.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=265206&r1=265205&r2=265206&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/Driver.cpp (original)
>> +++ lld/trunk/ELF/Driver.cpp Fri Apr 1 20:39:56 2016
>> @@ -308,6 +308,9 @@ void LinkerDriver::readConfigs(opt::Inpu
>>
>> for (auto *Arg : Args.filtered(OPT_undefined))
>> Config->Undefined.push_back(Arg->getValue());
>> +
>> + for (auto *Arg : Args.filtered(OPT_mllvm))
>> + Config->MLlvm.push_back(Arg->getValue());
>>
>
> Do you need to store -mllvm options to Config? It seems that you can
> directly call cl::ParseCommandLineOptions here without storing it to Config.
>
Good idea. r265213. I think I was trying to avoid calling
cl::ParseCommandLineOptions if we weren't doing LTO or something, but just
doing it unconditionally is simpler.
-- Sean Silva
>
>
>> }
>>
>> void LinkerDriver::createFiles(opt::InputArgList &Args) {
>>
>> Modified: lld/trunk/ELF/LTO.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=265206&r1=265205&r2=265206&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/LTO.cpp (original)
>> +++ lld/trunk/ELF/LTO.cpp Fri Apr 1 20:39:56 2016
>> @@ -143,6 +143,8 @@ std::unique_ptr<InputFile> BitcodeCompil
>> internalize(*GV);
>> }
>>
>> + cl::ParseCommandLineOptions(Config->MLlvm.size(),
>> Config->MLlvm.data());
>> +
>> if (Config->SaveTemps)
>> saveBCFile(Combined, ".lto.bc");
>>
>>
>> Modified: lld/trunk/ELF/Options.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=265206&r1=265205&r2=265206&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/Options.td (original)
>> +++ lld/trunk/ELF/Options.td Fri Apr 1 20:39:56 2016
>> @@ -215,5 +215,6 @@ def G : Separate<["-"], "G">;
>> // Aliases for ignored options
>> def alias_version_script_version_script : Joined<["--"],
>> "version-script=">, Alias<version_script>;
>>
>> -// Debugging options
>> +// Debugging/developer options
>> def save_temps : Flag<["-"], "save-temps">;
>> +def mllvm : Separate<["-"], "mllvm">;
>>
>> Modified: lld/trunk/test/ELF/lto/ltopasses-basic.ll
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/ltopasses-basic.ll?rev=265206&r1=265205&r2=265206&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/test/ELF/lto/ltopasses-basic.ll (original)
>> +++ lld/trunk/test/ELF/lto/ltopasses-basic.ll Fri Apr 1 20:39:56 2016
>> @@ -1,7 +1,7 @@
>> ; REQUIRES: x86
>> ; RUN: rm -f %t.so.lto.bc %t.so.lto.opt.bc %t.so.lto.o
>> ; RUN: llvm-as %s -o %t.o
>> -; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps -shared
>> +; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps -mllvm
>> -debug-pass=Arguments -shared 2>&1 | FileCheck %s --check-prefix=MLLVM
>> ; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s
>>
>> target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
>> @@ -14,3 +14,5 @@ define void @ctor() {
>>
>> ; `@ctor` doesn't do anything and so the optimizer should kill it,
>> leaving no ctors
>> ; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8*
>> }] zeroinitializer
>> +
>> +; MLLVM: Pass Arguments:
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160401/6a451340/attachment.html>
More information about the llvm-commits
mailing list