ELF: Fix a bug in -l.
authorRui Ueyama <ruiu@google.com>
Fri, 30 Jan 2015 21:03:19 +0000 (21:03 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 30 Jan 2015 21:03:19 +0000 (21:03 +0000)
If a linker script is given with -l, LLD failed to read the file.
The bug was introduced in 227341.

llvm-svn: 227610

lld/lib/Driver/GnuLdDriver.cpp
lld/test/elf/group-cmd-search.test

index d023624..bca453a 100644 (file)
@@ -623,7 +623,7 @@ bool GnuLdDriver::parse(int argc, const char *argv[],
         if (ctx->logInputFiles())
           diag << path << "\n";
         ErrorOr<std::unique_ptr<MemoryBuffer>> mb =
-          MemoryBuffer::getFileOrSTDIN(path);
+          MemoryBuffer::getFileOrSTDIN(realpath);
         if (std::error_code ec = mb.getError()) {
           diag << "Cannot open " << path << ": " << ec.message() << "\n";
           return false;
index 2f5c0f4..5e153c1 100644 (file)
@@ -124,4 +124,11 @@ RUN: lld -flavor gnu -target x86_64 -shared --sysroot=%p/Inputs \
 RUN:     -L%p/Inputs %p/Inputs/use-shared.x86-64 \
 RUN:     %s -o %t7
 */
+
+/*
+RUN: lld -flavor gnu -target x86_64 -shared \
+RUN:     -L%p/Inputs %p/Inputs/use-shared.x86-64 \
+RUN:     -l:group-cmd-search-1.ls -o %t9
+*/
+
 GROUP ( /shared.so-x86-64 )