[lld] r194160 - [PECOFF] Rename getSectionAlignment -> getSectionDefaultAlignment.

Rui Ueyama ruiu at google.com
Wed Nov 6 11:30:15 PST 2013


Author: ruiu
Date: Wed Nov  6 13:30:14 2013
New Revision: 194160

URL: http://llvm.org/viewvc/llvm-project?rev=194160&view=rev
Log:
[PECOFF] Rename getSectionAlignment -> getSectionDefaultAlignment.

These fields are for /align option. Section alignment can be set per-section
basis with /section option too. In order to avoid name conflicts, rename the
existing identifiers to become more specific. No functionality change.

Modified:
    lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
    lld/trunk/lib/Driver/WinLinkDriver.cpp
    lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
    lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
    lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp

Modified: lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h?rev=194160&r1=194159&r2=194160&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h Wed Nov  6 13:30:14 2013
@@ -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;

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=194160&r1=194159&r2=194160&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Wed Nov  6 13:30:14 2013
@@ -651,7 +651,7 @@ WinLinkDriver::parse(int argc, const cha
         diagnostics << "error: invalid value for /align: " << arg << "\n";
         return false;
       }
-      ctx.setSectionAlignment(align);
+      ctx.setSectionDefaultAlignment(align);
       break;
     }
 

Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=194160&r1=194159&r2=194160&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Wed Nov  6 13:30:14 2013
@@ -53,10 +53,10 @@ bool PECOFFLinkingContext::validateImpl(
     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;
   }
 

Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=194160&r1=194159&r2=194160&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Wed Nov  6 13:30:14 2013
@@ -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;

Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=194160&r1=194159&r2=194160&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Wed Nov  6 13:30:14 2013
@@ -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, InvalidHeapSiz
 
 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) {





More information about the llvm-commits mailing list