aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2022-12-09 09:44:01 +0000
committerGuillaume Chatelet <gchatelet@google.com>2022-12-09 09:45:04 +0000
commit3e5f54d6d710b1616a6467bfcd64c0d9e4f42af0 (patch)
treec4a2a3cb251ab75c8b3c1459cf50ed75fa645ef0 /llvm/lib/Object/MachOObjectFile.cpp
parent138942c833b3baa12d19216797efca6d4dd010d2 (diff)
downloadllvm-3e5f54d6d710b1616a6467bfcd64c0d9e4f42af0.zip
llvm-3e5f54d6d710b1616a6467bfcd64c0d9e4f42af0.tar.gz
llvm-3e5f54d6d710b1616a6467bfcd64c0d9e4f42af0.tar.bz2
Revert D139098 "[Alignment] Use Align for ObjectFile::getSectionAlignment"
This breaks lld. This reverts commit 10c47465e2505ddfee4e62a2ab2e535abea3ec56.
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 7f90284..39e84ff 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -1990,10 +1990,17 @@ MachOObjectFile::getSectionContents(DataRefImpl Sec) const {
return getSectionContents(Offset, Size);
}
-Align MachOObjectFile::getSectionAlignment(DataRefImpl Sec) const {
+uint64_t MachOObjectFile::getSectionAlignment(DataRefImpl Sec) const {
+ uint32_t Align;
+ if (is64Bit()) {
+ MachO::section_64 Sect = getSection64(Sec);
+ Align = Sect.align;
+ } else {
+ MachO::section Sect = getSection(Sec);
+ Align = Sect.align;
+ }
- return is64Bit() ? Align(1ULL << getSection64(Sec).align)
- : Align(1ULL << getSection(Sec).align);
+ return uint64_t(1) << Align;
}
Expected<SectionRef> MachOObjectFile::getSection(unsigned SectionIndex) const {