[lld][MachO] Fix LC_SEGEMENT[_64] filesize computation in -r mode.
authorLang Hames <lhames@gmail.com>
Wed, 10 Aug 2016 22:15:09 +0000 (22:15 +0000)
committerLang Hames <lhames@gmail.com>
Wed, 10 Aug 2016 22:15:09 +0000 (22:15 +0000)
commit8c2406b1fc10051d9c8d00cbb84d394b66e7d52c
treec75e439ff3d951e4e2ccd65283bbf2438b34be7e
parent2ff5935a955f611a8288d76a8e3ec771fc7da51c
[lld][MachO] Fix LC_SEGEMENT[_64] filesize computation in -r mode.

Using vmsize to populate this file works when outputing MachO images, but fails
when outputting relocatable objects. This patch fixes the computation to use
file offsets, which works for both output types.

Fixes <rdar://problem/27727666>

llvm-svn: 278297
lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
lld/test/mach-o/lc_segment_filesize.yaml [new file with mode: 0644]