<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 1, 2016 at 7:41 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Fri, Apr 1, 2016 at 6:39 PM, Sean Silva via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: silvas<br>
Date: Fri Apr 1 20:39:56 2016<br>
New Revision: 265206<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=265206&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=265206&view=rev</a><br>
Log:<br>
PR27104: Add -mllvm option<br>
<br>
The argv[0] is based on the analogous thing in clang.<br>
<br>
Modified:<br>
lld/trunk/ELF/Config.h<br>
lld/trunk/ELF/Driver.cpp<br>
lld/trunk/ELF/LTO.cpp<br>
lld/trunk/ELF/Options.td<br>
lld/trunk/test/ELF/lto/ltopasses-basic.ll<br>
<br>
Modified: lld/trunk/ELF/Config.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=265206&r1=265205&r2=265206&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=265206&r1=265205&r2=265206&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Config.h (original)<br>
+++ lld/trunk/ELF/Config.h Fri Apr 1 20:39:56 2016<br>
@@ -91,6 +91,7 @@ struct Configuration {<br>
uint16_t EMachine = llvm::ELF::EM_NONE;<br>
uint64_t EntryAddr = -1;<br>
unsigned LtoO;<br>
+ std::vector<const char *> MLlvm = {"lld (LLVM option parsing)"};<br>
unsigned Optimize;<br>
};<br>
<br>
<br>
Modified: lld/trunk/ELF/Driver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=265206&r1=265205&r2=265206&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=265206&r1=265205&r2=265206&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Driver.cpp (original)<br>
+++ lld/trunk/ELF/Driver.cpp Fri Apr 1 20:39:56 2016<br>
@@ -308,6 +308,9 @@ void LinkerDriver::readConfigs(opt::Inpu<br>
<br>
for (auto *Arg : Args.filtered(OPT_undefined))<br>
Config->Undefined.push_back(Arg->getValue());<br>
+<br>
+ for (auto *Arg : Args.filtered(OPT_mllvm))<br>
+ Config->MLlvm.push_back(Arg->getValue());<br></blockquote><div><br></div></div></div><div>Do you need to store -mllvm options to Config? It seems that you can directly call cl::ParseCommandLineOptions here without storing it to Config.</div></div></div></div></blockquote><div><br></div><div>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.</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
}<br>
<br>
void LinkerDriver::createFiles(opt::InputArgList &Args) {<br>
<br>
Modified: lld/trunk/ELF/LTO.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=265206&r1=265205&r2=265206&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=265206&r1=265205&r2=265206&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/LTO.cpp (original)<br>
+++ lld/trunk/ELF/LTO.cpp Fri Apr 1 20:39:56 2016<br>
@@ -143,6 +143,8 @@ std::unique_ptr<InputFile> BitcodeCompil<br>
internalize(*GV);<br>
}<br>
<br>
+ cl::ParseCommandLineOptions(Config->MLlvm.size(), Config->MLlvm.data());<br>
+<br>
if (Config->SaveTemps)<br>
saveBCFile(Combined, ".lto.bc");<br>
<br>
<br>
Modified: lld/trunk/ELF/Options.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=265206&r1=265205&r2=265206&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=265206&r1=265205&r2=265206&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Options.td (original)<br>
+++ lld/trunk/ELF/Options.td Fri Apr 1 20:39:56 2016<br>
@@ -215,5 +215,6 @@ def G : Separate<["-"], "G">;<br>
// Aliases for ignored options<br>
def alias_version_script_version_script : Joined<["--"], "version-script=">, Alias<version_script>;<br>
<br>
-// Debugging options<br>
+// Debugging/developer options<br>
def save_temps : Flag<["-"], "save-temps">;<br>
+def mllvm : Separate<["-"], "mllvm">;<br>
<br>
Modified: lld/trunk/test/ELF/lto/ltopasses-basic.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/ltopasses-basic.ll?rev=265206&r1=265205&r2=265206&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/ltopasses-basic.ll?rev=265206&r1=265205&r2=265206&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/ELF/lto/ltopasses-basic.ll (original)<br>
+++ lld/trunk/test/ELF/lto/ltopasses-basic.ll Fri Apr 1 20:39:56 2016<br>
@@ -1,7 +1,7 @@<br>
; REQUIRES: x86<br>
; RUN: rm -f %t.so.lto.bc %t.so.lto.opt.bc %t.so.lto.o<br>
; RUN: llvm-as %s -o %t.o<br>
-; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps -shared<br>
+; 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<br>
; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s<br>
<br>
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<br>
@@ -14,3 +14,5 @@ define void @ctor() {<br>
<br>
; `@ctor` doesn't do anything and so the optimizer should kill it, leaving no ctors<br>
; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer<br>
+<br>
+; MLLVM: Pass Arguments:<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>