[lld] r233248 - Rename align2 -> align.
Rui Ueyama
ruiu at google.com
Wed Mar 25 19:23:45 PDT 2015
Author: ruiu
Date: Wed Mar 25 21:23:45 2015
New Revision: 233248
URL: http://llvm.org/viewvc/llvm-project?rev=233248&view=rev
Log:
Rename align2 -> align.
I believe "2" stands for log2. Just "align" would be appropriate now.
Modified:
lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h
lld/trunk/lib/Driver/DarwinLdDriver.cpp
lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
Modified: lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h?rev=233248&r1=233247&r2=233248&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h Wed Mar 25 21:23:45 2015
@@ -228,10 +228,10 @@ public:
const StringRefVector &rpaths() const { return _rpaths; }
/// Add section alignment constraint on final layout.
- void addSectionAlignment(StringRef seg, StringRef sect, uint16_t align2);
+ void addSectionAlignment(StringRef seg, StringRef sect, uint16_t align);
/// Returns true if specified section had alignment constraints.
- bool sectionAligned(StringRef seg, StringRef sect, uint16_t &align2) const;
+ bool sectionAligned(StringRef seg, StringRef sect, uint16_t &align) const;
StringRef dyldPath() const { return "/usr/lib/dyld"; }
@@ -312,7 +312,7 @@ private:
struct SectionAlign {
StringRef segmentName;
StringRef sectionName;
- uint16_t align2;
+ uint16_t align;
};
struct OrderFileNode {
Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=233248&r1=233247&r2=233248&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Wed Mar 25 21:23:45 2015
@@ -479,15 +479,15 @@ bool DarwinLdDriver::parse(int argc, con
<< alignStr << "' not a valid number\n";
return false;
}
- uint16_t align2 = 1 << llvm::countTrailingZeros(alignValue);
+ uint16_t align = 1 << llvm::countTrailingZeros(alignValue);
if (!llvm::isPowerOf2_64(alignValue)) {
diagnostics << "warning: alignment for '-sectalign "
<< segName << " " << sectName
<< llvm::format(" 0x%llX", alignValue)
<< "' is not a power of two, using "
- << llvm::format("0x%08X", align2) << "\n";
+ << llvm::format("0x%08X", align) << "\n";
}
- ctx.addSectionAlignment(segName, sectName, align2);
+ ctx.addSectionAlignment(segName, sectName, align);
}
// Handle -mllvm
Modified: lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp?rev=233248&r1=233247&r2=233248&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp Wed Mar 25 21:23:45 2015
@@ -731,16 +731,16 @@ ArchHandler &MachOLinkingContext::archHa
void MachOLinkingContext::addSectionAlignment(StringRef seg, StringRef sect,
- uint16_t align2) {
- SectionAlign entry = { seg, sect, align2 };
+ uint16_t align) {
+ SectionAlign entry = { seg, sect, align };
_sectAligns.push_back(entry);
}
bool MachOLinkingContext::sectionAligned(StringRef seg, StringRef sect,
- uint16_t &align2) const {
+ uint16_t &align) const {
for (const SectionAlign &entry : _sectAligns) {
if (seg.equals(entry.segmentName) && sect.equals(entry.sectionName)) {
- align2 = entry.align2;
+ align = entry.align;
return true;
}
}
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp?rev=233248&r1=233247&r2=233248&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp Wed Mar 25 21:23:45 2015
@@ -327,17 +327,17 @@ void Util::appendAtom(SectionInfo *sect,
// Figure out offset for atom in this section given alignment constraints.
uint64_t offset = sect->size;
DefinedAtom::Alignment atomAlign = atom->alignment();
- uint64_t align2 = atomAlign.value;
+ uint64_t align = atomAlign.value;
uint64_t requiredModulus = atomAlign.modulus;
- uint64_t currentModulus = (offset % align2);
+ uint64_t currentModulus = (offset % align);
if ( currentModulus != requiredModulus ) {
if ( requiredModulus > currentModulus )
offset += requiredModulus-currentModulus;
else
- offset += align2+requiredModulus-currentModulus;
+ offset += align+requiredModulus-currentModulus;
}
// Record max alignment of any atom in this section.
- if (align2 > sect->alignment)
+ if (align > sect->alignment)
sect->alignment = atomAlign.value;
// Assign atom to this section with this offset.
AtomInfo ai = {atom, offset};
More information about the llvm-commits
mailing list