summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/include/lld/ReaderWriter/PECOFFLinkingContext.h12
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp2
-rw-r--r--lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp4
-rw-r--r--lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp2
-rw-r--r--lld/unittests/DriverTests/WinLinkDriverTest.cpp4
5 files changed, 14 insertions, 10 deletions
diff --git a/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h b/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
index cf8328d8016..f43766f01fb 100644
--- a/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
+++ b/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
@@ -34,7 +34,7 @@ public:
PECOFFLinkingContext()
: _baseAddress(0x400000), _stackReserve(1024 * 1024), _stackCommit(4096),
_heapReserve(1024 * 1024), _heapCommit(4096), _noDefaultLibAll(false),
- _sectionAlignment(4096),
+ _sectionDefaultAlignment(4096),
_subsystem(llvm::COFF::IMAGE_SUBSYSTEM_UNKNOWN),
_machineType(llvm::COFF::IMAGE_FILE_MACHINE_I386), _imageVersion(0, 0),
_minOSVersion(6, 0), _nxCompat(true), _largeAddressAware(false),
@@ -116,8 +116,12 @@ public:
uint64_t getHeapReserve() const { return _heapReserve; }
uint64_t getHeapCommit() const { return _heapCommit; }
- void setSectionAlignment(uint32_t val) { _sectionAlignment = val; }
- uint32_t getSectionAlignment() const { return _sectionAlignment; }
+ void setSectionDefaultAlignment(uint32_t val) {
+ _sectionDefaultAlignment = val;
+ }
+ uint32_t getSectionDefaultAlignment() const {
+ return _sectionDefaultAlignment;
+ }
void setSubsystem(WindowsSubsystem ss) { _subsystem = ss; }
WindowsSubsystem getSubsystem() const { return _subsystem; }
@@ -256,7 +260,7 @@ private:
uint64_t _heapReserve;
uint64_t _heapCommit;
bool _noDefaultLibAll;
- uint32_t _sectionAlignment;
+ uint32_t _sectionDefaultAlignment;
WindowsSubsystem _subsystem;
MachineTypes _machineType;
Version _imageVersion;
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index 0175fb4a146..4bdd7d7be2e 100644
--- a/lld/lib/Driver/WinLinkDriver.cpp
+++ b/lld/lib/Driver/WinLinkDriver.cpp
@@ -651,7 +651,7 @@ WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ctx,
diagnostics << "error: invalid value for /align: " << arg << "\n";
return false;
}
- ctx.setSectionAlignment(align);
+ ctx.setSectionDefaultAlignment(align);
break;
}
diff --git a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
index 0a51b776b5b..f8a6cd694af 100644
--- a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
@@ -53,10 +53,10 @@ bool PECOFFLinkingContext::validateImpl(raw_ostream &diagnostics) {
return false;
}
- std::bitset<64> alignment(_sectionAlignment);
+ std::bitset<64> alignment(_sectionDefaultAlignment);
if (alignment.count() != 1) {
diagnostics << "Section alignment must be a power of 2, but got "
- << _sectionAlignment << "\n";
+ << _sectionDefaultAlignment << "\n";
return false;
}
diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
index 66260d36c90..1edf6ccee81 100644
--- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
@@ -174,7 +174,7 @@ public:
// Sections should be page-aligned when loaded into memory, which is 4KB on
// x86.
- _peHeader.SectionAlignment = context.getSectionAlignment();
+ _peHeader.SectionAlignment = context.getSectionDefaultAlignment();
// Sections in an executable file on disk should be sector-aligned (512 byte).
_peHeader.FileAlignment = SECTOR_SIZE;
diff --git a/lld/unittests/DriverTests/WinLinkDriverTest.cpp b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
index 36b8e83cfc6..394dadeaa42 100644
--- a/lld/unittests/DriverTests/WinLinkDriverTest.cpp
+++ b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
@@ -50,7 +50,7 @@ TEST_F(WinLinkParserTest, Basic) {
EXPECT_EQ(0x400000U, _context.getBaseAddress());
EXPECT_EQ(1024 * 1024U, _context.getStackReserve());
EXPECT_EQ(4096U, _context.getStackCommit());
- EXPECT_EQ(4096U, _context.getSectionAlignment());
+ EXPECT_EQ(4096U, _context.getSectionDefaultAlignment());
EXPECT_FALSE(_context.allowRemainingUndefines());
EXPECT_TRUE(_context.isNxCompat());
EXPECT_FALSE(_context.getLargeAddressAware());
@@ -218,7 +218,7 @@ TEST_F(WinLinkParserTest, InvalidHeapSize) {
TEST_F(WinLinkParserTest, SectionAlignment) {
EXPECT_TRUE(parse("link.exe", "/align:8192", "a.obj", nullptr));
- EXPECT_EQ(8192U, _context.getSectionAlignment());
+ EXPECT_EQ(8192U, _context.getSectionDefaultAlignment());
}
TEST_F(WinLinkParserTest, Section) {
OpenPOWER on IntegriCloud