Index: COFF/Driver.h =================================================================== --- COFF/Driver.h +++ COFF/Driver.h @@ -36,12 +36,6 @@ using llvm::COFF::WindowsSubsystem; using llvm::Optional; -// Implemented in MarkLive.cpp. -void markLive(ArrayRef Chunks); - -// Implemented in ICF.cpp. -void doICF(ArrayRef Chunks); - class COFFOptTable : public llvm::opt::OptTable { public: COFFOptTable(); Index: COFF/Driver.cpp =================================================================== --- COFF/Driver.cpp +++ COFF/Driver.cpp @@ -9,7 +9,9 @@ #include "Driver.h" #include "Config.h" +#include "ICF.h" #include "InputFiles.h" +#include "MarkLive.h" #include "MinGW.h" #include "SymbolTable.h" #include "Symbols.h" @@ -37,8 +39,8 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/ToolDrivers/llvm-lib/LibDriver.h" #include -#include #include +#include using namespace llvm; using namespace llvm::object; Index: COFF/ICF.h =================================================================== --- COFF/ICF.h +++ COFF/ICF.h @@ -7,13 +7,20 @@ // //===----------------------------------------------------------------------===// -#ifndef LLD_ELF_ICF_H -#define LLD_ELF_ICF_H +#ifndef LLD_COFF_ICF_H +#define LLD_COFF_ICF_H + +#include "lld/Common/LLVM.h" +#include "llvm/ADT/ArrayRef.h" namespace lld { -namespace elf { -template void doIcf(); -} +namespace coff { + +class Chunk; + +void doICF(ArrayRef Chunks); + +} // namespace coff } // namespace lld #endif Index: COFF/ICF.cpp =================================================================== --- COFF/ICF.cpp +++ COFF/ICF.cpp @@ -18,6 +18,7 @@ // //===----------------------------------------------------------------------===// +#include "ICF.h" #include "Chunks.h" #include "Symbols.h" #include "lld/Common/ErrorHandler.h" Index: COFF/MarkLive.h =================================================================== --- /dev/null +++ COFF/MarkLive.h @@ -0,0 +1,24 @@ +//===- MarkLive.h -----------------------------------------------*- C++ -*-===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLD_COFF_MARKLIVE_H +#define LLD_COFF_MARKLIVE_H + +#include "lld/Common/LLVM.h" +#include "llvm/ADT/ArrayRef.h" + +namespace lld { +namespace coff { + +void markLive(ArrayRef Chunks); + +} // namespace coff +} // namespace lld + +#endif // LLD_COFF_MARKLIVE_H Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -30,6 +30,7 @@ #include "InputFiles.h" #include "InputSection.h" #include "LinkerScript.h" +#include "MarkLive.h" #include "OutputSections.h" #include "ScriptParser.h" #include "Strings.h" Index: ELF/ICF.h =================================================================== --- ELF/ICF.h +++ ELF/ICF.h @@ -12,8 +12,10 @@ namespace lld { namespace elf { + template void doIcf(); -} + +} // namespace elf } // namespace lld #endif Index: ELF/MarkLive.h =================================================================== --- ELF/MarkLive.h +++ ELF/MarkLive.h @@ -1,4 +1,4 @@ -//===- ICF.h --------------------------------------------------------------===// +//===- MarkLive.h -----------------------------------------------*- C++ -*-===// // // The LLVM Linker // @@ -7,13 +7,15 @@ // //===----------------------------------------------------------------------===// -#ifndef LLD_ELF_ICF_H -#define LLD_ELF_ICF_H +#ifndef LLD_ELF_MARKLIVE_H +#define LLD_ELF_MARKLIVE_H namespace lld { namespace elf { -template void doIcf(); -} + +template void markLive(); + +} // namespace elf } // namespace lld -#endif +#endif // LLD_ELF_MARKLIVE_H Index: ELF/MarkLive.cpp =================================================================== --- ELF/MarkLive.cpp +++ ELF/MarkLive.cpp @@ -20,6 +20,7 @@ // //===----------------------------------------------------------------------===// +#include "MarkLive.h" #include "InputSection.h" #include "LinkerScript.h" #include "OutputSections.h" @@ -27,7 +28,6 @@ #include "SymbolTable.h" #include "Symbols.h" #include "Target.h" -#include "Writer.h" #include "lld/Common/Memory.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Object/ELF.h" Index: ELF/Strings.cpp =================================================================== --- ELF/Strings.cpp +++ ELF/Strings.cpp @@ -10,8 +10,6 @@ #include "Strings.h" #include "Config.h" #include "lld/Common/ErrorHandler.h" -#include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/Demangle/Demangle.h" #include Index: ELF/Writer.h =================================================================== --- ELF/Writer.h +++ ELF/Writer.h @@ -23,7 +23,6 @@ template class ObjFile; class SymbolTable; template void writeResult(); -template void markLive(); // This describes a program header entry. // Each contains type, access flags and range of output sections that will be