[lld] r241819 - COFF: Remove Writer::Is64 and use Config::is64 instead. NFC.
Rui Ueyama
ruiu at google.com
Thu Jul 9 09:40:39 PDT 2015
Author: ruiu
Date: Thu Jul 9 11:40:39 2015
New Revision: 241819
URL: http://llvm.org/viewvc/llvm-project?rev=241819&view=rev
Log:
COFF: Remove Writer::Is64 and use Config::is64 instead. NFC.
Modified:
lld/trunk/COFF/Writer.cpp
lld/trunk/COFF/Writer.h
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=241819&r1=241818&r2=241819&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Thu Jul 9 11:40:39 2015
@@ -53,7 +53,7 @@ std::error_code Writer::write(StringRef
createSymbolAndStringTable();
if (auto EC = openFile(OutputPath))
return EC;
- if (Is64) {
+ if (Config->is64()) {
writeHeader<pe32plus_header>();
} else {
writeHeader<pe32_header>();
@@ -111,9 +111,6 @@ void OutputSection::writeHeaderTo(uint8_
}
}
-Writer::Writer(SymbolTable *T)
- : Symtab(T), Is64(Config->MachineType == IMAGE_FILE_MACHINE_AMD64) {}
-
// Set live bit on for each reachable chunk. Unmarked (unreachable)
// COMDAT chunks will be ignored in the next step, so that they don't
// come to the final output file.
@@ -358,7 +355,8 @@ void Writer::assignAddresses() {
SizeOfHeaders = DOSStubSize + sizeof(PEMagic) + sizeof(coff_file_header) +
sizeof(data_directory) * NumberfOfDataDirectory +
sizeof(coff_section) * OutputSections.size();
- SizeOfHeaders += Is64 ? sizeof(pe32plus_header) : sizeof(pe32_header);
+ SizeOfHeaders +=
+ Config->is64() ? sizeof(pe32plus_header) : sizeof(pe32_header);
SizeOfHeaders = RoundUpToAlignment(SizeOfHeaders, PageSize);
uint64_t RVA = 0x1000; // The first page is kept unmapped.
uint64_t FileOff = SizeOfHeaders;
@@ -395,7 +393,7 @@ template <typename PEHeaderTy> void Writ
COFF->Machine = Config->MachineType;
COFF->NumberOfSections = OutputSections.size();
COFF->Characteristics = IMAGE_FILE_EXECUTABLE_IMAGE;
- if (Is64) {
+ if (Config->is64()) {
COFF->Characteristics |= IMAGE_FILE_LARGE_ADDRESS_AWARE;
} else {
COFF->Characteristics |= IMAGE_FILE_32BIT_MACHINE;
@@ -410,7 +408,7 @@ template <typename PEHeaderTy> void Writ
// Write PE header
auto *PE = reinterpret_cast<PEHeaderTy *>(Buf);
Buf += sizeof(*PE);
- PE->Magic = Is64 ? PE32Header::PE32_PLUS : PE32Header::PE32;
+ PE->Magic = Config->is64() ? PE32Header::PE32_PLUS : PE32Header::PE32;
PE->ImageBase = Config->ImageBase;
PE->SectionAlignment = SectionAlignment;
PE->FileAlignment = FileAlignment;
Modified: lld/trunk/COFF/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.h?rev=241819&r1=241818&r2=241819&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.h (original)
+++ lld/trunk/COFF/Writer.h Thu Jul 9 11:40:39 2015
@@ -74,7 +74,7 @@ private:
// The writer writes a SymbolTable result to a file.
class Writer {
public:
- explicit Writer(SymbolTable *T);
+ explicit Writer(SymbolTable *T) : Symtab(T) {}
std::error_code write(StringRef Path);
private:
More information about the llvm-commits
mailing list