diff --git a/lld/ELF/AArch64ErrataFix.cpp b/lld/ELF/AArch64ErrataFix.cpp index d45edf9bd8ff..9c9bd41d6e6c 100644 --- a/lld/ELF/AArch64ErrataFix.cpp +++ b/lld/ELF/AArch64ErrataFix.cpp @@ -26,7 +26,6 @@ //===----------------------------------------------------------------------===// #include "AArch64ErrataFix.h" -#include "Config.h" #include "LinkerScript.h" #include "OutputSections.h" #include "Relocations.h" @@ -36,7 +35,6 @@ #include "lld/Common/CommonLinkerContext.h" #include "lld/Common/Strings.h" #include "llvm/Support/Endian.h" -#include "llvm/Support/raw_ostream.h" #include using namespace llvm; diff --git a/lld/ELF/ARMErrataFix.cpp b/lld/ELF/ARMErrataFix.cpp index 25b47b90cef8..7eb771a50902 100644 --- a/lld/ELF/ARMErrataFix.cpp +++ b/lld/ELF/ARMErrataFix.cpp @@ -14,8 +14,6 @@ //===----------------------------------------------------------------------===// #include "ARMErrataFix.h" - -#include "Config.h" #include "LinkerScript.h" #include "OutputSections.h" #include "Relocations.h" @@ -25,7 +23,6 @@ #include "lld/Common/CommonLinkerContext.h" #include "lld/Common/Strings.h" #include "llvm/Support/Endian.h" -#include "llvm/Support/raw_ostream.h" #include using namespace llvm; diff --git a/lld/ELF/ARMErrataFix.h b/lld/ELF/ARMErrataFix.h index a93609b35baf..e400cf96feb5 100644 --- a/lld/ELF/ARMErrataFix.h +++ b/lld/ELF/ARMErrataFix.h @@ -11,7 +11,6 @@ #include "lld/Common/LLVM.h" #include "llvm/ADT/DenseMap.h" -#include #include namespace lld { diff --git a/lld/ELF/Arch/AArch64.cpp b/lld/ELF/Arch/AArch64.cpp index 9e857d590684..3514e731e23b 100644 --- a/lld/ELF/Arch/AArch64.cpp +++ b/lld/ELF/Arch/AArch64.cpp @@ -9,9 +9,8 @@ #include "Symbols.h" #include "SyntheticSections.h" #include "Target.h" -#include "Thunks.h" #include "lld/Common/ErrorHandler.h" -#include "llvm/Object/ELF.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/Support/Endian.h" using namespace llvm; diff --git a/lld/ELF/Arch/AMDGPU.cpp b/lld/ELF/Arch/AMDGPU.cpp index cd7e7830d374..197ce8dd1a73 100644 --- a/lld/ELF/Arch/AMDGPU.cpp +++ b/lld/ELF/Arch/AMDGPU.cpp @@ -6,11 +6,10 @@ // //===----------------------------------------------------------------------===// -#include "InputFiles.h" #include "Symbols.h" #include "Target.h" #include "lld/Common/ErrorHandler.h" -#include "llvm/Object/ELF.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/Support/Endian.h" using namespace llvm; diff --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp index b7c2eb74757c..6e2932f10166 100644 --- a/lld/ELF/Arch/ARM.cpp +++ b/lld/ELF/Arch/ARM.cpp @@ -6,13 +6,11 @@ // //===----------------------------------------------------------------------===// -#include "InputFiles.h" #include "Symbols.h" #include "SyntheticSections.h" #include "Target.h" -#include "Thunks.h" #include "lld/Common/ErrorHandler.h" -#include "llvm/Object/ELF.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/Support/Endian.h" using namespace llvm; diff --git a/lld/ELF/Arch/AVR.cpp b/lld/ELF/Arch/AVR.cpp index a3051dad9e8b..2e59c605fced 100644 --- a/lld/ELF/Arch/AVR.cpp +++ b/lld/ELF/Arch/AVR.cpp @@ -25,11 +25,10 @@ // //===----------------------------------------------------------------------===// -#include "InputFiles.h" #include "Symbols.h" #include "Target.h" #include "lld/Common/ErrorHandler.h" -#include "llvm/Object/ELF.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/Support/Endian.h" using namespace llvm; diff --git a/lld/ELF/Arch/Hexagon.cpp b/lld/ELF/Arch/Hexagon.cpp index c33bd935f363..882bc75ed0a3 100644 --- a/lld/ELF/Arch/Hexagon.cpp +++ b/lld/ELF/Arch/Hexagon.cpp @@ -6,13 +6,11 @@ // //===----------------------------------------------------------------------===// -#include "InputFiles.h" #include "Symbols.h" #include "SyntheticSections.h" #include "Target.h" #include "lld/Common/ErrorHandler.h" #include "llvm/BinaryFormat/ELF.h" -#include "llvm/Object/ELF.h" #include "llvm/Support/Endian.h" using namespace llvm; diff --git a/lld/ELF/Arch/MSP430.cpp b/lld/ELF/Arch/MSP430.cpp index 4af90b40a346..378b2878d442 100644 --- a/lld/ELF/Arch/MSP430.cpp +++ b/lld/ELF/Arch/MSP430.cpp @@ -15,11 +15,10 @@ // //===----------------------------------------------------------------------===// -#include "InputFiles.h" #include "Symbols.h" #include "Target.h" #include "lld/Common/ErrorHandler.h" -#include "llvm/Object/ELF.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/Support/Endian.h" using namespace llvm; diff --git a/lld/ELF/Arch/Mips.cpp b/lld/ELF/Arch/Mips.cpp index 8ab076cdeb19..1d8256c5237d 100644 --- a/lld/ELF/Arch/Mips.cpp +++ b/lld/ELF/Arch/Mips.cpp @@ -6,14 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "InputFiles.h" #include "OutputSections.h" #include "Symbols.h" #include "SyntheticSections.h" #include "Target.h" -#include "Thunks.h" #include "lld/Common/ErrorHandler.h" -#include "llvm/Object/ELF.h" +#include "llvm/BinaryFormat/ELF.h" using namespace llvm; using namespace llvm::object; diff --git a/lld/ELF/Arch/MipsArchTree.cpp b/lld/ELF/Arch/MipsArchTree.cpp index 77c05a818a5d..9e5aade673c6 100644 --- a/lld/ELF/Arch/MipsArchTree.cpp +++ b/lld/ELF/Arch/MipsArchTree.cpp @@ -10,13 +10,11 @@ // //===---------------------------------------------------------------------===// -#include "InputFiles.h" #include "SymbolTable.h" #include "Writer.h" #include "lld/Common/ErrorHandler.h" #include "llvm/BinaryFormat/ELF.h" -#include "llvm/Object/ELF.h" #include "llvm/Support/MipsABIFlags.h" using namespace llvm; diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp index a0ea403e241d..9f710ab27bd6 100644 --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include "InputFiles.h" #include "Symbols.h" #include "SyntheticSections.h" #include "Target.h" diff --git a/lld/ELF/Arch/SPARCV9.cpp b/lld/ELF/Arch/SPARCV9.cpp index 1aebb57951cb..4ae742c6c4e9 100644 --- a/lld/ELF/Arch/SPARCV9.cpp +++ b/lld/ELF/Arch/SPARCV9.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include "InputFiles.h" #include "Symbols.h" #include "SyntheticSections.h" #include "Target.h" diff --git a/lld/ELF/Arch/X86.cpp b/lld/ELF/Arch/X86.cpp index e084bd646912..d4c2f9aa9489 100644 --- a/lld/ELF/Arch/X86.cpp +++ b/lld/ELF/Arch/X86.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include "InputFiles.h" #include "Symbols.h" #include "SyntheticSections.h" #include "Target.h" diff --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp index f1360f50f8ac..ebf0a479b62a 100644 --- a/lld/ELF/Arch/X86_64.cpp +++ b/lld/ELF/Arch/X86_64.cpp @@ -6,13 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "InputFiles.h" #include "OutputSections.h" #include "Symbols.h" #include "SyntheticSections.h" #include "Target.h" #include "lld/Common/ErrorHandler.h" -#include "llvm/Object/ELF.h" +#include "llvm/BinaryFormat/ELF.h" #include "llvm/Support/Endian.h" using namespace llvm; diff --git a/lld/ELF/CallGraphSort.cpp b/lld/ELF/CallGraphSort.cpp index 5b07f0e18c8a..ba2bc7889466 100644 --- a/lld/ELF/CallGraphSort.cpp +++ b/lld/ELF/CallGraphSort.cpp @@ -41,9 +41,9 @@ //===----------------------------------------------------------------------===// #include "CallGraphSort.h" -#include "OutputSections.h" -#include "SymbolTable.h" +#include "InputSection.h" #include "Symbols.h" +#include "llvm/Support/FileSystem.h" #include diff --git a/lld/ELF/DWARF.cpp b/lld/ELF/DWARF.cpp index 789820ba7a8e..7c21c0a7fe15 100644 --- a/lld/ELF/DWARF.cpp +++ b/lld/ELF/DWARF.cpp @@ -14,8 +14,8 @@ //===----------------------------------------------------------------------===// #include "DWARF.h" +#include "InputSection.h" #include "Symbols.h" -#include "Target.h" #include "lld/Common/Memory.h" #include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h" #include "llvm/Object/ELFObjectFile.h" diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index da2561d556b1..3a480fc444f6 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -52,6 +52,7 @@ #include "llvm/Remarks/HotnessThresholdParser.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compression.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/GlobPattern.h" #include "llvm/Support/LEB128.h" #include "llvm/Support/Parallel.h" diff --git a/lld/ELF/Driver.h b/lld/ELF/Driver.h index 510ca626c6d1..878b5d30a2b6 100644 --- a/lld/ELF/Driver.h +++ b/lld/ELF/Driver.h @@ -10,14 +10,10 @@ #define LLD_ELF_DRIVER_H #include "LTO.h" -#include "SymbolTable.h" #include "lld/Common/LLVM.h" -#include "lld/Common/Reproduce.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringRef.h" -#include "llvm/ADT/StringSet.h" #include "llvm/Option/ArgList.h" -#include "llvm/Support/raw_ostream.h" namespace lld { namespace elf { diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp index ac29b47abcc9..54e4f9374e61 100644 --- a/lld/ELF/DriverUtils.cpp +++ b/lld/ELF/DriverUtils.cpp @@ -12,19 +12,17 @@ // //===----------------------------------------------------------------------===// +#include "Config.h" #include "Driver.h" #include "lld/Common/CommonLinkerContext.h" #include "lld/Common/Reproduce.h" -#include "lld/Common/Version.h" #include "llvm/ADT/Optional.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Triple.h" #include "llvm/Option/Option.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Host.h" #include "llvm/Support/Path.h" -#include "llvm/Support/Process.h" #include "llvm/Support/TimeProfiler.h" using namespace llvm; diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp index ed19bde41323..4c2c0a76f01d 100644 --- a/lld/ELF/ICF.cpp +++ b/lld/ELF/ICF.cpp @@ -74,14 +74,11 @@ #include "ICF.h" #include "Config.h" -#include "EhFrame.h" #include "LinkerScript.h" #include "OutputSections.h" #include "SymbolTable.h" #include "Symbols.h" #include "SyntheticSections.h" -#include "Writer.h" -#include "llvm/ADT/StringExtras.h" #include "llvm/BinaryFormat/ELF.h" #include "llvm/Object/ELF.h" #include "llvm/Support/Parallel.h" diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 662ac3360bed..9f759e681790 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "InputFiles.h" +#include "DWARF.h" #include "Driver.h" #include "InputSection.h" #include "LinkerScript.h" @@ -16,16 +17,14 @@ #include "Target.h" #include "lld/Common/CommonLinkerContext.h" #include "lld/Common/DWARF.h" +#include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/CodeGen/Analysis.h" -#include "llvm/IR/LLVMContext.h" -#include "llvm/IR/Module.h" #include "llvm/LTO/LTO.h" -#include "llvm/MC/StringTableBuilder.h" -#include "llvm/Object/ELFObjectFile.h" +#include "llvm/Object/IRObjectFile.h" #include "llvm/Support/ARMAttributeParser.h" #include "llvm/Support/ARMBuildAttributes.h" #include "llvm/Support/Endian.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/RISCVAttributeParser.h" #include "llvm/Support/TarWriter.h" diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index 2bac30f54081..7634586205d7 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -13,15 +13,11 @@ #include "lld/Common/ErrorHandler.h" #include "lld/Common/LLVM.h" #include "lld/Common/Reproduce.h" -#include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/DenseSet.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/IR/Comdat.h" +#include "llvm/BinaryFormat/Magic.h" #include "llvm/Object/Archive.h" #include "llvm/Object/ELF.h" -#include "llvm/Object/IRObjectFile.h" #include "llvm/Support/Threading.h" -#include namespace llvm { struct DILineInfo; diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 4b047f75ad69..01a10a797d5e 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -8,25 +8,20 @@ #include "InputSection.h" #include "Config.h" -#include "EhFrame.h" #include "InputFiles.h" -#include "LinkerScript.h" #include "OutputSections.h" #include "Relocations.h" #include "SymbolTable.h" #include "Symbols.h" #include "SyntheticSections.h" #include "Target.h" -#include "Thunks.h" #include "lld/Common/CommonLinkerContext.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Compression.h" #include "llvm/Support/Endian.h" -#include "llvm/Support/Threading.h" #include "llvm/Support/xxhash.h" #include #include -#include #include using namespace llvm; diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index f060a6337cf7..e4fb354592a0 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -9,9 +9,7 @@ #ifndef LLD_ELF_INPUT_SECTION_H #define LLD_ELF_INPUT_SECTION_H -#include "Config.h" #include "Relocations.h" -#include "Thunks.h" #include "lld/Common/LLVM.h" #include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/DenseSet.h" @@ -21,13 +19,12 @@ namespace lld { namespace elf { +class InputFile; class Symbol; -struct SectionPiece; class Defined; struct Partition; class SyntheticSection; -class MergeSyntheticSection; template class ObjFile; class OutputSection; diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index d6e594e0dbee..78d1280e5f41 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -9,23 +9,19 @@ #include "LTO.h" #include "Config.h" #include "InputFiles.h" -#include "LinkerScript.h" #include "SymbolTable.h" #include "Symbols.h" #include "lld/Common/Args.h" #include "lld/Common/ErrorHandler.h" +#include "lld/Common/Strings.h" #include "lld/Common/TargetOptionsCommandFlags.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/BinaryFormat/ELF.h" -#include "llvm/Bitcode/BitcodeReader.h" #include "llvm/Bitcode/BitcodeWriter.h" -#include "llvm/IR/DiagnosticPrinter.h" #include "llvm/LTO/Config.h" #include "llvm/LTO/LTO.h" -#include "llvm/Object/SymbolicFile.h" #include "llvm/Support/Caching.h" #include "llvm/Support/CodeGen.h" #include "llvm/Support/Error.h" diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 56d94744fae5..402fa2f4ffbf 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -27,15 +27,11 @@ #include "llvm/Support/Casting.h" #include "llvm/Support/Endian.h" #include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/FileSystem.h" -#include "llvm/Support/Parallel.h" -#include "llvm/Support/Path.h" #include "llvm/Support/TimeProfiler.h" #include #include #include #include -#include #include #include #include diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h index 24c2c632f93b..7b45c469583b 100644 --- a/lld/ELF/LinkerScript.h +++ b/lld/ELF/LinkerScript.h @@ -15,15 +15,12 @@ #include "lld/Common/Strings.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/MapVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Support/MemoryBuffer.h" #include #include #include #include -#include namespace lld { namespace elf { @@ -34,7 +31,6 @@ class InputSection; class InputSectionBase; class OutputSection; class SectionBase; -class Symbol; class ThunkSection; // This represents an r-value in the linker script. diff --git a/lld/ELF/MapFile.cpp b/lld/ELF/MapFile.cpp index c7d8967358ad..a201ec5995a7 100644 --- a/lld/ELF/MapFile.cpp +++ b/lld/ELF/MapFile.cpp @@ -22,12 +22,12 @@ #include "InputFiles.h" #include "LinkerScript.h" #include "OutputSections.h" -#include "SymbolTable.h" #include "Symbols.h" #include "SyntheticSections.h" -#include "lld/Common/Strings.h" #include "llvm/ADT/MapVector.h" #include "llvm/ADT/SetVector.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Parallel.h" #include "llvm/Support/TimeProfiler.h" #include "llvm/Support/raw_ostream.h" diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp index 017507c1abd0..a55758b20f99 100644 --- a/lld/ELF/MarkLive.cpp +++ b/lld/ELF/MarkLive.cpp @@ -22,7 +22,6 @@ #include "MarkLive.h" #include "InputSection.h" #include "LinkerScript.h" -#include "OutputSections.h" #include "SymbolTable.h" #include "Symbols.h" #include "SyntheticSections.h" @@ -32,7 +31,6 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Object/ELF.h" #include "llvm/Support/TimeProfiler.h" -#include #include using namespace llvm; diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 53cdcee1bfe8..85c343b148c3 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -9,18 +9,15 @@ #include "OutputSections.h" #include "Config.h" #include "LinkerScript.h" -#include "SymbolTable.h" +#include "Symbols.h" #include "SyntheticSections.h" #include "Target.h" #include "lld/Common/Arrays.h" #include "lld/Common/Memory.h" -#include "lld/Common/Strings.h" #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/Config/llvm-config.h" // LLVM_ENABLE_ZLIB -#include "llvm/Support/MD5.h" -#include "llvm/Support/MathExtras.h" #include "llvm/Support/Parallel.h" -#include "llvm/Support/SHA1.h" +#include "llvm/Support/Path.h" #include "llvm/Support/TimeProfiler.h" #if LLVM_ENABLE_ZLIB #include diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index ad656e49ceff..60a3629e2f25 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -9,21 +9,16 @@ #ifndef LLD_ELF_OUTPUT_SECTIONS_H #define LLD_ELF_OUTPUT_SECTIONS_H -#include "Config.h" #include "InputSection.h" #include "LinkerScript.h" -#include "Relocations.h" #include "lld/Common/LLVM.h" -#include "llvm/MC/StringTableBuilder.h" -#include "llvm/Object/ELF.h" + #include namespace lld { namespace elf { struct PhdrEntry; -class InputSection; -class InputSectionBase; struct CompressedData { std::unique_ptr[]> shards; diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index f2b312c7729c..20433b4552ed 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -51,11 +51,9 @@ #include "Thunks.h" #include "lld/Common/ErrorHandler.h" #include "lld/Common/Memory.h" -#include "lld/Common/Strings.h" #include "llvm/ADT/SmallSet.h" #include "llvm/Demangle/Demangle.h" #include "llvm/Support/Endian.h" -#include "llvm/Support/raw_ostream.h" #include using namespace llvm; diff --git a/lld/ELF/Relocations.h b/lld/ELF/Relocations.h index 3eecc02764a3..da0f2289bc90 100644 --- a/lld/ELF/Relocations.h +++ b/lld/ELF/Relocations.h @@ -12,7 +12,6 @@ #include "lld/Common/LLVM.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/STLExtras.h" -#include #include namespace lld { diff --git a/lld/ELF/ScriptLexer.cpp b/lld/ELF/ScriptLexer.cpp index 236a188324cd..8b1a510f6d91 100644 --- a/lld/ELF/ScriptLexer.cpp +++ b/lld/ELF/ScriptLexer.cpp @@ -34,6 +34,8 @@ #include "ScriptLexer.h" #include "lld/Common/ErrorHandler.h" #include "llvm/ADT/Twine.h" +#include "llvm/Support/ErrorHandling.h" +#include using namespace llvm; using namespace lld; diff --git a/lld/ELF/ScriptLexer.h b/lld/ELF/ScriptLexer.h index 405fc735cbe6..6c8ba60eaaa8 100644 --- a/lld/ELF/ScriptLexer.h +++ b/lld/ELF/ScriptLexer.h @@ -11,8 +11,7 @@ #include "lld/Common/LLVM.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Support/MemoryBuffer.h" -#include +#include "llvm/Support/MemoryBufferRef.h" #include namespace lld { diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 7331d1156f27..9d9eb123eecf 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -14,10 +14,10 @@ #include "ScriptParser.h" #include "Config.h" #include "Driver.h" -#include "InputSection.h" #include "LinkerScript.h" #include "OutputSections.h" #include "ScriptLexer.h" +#include "SymbolTable.h" #include "Symbols.h" #include "Target.h" #include "lld/Common/CommonLinkerContext.h" @@ -31,7 +31,6 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Path.h" -#include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/TimeProfiler.h" #include #include diff --git a/lld/ELF/ScriptParser.h b/lld/ELF/ScriptParser.h index eed1958647f8..cd3971f1c0c5 100644 --- a/lld/ELF/ScriptParser.h +++ b/lld/ELF/ScriptParser.h @@ -10,7 +10,7 @@ #define LLD_ELF_SCRIPT_PARSER_H #include "lld/Common/LLVM.h" -#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/MemoryBufferRef.h" namespace lld { namespace elf { diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index 58f8bc8cab40..2cfc5fcd19b3 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -15,9 +15,7 @@ #include "SymbolTable.h" #include "Config.h" -#include "LinkerScript.h" #include "Symbols.h" -#include "SyntheticSections.h" #include "lld/Common/ErrorHandler.h" #include "lld/Common/Memory.h" #include "lld/Common/Strings.h" diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h index 04c81f642fe0..60bd10a0b168 100644 --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -9,16 +9,15 @@ #ifndef LLD_ELF_SYMBOL_TABLE_H #define LLD_ELF_SYMBOL_TABLE_H -#include "InputFiles.h" #include "Symbols.h" -#include "lld/Common/Strings.h" #include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/STLExtras.h" namespace lld { namespace elf { +class InputFile; + // SymbolTable is a bucket of all known symbols, including defined, // undefined, or lazy symbols (the last one is symbols in archive // files whose archive members are not yet loaded). diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index 495c9e155be1..86a281980ba5 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -15,9 +15,6 @@ #include "Writer.h" #include "lld/Common/ErrorHandler.h" #include "lld/Common/Strings.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/Support/FileSystem.h" -#include "llvm/Support/Path.h" #include using namespace llvm; diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index 271b0fadae23..2ea7e96522a2 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -14,10 +14,8 @@ #define LLD_ELF_SYMBOLS_H #include "InputFiles.h" -#include "InputSection.h" #include "lld/Common/LLVM.h" #include "lld/Common/Memory.h" -#include "lld/Common/Strings.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Object/Archive.h" #include "llvm/Object/ELF.h" @@ -35,9 +33,8 @@ std::string toELFString(const llvm::object::Archive::Symbol &); namespace elf { class CommonSymbol; class Defined; -class InputFile; -class LazyArchive; -class LazyObject; +class OutputSection; +class SectionBase; class SharedSymbol; class Symbol; class Undefined; diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 986c1308cbaf..5fcfd3bbf38f 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -15,12 +15,15 @@ #include "SyntheticSections.h" #include "Config.h" +#include "DWARF.h" +#include "EhFrame.h" #include "InputFiles.h" #include "LinkerScript.h" #include "OutputSections.h" #include "SymbolTable.h" #include "Symbols.h" #include "Target.h" +#include "Thunks.h" #include "Writer.h" #include "lld/Common/CommonLinkerContext.h" #include "lld/Common/DWARF.h" @@ -30,15 +33,11 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h" -#include "llvm/Object/ELFObjectFile.h" -#include "llvm/Support/Compression.h" #include "llvm/Support/Endian.h" #include "llvm/Support/LEB128.h" -#include "llvm/Support/MD5.h" #include "llvm/Support/Parallel.h" #include "llvm/Support/TimeProfiler.h" #include -#include using namespace llvm; using namespace llvm::dwarf; diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h index 1b63a5d29d10..0538ada22970 100644 --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -20,14 +20,13 @@ #ifndef LLD_ELF_SYNTHETIC_SECTIONS_H #define LLD_ELF_SYNTHETIC_SECTIONS_H -#include "DWARF.h" -#include "EhFrame.h" +#include "Config.h" #include "InputSection.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/MapVector.h" #include "llvm/MC/StringTableBuilder.h" #include "llvm/Support/Endian.h" -#include +#include "llvm/Support/Threading.h" namespace lld { namespace elf { diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h index e002114f8439..5e9bbd62572d 100644 --- a/lld/ELF/Target.h +++ b/lld/ELF/Target.h @@ -9,6 +9,7 @@ #ifndef LLD_ELF_TARGET_H #define LLD_ELF_TARGET_H +#include "Config.h" #include "InputSection.h" #include "lld/Common/ErrorHandler.h" #include "llvm/Object/ELF.h" diff --git a/lld/ELF/Thunks.cpp b/lld/ELF/Thunks.cpp index ae740810acb5..0f3858c28d09 100644 --- a/lld/ELF/Thunks.cpp +++ b/lld/ELF/Thunks.cpp @@ -30,7 +30,6 @@ #include "lld/Common/CommonLinkerContext.h" #include "llvm/BinaryFormat/ELF.h" #include "llvm/Support/Casting.h" -#include "llvm/Support/Endian.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" #include diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 4f8f31589405..35d8b01308f7 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -24,7 +24,6 @@ #include "lld/Common/Filesystem.h" #include "lld/Common/Strings.h" #include "llvm/ADT/StringMap.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/Support/Parallel.h" #include "llvm/Support/RandomNumberGenerator.h" #include "llvm/Support/SHA1.h" diff --git a/lld/ELF/Writer.h b/lld/ELF/Writer.h index 9c4a5b98451d..3e7b7d611673 100644 --- a/lld/ELF/Writer.h +++ b/lld/ELF/Writer.h @@ -10,16 +10,13 @@ #define LLD_ELF_WRITER_H #include "Config.h" -#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include -#include namespace lld { namespace elf { class InputFile; class OutputSection; -class InputSectionBase; void copySectionsIntoPartitions(); template void createSyntheticSections(); void combineEhSections();