diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-14 22:54:16 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-14 22:54:16 +0000 |
commit | 642a22165a466d553a9bc3b54af47c537fffa648 (patch) | |
tree | 7fc0dbc25a7b079f167a9106e5566a1efb30acdd /llvm/lib/Support/raw_ostream.cpp | |
parent | 50bd5a2dc6fbfba50bd5250ac28f223cf0becd1a (diff) | |
download | llvm-642a22165a466d553a9bc3b54af47c537fffa648.zip llvm-642a22165a466d553a9bc3b54af47c537fffa648.tar.gz llvm-642a22165a466d553a9bc3b54af47c537fffa648.tar.bz2 |
Use the ability to pwrite to simplify the ELF writer.
Now we don't have to do 2 synchronized passes to compute offsets and then
write the file.
This also includes a fix for the corner case of seeking in /dev/null. It
is not an error, but on some systems (Linux) the returned offset is
always 0. An error is signaled by returning -1. This is checked by
the existing tests now that "clang -o /dev/null ..." seeks.
llvm-svn: 234952
Diffstat (limited to 'llvm/lib/Support/raw_ostream.cpp')
-rw-r--r-- | llvm/lib/Support/raw_ostream.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index 044f8e0..6f9f910 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -625,7 +625,7 @@ void raw_fd_ostream::close() { uint64_t raw_fd_ostream::seek(uint64_t off) { flush(); pos = ::lseek(FD, off, SEEK_SET); - if (pos != off) + if (pos == (uint64_t)-1) error_detected(); return pos; } |