[PATCH] D18517: [ELF, PR27091] - Implemented -t/--trace option
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 29 01:50:59 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL264708: [ELF, PR27091] - Implemented -t/--trace option (authored by grimar).
Changed prior to commit:
http://reviews.llvm.org/D18517?vs=51807&id=51879#toc
Repository:
rL LLVM
http://reviews.llvm.org/D18517
Files:
lld/trunk/ELF/Config.h
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Options.td
lld/trunk/test/ELF/trace.s
Index: lld/trunk/ELF/Driver.cpp
===================================================================
--- lld/trunk/ELF/Driver.cpp
+++ lld/trunk/ELF/Driver.cpp
@@ -90,7 +90,8 @@
// Newly created memory buffers are owned by this driver.
void LinkerDriver::addFile(StringRef Path) {
using namespace llvm::sys::fs;
- log(Path);
+ if (Config->Verbose || Config->Trace)
+ llvm::outs() << Path << "\n";
auto MBOrErr = MemoryBuffer::getFile(Path);
if (!MBOrErr) {
error(MBOrErr, "cannot open " + Path);
@@ -250,6 +251,7 @@
Config->Shared = Args.hasArg(OPT_shared);
Config->StripAll = Args.hasArg(OPT_strip_all);
Config->Threads = Args.hasArg(OPT_threads);
+ Config->Trace = Args.hasArg(OPT_trace);
Config->Verbose = Args.hasArg(OPT_verbose);
Config->WarnCommon = Args.hasArg(OPT_warn_common);
Index: lld/trunk/ELF/Options.td
===================================================================
--- lld/trunk/ELF/Options.td
+++ lld/trunk/ELF/Options.td
@@ -126,6 +126,9 @@
def threads : Joined<["--"], "threads">;
+def trace: Flag<["--"], "trace">,
+ HelpText<"Print the names of the input files">;
+
def undefined : Joined<["--"], "undefined=">,
HelpText<"Force undefined symbol during linking">;
@@ -169,6 +172,7 @@
def alias_soname_h : JoinedOrSeparate<["-"], "h">, Alias<soname>;
def alias_soname_soname : Separate<["-"], "soname">, Alias<soname>;
def alias_script_T : JoinedOrSeparate<["-"], "T">, Alias<script>;
+def alias_trace : Flag<["-"], "t">, Alias<trace>;
def alias_strip_all: Flag<["-"], "s">, Alias<strip_all>;
def alias_undefined_u : JoinedOrSeparate<["-"], "u">, Alias<undefined>;
def alias_wrap_wrap : Joined<["--", "-"], "wrap=">, Alias<wrap>;
Index: lld/trunk/ELF/Config.h
===================================================================
--- lld/trunk/ELF/Config.h
+++ lld/trunk/ELF/Config.h
@@ -79,6 +79,7 @@
bool StripAll;
bool SysvHash = true;
bool Threads;
+ bool Trace;
bool Verbose;
bool WarnCommon;
bool ZExecStack;
Index: lld/trunk/test/ELF/trace.s
===================================================================
--- lld/trunk/test/ELF/trace.s
+++ lld/trunk/test/ELF/trace.s
@@ -0,0 +1,20 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.foo.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.bar.o
+
+## Check -t
+# RUN: ld.lld -shared %t.foo.o -o %t.so -t 2>&1 | FileCheck %s
+# CHECK: {{.*}}.foo.o
+
+## Check --trace alias
+# RUN: ld.lld -shared %t.foo.o -o %t.so -t 2>&1 | FileCheck %s
+
+## Check output messages order (1)
+# RUN: ld.lld -shared %t.foo.o %t1.bar.o -o %t.so -t 2>&1 | FileCheck -check-prefix=ORDER1 %s
+# ORDER1: {{.*}}.foo.o
+# ORDER1: {{.*}}.bar.o
+
+## Check output messages order (2)
+# RUN: ld.lld -shared %t1.bar.o %t.foo.o -o %t.so -t 2>&1 | FileCheck -check-prefix=ORDER2 %s
+# ORDER2: {{.*}}.bar.o
+# ORDER2: {{.*}}.foo.o
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18517.51879.patch
Type: text/x-patch
Size: 2912 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160329/895f0e6e/attachment.bin>
More information about the llvm-commits
mailing list