[lld] r248831 - ELF2: Use 'a.out' as default output file name.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 14:49:40 PDT 2015


Author: ruiu
Date: Tue Sep 29 16:49:40 2015
New Revision: 248831

URL: http://llvm.org/viewvc/llvm-project?rev=248831&view=rev
Log:
ELF2: Use 'a.out' as default output file name.

Modified:
    lld/trunk/ELF/Config.h
    lld/trunk/ELF/Driver.cpp
    lld/trunk/test/elf2/basic.s

Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=248831&r1=248830&r2=248831&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Tue Sep 29 16:49:40 2015
@@ -18,7 +18,7 @@ namespace lld {
 namespace elf2 {
 
 struct Configuration {
-  llvm::StringRef OutputFile;
+  llvm::StringRef OutputFile = "a.out";
   llvm::StringRef DynamicLinker;
   std::string RPath;
   std::vector<llvm::StringRef> InputSearchPaths;

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=248831&r1=248830&r2=248831&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Sep 29 16:49:40 2015
@@ -99,13 +99,9 @@ void LinkerDriver::link(ArrayRef<const c
   // Parse command line options.
   opt::InputArgList Args = Parser.parse(ArgsArr);
 
-  // Handle -o
   if (auto *Arg = Args.getLastArg(OPT_output))
     Config->OutputFile = Arg->getValue();
-  if (Config->OutputFile.empty())
-    error("-o must be specified.");
 
-  // Handle -dynamic-linker
   if (auto *Arg = Args.getLastArg(OPT_dynamic_linker))
     Config->DynamicLinker = Arg->getValue();
 

Modified: lld/trunk/test/elf2/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic.s?rev=248831&r1=248830&r2=248831&view=diff
==============================================================================
--- lld/trunk/test/elf2/basic.s (original)
+++ lld/trunk/test/elf2/basic.s Tue Sep 29 16:49:40 2015
@@ -1,8 +1,14 @@
+# REQUIRES: x86
+
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 # RUN: lld -flavor gnu2 %t -o %t2
 # RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \
 # RUN:   | FileCheck %s
-# REQUIRES: x86
+
+# RUN: mkdir -p %t.dir
+# RUN: (cd %t.dir && lld -flavor gnu2 %t)
+# RUN: llvm-readobj -file-headers -sections -program-headers -symbols \
+# RUN:   %t.dir/a.out | FileCheck %s
 
 # exits with return code 42 on linux
 .globl _start;
@@ -181,9 +187,6 @@ _start:
 # RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \
 # RUN:   | FileCheck %s
 
-# RUN: not lld -flavor gnu2 %t 2>&1 | FileCheck --check-prefix=NO_O %s
-# NO_O: -o must be specified.
-
 # RUN: not lld -flavor gnu2 %t.foo -o %t2 2>&1 | \
 # RUN:  FileCheck --check-prefix=MISSING %s
 # MISSING: cannot open {{.*}}.foo: {{[Nn]}}o such file or directory




More information about the llvm-commits mailing list