diff options
author | Rui Ueyama <ruiu@google.com> | 2019-01-22 18:44:04 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2019-01-22 18:44:04 +0000 |
commit | 476c47495259e709b3ce0380e54c7e3b2031790c (patch) | |
tree | f144d213b38b126926bef387519628a0ab150e05 | |
parent | e3a5e2f228b45f46331d35b2706e2efdfcedd89a (diff) |
FileOutputBuffer: Handle "-" as stdout.
I was honestly a bit surprised that we didn't do this before. This
patch is to handle "-" as the stdout so that if you pass `-o -` to
lld, for example, it writes an output to stdout instead of file `-`.
I thought that we might want to handle this at a higher level than
FileOutputBuffer, because if we land this patch, we can no longer
create a file whose name is `-` (there's a workaround though; you can
pass `./-` instead of `-`). However, because raw_fd_ostream already
handles `-` as a special file name, I think it's okay and actually
consistent to handle `-` as a special name in FileOutputBuffer.
Differential Revision: https://reviews.llvm.org/D56940
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@351852 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/ELF/stdout.s | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ELF/stdout.s b/test/ELF/stdout.s new file mode 100644 index 000000000..331167e3f --- /dev/null +++ b/test/ELF/stdout.s @@ -0,0 +1,12 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: ld.lld %t.o -o - > %t +# RUN: llvm-objdump -d %t | FileCheck %s + +# CHECK: 0000000000201000 _start: +# CHECK: 201000: 90 nop + +.globl _start +_start: + nop |