summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2015-10-29 16:50:26 +0000
committerLang Hames <lhames@gmail.com>2015-10-29 16:50:26 +0000
commit2ed3bf9527b59d2f0bf535a8572484f9ccd688f6 (patch)
tree8384e8879fb4b80205a1abeb5f9888605f96f1ab /lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
parentd122fd8d063117a39b583c18205b9210033fd744 (diff)
downloadbcm5719-llvm-2ed3bf9527b59d2f0bf535a8572484f9ccd688f6.tar.gz
bcm5719-llvm-2ed3bf9527b59d2f0bf535a8572484f9ccd688f6.zip
[lld][MachO] Make sure LC_RPATH command size is a multiple of the pointer size.
llvm-svn: 251637
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
index bbf62de6102..d1577556e1e 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
@@ -429,7 +429,7 @@ uint32_t MachOFileLayout::loadCommandsSize(uint32_t &count) {
// Add LC_RPATH
for (const StringRef &path : _file.rpaths) {
- size += sizeof(rpath_command) + pointerAlign(path.size()+1);
+ size += pointerAlign(sizeof(rpath_command) + path.size() + 1);
++count;
}
@@ -855,7 +855,7 @@ std::error_code MachOFileLayout::writeLoadCommands() {
// Add LC_RPATH
for (const StringRef &path : _file.rpaths) {
rpath_command *rpc = reinterpret_cast<rpath_command *>(lc);
- uint32_t size = sizeof(rpath_command) + pointerAlign(path.size()+1);
+ uint32_t size = pointerAlign(sizeof(rpath_command) + path.size() + 1);
rpc->cmd = LC_RPATH;
rpc->cmdsize = size;
rpc->path = sizeof(rpath_command); // offset
OpenPOWER on IntegriCloud