diff --git a/lld/MachO/InputSection.cpp b/lld/MachO/InputSection.cpp
--- a/lld/MachO/InputSection.cpp
+++ b/lld/MachO/InputSection.cpp
@@ -16,6 +16,8 @@
 #include "Target.h"
 #include "UnwindInfoSection.h"
 #include "Writer.h"
+
+#include "lld/Common/ErrorHandler.h"
 #include "lld/Common/Memory.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/xxhash.h"
diff --git a/lld/MachO/MapFile.cpp b/lld/MachO/MapFile.cpp
--- a/lld/MachO/MapFile.cpp
+++ b/lld/MachO/MapFile.cpp
@@ -33,6 +33,7 @@
 #include "Symbols.h"
 #include "SyntheticSections.h"
 #include "Target.h"
+#include "lld/Common/ErrorHandler.h"
 #include "llvm/Support/Parallel.h"
 #include "llvm/Support/TimeProfiler.h"
 
diff --git a/lld/MachO/MarkLive.cpp b/lld/MachO/MarkLive.cpp
--- a/lld/MachO/MarkLive.cpp
+++ b/lld/MachO/MarkLive.cpp
@@ -12,9 +12,12 @@
 #include "SymbolTable.h"
 #include "Symbols.h"
 #include "UnwindInfoSection.h"
-#include "mach-o/compact_unwind_encoding.h"
+
+#include "lld/Common/ErrorHandler.h"
 #include "llvm/Support/TimeProfiler.h"
 
+#include "mach-o/compact_unwind_encoding.h"
+
 namespace lld::macho {
 
 using namespace llvm;
diff --git a/lld/MachO/ObjC.cpp b/lld/MachO/ObjC.cpp
--- a/lld/MachO/ObjC.cpp
+++ b/lld/MachO/ObjC.cpp
@@ -12,6 +12,7 @@
 #include "OutputSegment.h"
 #include "Target.h"
 
+#include "lld/Common/ErrorHandler.h"
 #include "llvm/BinaryFormat/MachO.h"
 #include "llvm/Bitcode/BitcodeReader.h"
 
diff --git a/lld/MachO/SectionPriorities.cpp b/lld/MachO/SectionPriorities.cpp
--- a/lld/MachO/SectionPriorities.cpp
+++ b/lld/MachO/SectionPriorities.cpp
@@ -26,6 +26,7 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
+
 #include <numeric>
 
 using namespace llvm;
diff --git a/lld/MachO/Symbols.h b/lld/MachO/Symbols.h
--- a/lld/MachO/Symbols.h
+++ b/lld/MachO/Symbols.h
@@ -12,8 +12,7 @@
 #include "Config.h"
 #include "InputFiles.h"
 #include "Target.h"
-#include "lld/Common/ErrorHandler.h"
-#include "lld/Common/Strings.h"
+
 #include "llvm/Object/Archive.h"
 #include "llvm/Support/MathExtras.h"
 
diff --git a/lld/MachO/SyntheticSections.h b/lld/MachO/SyntheticSections.h
--- a/lld/MachO/SyntheticSections.h
+++ b/lld/MachO/SyntheticSections.h
@@ -22,7 +22,6 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/BinaryFormat/MachO.h"
-#include "llvm/MC/StringTableBuilder.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
 
diff --git a/lld/MachO/UnwindInfoSection.h b/lld/MachO/UnwindInfoSection.h
--- a/lld/MachO/UnwindInfoSection.h
+++ b/lld/MachO/UnwindInfoSection.h
@@ -13,8 +13,6 @@
 #include "SyntheticSections.h"
 #include "llvm/ADT/MapVector.h"
 
-#include "mach-o/compact_unwind_encoding.h"
-
 namespace lld::macho {
 
 class UnwindInfoSection : public SyntheticSection {
diff --git a/lld/MachO/UnwindInfoSection.cpp b/lld/MachO/UnwindInfoSection.cpp
--- a/lld/MachO/UnwindInfoSection.cpp
+++ b/lld/MachO/UnwindInfoSection.cpp
@@ -7,8 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "UnwindInfoSection.h"
-#include "ConcatOutputSection.h"
-#include "Config.h"
 #include "InputSection.h"
 #include "OutputSection.h"
 #include "OutputSegment.h"
@@ -24,6 +22,8 @@
 #include "llvm/BinaryFormat/MachO.h"
 #include "llvm/Support/Parallel.h"
 
+#include "mach-o/compact_unwind_encoding.h"
+
 #include <numeric>
 
 using namespace llvm;
diff --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -20,14 +20,12 @@
 #include "SyntheticSections.h"
 #include "Target.h"
 #include "UnwindInfoSection.h"
-#include "llvm/Support/Parallel.h"
 
 #include "lld/Common/Arrays.h"
 #include "lld/Common/CommonLinkerContext.h"
 #include "llvm/BinaryFormat/MachO.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/LEB128.h"
-#include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Parallel.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/ThreadPool.h"