Use the ability to pwrite to simplify the ELF writer.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 14 Apr 2015 22:54:16 +0000 (22:54 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 14 Apr 2015 22:54:16 +0000 (22:54 +0000)
commit83ed6b781470e7ef34c22d772422f5de92512be9
tree4e8696a9c91bd8ba71a3eaa93826ec6ce4310feb
parentc98092e28db7f3def249a1bf37483b264dd46194
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234952 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/ELFObjectWriter.cpp
lib/Support/raw_ostream.cpp