Fix display of files processed by the linker.
authorShankar Easwaran <shankarke@gmail.com>
Sat, 18 Oct 2014 20:36:35 +0000 (20:36 +0000)
committerShankar Easwaran <shankarke@gmail.com>
Sat, 18 Oct 2014 20:36:35 +0000 (20:36 +0000)
This fixes the way archive members are displayed when the linker is used with a
flag to show all the files that it processes.

When an archive file member is read, we need to show the archive filename and
the member.

llvm-svn: 220144

lld/lib/ReaderWriter/FileArchive.cpp
lld/test/elf/loginputfiles.test [new file with mode: 0644]

index 2e34b1b..15c4cc6 100644 (file)
@@ -134,7 +134,9 @@ private:
       return ec;
     llvm::MemoryBufferRef mb = mbOrErr.get();
     if (_logLoading)
-      llvm::outs() << mb.getBufferIdentifier() << "\n";
+      llvm::outs() << _archive->getFileName() << "(" << mb.getBufferIdentifier()
+                   << ")"
+                   << "\n";
 
     std::unique_ptr<MemoryBuffer> buf(MemoryBuffer::getMemBuffer(
         mb.getBuffer(), mb.getBufferIdentifier(), false));
diff --git a/lld/test/elf/loginputfiles.test b/lld/test/elf/loginputfiles.test
new file mode 100644 (file)
index 0000000..850570d
--- /dev/null
@@ -0,0 +1,28 @@
+# Tests functionality of -t
+#
+# Tests generated using the source files below
+# main file
+# int main()
+# {
+#   fn();
+#   return 0;
+# }
+#
+# archive file
+# int fn()
+# {
+#   return 0;
+# }
+#
+# int fn1()
+# {
+#   return 0;
+# }
+# gcc -c main.c fn.c fn1.c
+
+RUN: lld -flavor gnu -target x86_64-linux \
+RUN:   %p/Inputs/mainobj.x86_64 %p/Inputs/libfnarchive.a -t --noinhibit-exec 2>&1 | \
+RUN:   FileCheck -check-prefix INPUTFILES %s
+
+#INPUTFILES: mainobj.x86_64
+#INPUTFILES: libfnarchive.a(fn.o)