[COFF] Refactor section alignment calculation

Section alignment isn't completely trivial, let it live in one place so
that we may reuse it in LLVM.

llvm-svn: 263722
This commit is contained in:
David Majnemer
2016-03-17 16:55:18 +00:00
parent 62fed0c354
commit 511391feaa
2 changed files with 18 additions and 3 deletions

View File

@@ -290,7 +290,7 @@ std::error_code COFFObjectFile::getSectionContents(DataRefImpl Ref,
uint64_t COFFObjectFile::getSectionAlignment(DataRefImpl Ref) const {
const coff_section *Sec = toSec(Ref);
return uint64_t(1) << (((Sec->Characteristics & 0x00F00000) >> 20) - 1);
return Sec->getAlignment();
}
bool COFFObjectFile::isSectionText(DataRefImpl Ref) const {