[PATCH] D13262: ELF2: Use 'a.out' as default output file name.

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


ruiu updated this revision to Diff 36018.
ruiu added a comment.

Ignore the first patch -- that was wrong. This is the correct one.


http://reviews.llvm.org/D13262

Files:
  ELF/Config.h
  ELF/Driver.cpp
  test/elf2/basic.s

Index: test/elf2/basic.s
===================================================================
--- test/elf2/basic.s
+++ test/elf2/basic.s
@@ -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 @@
 # 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
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -99,13 +99,9 @@
   // 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();
 
Index: ELF/Config.h
===================================================================
--- ELF/Config.h
+++ ELF/Config.h
@@ -18,7 +18,7 @@
 namespace elf2 {
 
 struct Configuration {
-  llvm::StringRef OutputFile;
+  llvm::StringRef OutputFile = "a.out";
   llvm::StringRef DynamicLinker;
   std::string RPath;
   std::vector<llvm::StringRef> InputSearchPaths;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13262.36018.patch
Type: text/x-patch
Size: 1936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150929/a2b5e625/attachment.bin>


More information about the llvm-commits mailing list