aboutsummaryrefslogtreecommitdiff
path: root/lld
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-07-09 16:40:39 +0000
committerRui Ueyama <ruiu@google.com>2015-07-09 16:40:39 +0000
commit1b53ec796aad49ab5eaa2f60b6270de578fcca6d (patch)
treebde4863f61d97998dce74059d7af020b8a2888ef /lld
parent3e3095c53a1c77e906580f04d0a4404706b0d93c (diff)
downloadllvm-1b53ec796aad49ab5eaa2f60b6270de578fcca6d.zip
llvm-1b53ec796aad49ab5eaa2f60b6270de578fcca6d.tar.gz
llvm-1b53ec796aad49ab5eaa2f60b6270de578fcca6d.tar.bz2
COFF: Remove Writer::Is64 and use Config::is64 instead. NFC.
llvm-svn: 241819
Diffstat (limited to 'lld')
-rw-r--r--lld/COFF/Writer.cpp12
-rw-r--r--lld/COFF/Writer.h2
2 files changed, 6 insertions, 8 deletions
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index d8be9b15..60e901a 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -53,7 +53,7 @@ std::error_code Writer::write(StringRef OutputPath) {
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_t *Buf) {
}
}
-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 Writer::writeHeader() {
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 Writer::writeHeader() {
// 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;
diff --git a/lld/COFF/Writer.h b/lld/COFF/Writer.h
index 1b9f409..fd91878 100644
--- a/lld/COFF/Writer.h
+++ b/lld/COFF/Writer.h
@@ -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: