diff options
author | Rui Ueyama <ruiu@google.com> | 2015-03-26 00:10:50 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2015-03-26 00:10:50 +0000 |
commit | d2c1bf638b035c9cc496fbb5aba287a7b7d0c3e4 (patch) | |
tree | b384df6cc5b26ed4fcf2aa6ecc30d59ca5d52a2f /lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp | |
parent | 1c1407395f5bd6845b6879c5540e2804cc4f5a0a (diff) | |
download | bcm5719-llvm-d2c1bf638b035c9cc496fbb5aba287a7b7d0c3e4.tar.gz bcm5719-llvm-d2c1bf638b035c9cc496fbb5aba287a7b7d0c3e4.zip |
Add a scaffolding to merge alignment representations.
We are using log2 values and values themselves to represent alignments.
For example, alignment 8 is sometimes represented as 3 (8 == 2^3).
We want to stop using log2 values.
Because both types are regular arithmetic types, we cannot get help from
a compiler to find places we mix two representations. That makes this
merging work surprisingly hard because if I make a mistake, I'll just get
wrong results at runtime (Yay types!). In this patch, I introduced
a class to represents power-of-two values, which is basically an alias
for an integer type.
Once the migration is done, the class will be removed.
llvm-svn: 233232
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp')
-rw-r--r-- | lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp index 92385cf3e82..1ae5be41fc4 100644 --- a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp +++ b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp @@ -731,7 +731,7 @@ ArchHandler &MachOLinkingContext::archHandler() const { void MachOLinkingContext::addSectionAlignment(StringRef seg, StringRef sect, - uint8_t align2) { + PowerOf2 align2) { SectionAlign entry; entry.segmentName = seg; entry.sectionName = sect; @@ -740,7 +740,7 @@ void MachOLinkingContext::addSectionAlignment(StringRef seg, StringRef sect, } bool MachOLinkingContext::sectionAligned(StringRef seg, StringRef sect, - uint8_t &align2) const { + PowerOf2 &align2) const { for (const SectionAlign &entry : _sectAligns) { if (seg.equals(entry.segmentName) && sect.equals(entry.sectionName)) { align2 = entry.align2; |