[lld] r241720 - COFF: Remove dead code.
Rui Ueyama
ruiu at google.com
Wed Jul 8 13:35:30 PDT 2015
Author: ruiu
Date: Wed Jul 8 15:35:29 2015
New Revision: 241720
URL: http://llvm.org/viewvc/llvm-project?rev=241720&view=rev
Log:
COFF: Remove dead code.
r241647 made Driver to infer machine type, so this code is not actually in use.
Modified:
lld/trunk/COFF/Writer.cpp
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=241720&r1=241719&r2=241720&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Wed Jul 8 15:35:29 2015
@@ -375,17 +375,6 @@ void Writer::assignAddresses() {
RoundUpToAlignment(FileOff - SizeOfHeaders, FileAlignment);
}
-static MachineTypes
-inferMachineType(const std::vector<ObjectFile *> &Files) {
- for (ObjectFile *F : Files) {
- // Try to infer machine type from the magic byte of the object file.
- auto MT = static_cast<MachineTypes>(F->getCOFFObj()->getMachine());
- if (MT != IMAGE_FILE_MACHINE_UNKNOWN)
- return MT;
- }
- return IMAGE_FILE_MACHINE_UNKNOWN;
-}
-
template <typename PEHeaderTy> void Writer::writeHeader() {
// Write DOS stub
uint8_t *Buf = Buffer->getBufferStart();
@@ -400,15 +389,10 @@ template <typename PEHeaderTy> void Writ
memcpy(Buf, PEMagic, sizeof(PEMagic));
Buf += sizeof(PEMagic);
- // Determine machine type, infer if needed. TODO: diagnose conflicts.
- MachineTypes MachineType = Config->MachineType;
- if (MachineType == IMAGE_FILE_MACHINE_UNKNOWN)
- MachineType = inferMachineType(Symtab->ObjectFiles);
-
// Write COFF header
auto *COFF = reinterpret_cast<coff_file_header *>(Buf);
Buf += sizeof(*COFF);
- COFF->Machine = MachineType;
+ COFF->Machine = Config->MachineType;
COFF->NumberOfSections = OutputSections.size();
COFF->Characteristics = IMAGE_FILE_EXECUTABLE_IMAGE;
if (Is64)
More information about the llvm-commits
mailing list