diff options
author | Rui Ueyama <ruiu@google.com> | 2015-03-26 01:12:32 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2015-03-26 01:12:32 +0000 |
commit | c3d18f512054d8268d1e1a2e5935167cd3db6480 (patch) | |
tree | bbba5c909b78c38fc03457bee4e2e3f749662115 /lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp | |
parent | 2c6e0597c68c8d51b9fced91803b329a13350e64 (diff) | |
download | bcm5719-llvm-c3d18f512054d8268d1e1a2e5935167cd3db6480.tar.gz bcm5719-llvm-c3d18f512054d8268d1e1a2e5935167cd3db6480.zip |
Remove implicit constructor and operator int from PowerOf2.
This patch is to make instantiation and conversion to an integer explicit,
so that we can mechanically replace all occurrences of the class with
integer in the next step.
Now get() returns an alignment value rather than its log2 value.
llvm-svn: 233242
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp')
-rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp index be7acf9d4d6..0f8bba49eaa 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp @@ -291,7 +291,7 @@ MachOFileLayout::MachOFileLayout(const NormalizedFile &file) uint64_t offset = _startOfSectionsContent; for (const Section § : file.sections) { if (sect.type != llvm::MachO::S_ZEROFILL) { - offset = llvm::RoundUpToAlignment(offset, 1 << sect.alignment); + offset = llvm::RoundUpToAlignment(offset, sect.alignment.get()); _sectInfo[§].fileOffset = offset; offset += sect.content.size(); } else { @@ -613,7 +613,7 @@ std::error_code MachOFileLayout::writeSingleSegmentLoadCommand(uint8_t *&lc) { sout->addr = sin.address; sout->size = sin.content.size(); sout->offset = _sectInfo[&sin].fileOffset; - sout->align = sin.alignment; + sout->align = llvm::Log2_32(sin.alignment.get()); sout->reloff = sin.relocations.empty() ? 0 : relOffset; sout->nreloc = sin.relocations.size(); sout->flags = sin.type | sin.attributes; @@ -661,7 +661,7 @@ std::error_code MachOFileLayout::writeSegmentLoadCommands(uint8_t *&lc) { sect->offset = 0; else sect->offset = section->address - seg.address + segInfo.fileOffset; - sect->align = section->alignment; + sect->align = llvm::Log2_32(section->alignment.get()); sect->reloff = 0; sect->nreloc = 0; sect->flags = section->type | section->attributes; @@ -1343,4 +1343,3 @@ std::error_code writeBinary(const NormalizedFile &file, StringRef path) { } // namespace normalized } // namespace mach_o } // namespace lld - |