diff options
author | Nick Kledzik <kledzik@apple.com> | 2014-10-24 22:19:22 +0000 |
---|---|---|
committer | Nick Kledzik <kledzik@apple.com> | 2014-10-24 22:19:22 +0000 |
commit | 761d6549bc5a5e4223b3f27e3345b7cc1f0dea98 (patch) | |
tree | 44104163b2abc5988536e50778fe32c94337aa46 /lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp | |
parent | 7c2896a234e765c49f885d7689079a97b1651e32 (diff) | |
download | bcm5719-llvm-761d6549bc5a5e4223b3f27e3345b7cc1f0dea98.tar.gz bcm5719-llvm-761d6549bc5a5e4223b3f27e3345b7cc1f0dea98.zip |
[mach-o] Support data-only dylibs
In final linked shared images, the __TEXT segment contains both code and
the mach-o header/load-commands. In the case of a data-only dylib, there is
no code, so we need to force the addition of the __TEXT segment.
llvm-svn: 220597
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp')
-rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp index 208ef0b7db3..275060d57ee 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp @@ -500,6 +500,9 @@ void MachOFileLayout::buildFileOffsets() { << ", fileOffset=" << _segInfo[&sg].fileOffset << "\n"); uint32_t segFileSize = 0; + // A segment that is not zero-fill must use a least one page of disk space. + if (sg.access) + segFileSize = _file.pageSize; for (const Section *s : _segInfo[&sg].sections) { uint32_t sectOffset = s->address - sg.address; uint32_t sectFileSize = |