summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/DefinedAtom.cpp7
-rw-r--r--lib/Core/Error.cpp7
-rw-r--r--lib/Core/File.cpp7
-rw-r--r--lib/Core/LinkingContext.cpp7
-rw-r--r--lib/Core/Reader.cpp7
-rw-r--r--lib/Core/Resolver.cpp7
-rw-r--r--lib/Core/SymbolTable.cpp7
-rw-r--r--lib/Core/Writer.cpp7
-rw-r--r--lib/Driver/DarwinLdDriver.cpp31
-rw-r--r--lib/ReaderWriter/FileArchive.cpp7
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler.cpp7
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler.h7
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler_arm.cpp7
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler_arm64.cpp7
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler_x86.cpp7
-rw-r--r--lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp7
-rw-r--r--lib/ReaderWriter/MachO/Atoms.h7
-rw-r--r--lib/ReaderWriter/MachO/CompactUnwindPass.cpp19
-rw-r--r--lib/ReaderWriter/MachO/DebugInfo.h7
-rw-r--r--lib/ReaderWriter/MachO/ExecutableAtoms.h7
-rw-r--r--lib/ReaderWriter/MachO/File.h7
-rw-r--r--lib/ReaderWriter/MachO/FlatNamespaceFile.h7
-rw-r--r--lib/ReaderWriter/MachO/GOTPass.cpp7
-rw-r--r--lib/ReaderWriter/MachO/LayoutPass.cpp7
-rw-r--r--lib/ReaderWriter/MachO/LayoutPass.h7
-rw-r--r--lib/ReaderWriter/MachO/MachOLinkingContext.cpp19
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFile.h10
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp7
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h7
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp34
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp10
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp7
-rw-r--r--lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp7
-rw-r--r--lib/ReaderWriter/MachO/MachOPasses.h7
-rw-r--r--lib/ReaderWriter/MachO/ObjCPass.cpp7
-rw-r--r--lib/ReaderWriter/MachO/SectCreateFile.h7
-rw-r--r--lib/ReaderWriter/MachO/ShimPass.cpp7
-rw-r--r--lib/ReaderWriter/MachO/StubsPass.cpp12
-rw-r--r--lib/ReaderWriter/MachO/TLVPass.cpp7
-rw-r--r--lib/ReaderWriter/MachO/WriterMachO.cpp7
-rw-r--r--lib/ReaderWriter/YAML/ReaderWriterYAML.cpp7
41 files changed, 167 insertions, 206 deletions
diff --git a/lib/Core/DefinedAtom.cpp b/lib/Core/DefinedAtom.cpp
index 177cae7fcbf0..3c1eece16841 100644
--- a/lib/Core/DefinedAtom.cpp
+++ b/lib/Core/DefinedAtom.cpp
@@ -1,9 +1,8 @@
//===- DefinedAtom.cpp ------------------------------------------*- C++ -*-===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/Core/Error.cpp b/lib/Core/Error.cpp
index 6fc76f7ca3d0..f138a81efaab 100644
--- a/lib/Core/Error.cpp
+++ b/lib/Core/Error.cpp
@@ -1,9 +1,8 @@
//===- Error.cpp - system_error extensions for lld --------------*- C++ -*-===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/Core/File.cpp b/lib/Core/File.cpp
index 30ded091a92a..ce33923c136e 100644
--- a/lib/Core/File.cpp
+++ b/lib/Core/File.cpp
@@ -1,9 +1,8 @@
//===- Core/File.cpp - A Container of Atoms -------------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/Core/LinkingContext.cpp b/lib/Core/LinkingContext.cpp
index 0f225c322122..911ae606678d 100644
--- a/lib/Core/LinkingContext.cpp
+++ b/lib/Core/LinkingContext.cpp
@@ -1,9 +1,8 @@
//===- lib/Core/LinkingContext.cpp - Linker Context Object Interface ------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/Core/Reader.cpp b/lib/Core/Reader.cpp
index 5d8bbbbfe4d7..3592d87ce627 100644
--- a/lib/Core/Reader.cpp
+++ b/lib/Core/Reader.cpp
@@ -1,9 +1,8 @@
//===- lib/Core/Reader.cpp ------------------------------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/Core/Resolver.cpp b/lib/Core/Resolver.cpp
index 9c51c6cdb19c..7e6d95f8223f 100644
--- a/lib/Core/Resolver.cpp
+++ b/lib/Core/Resolver.cpp
@@ -1,9 +1,8 @@
//===- Core/Resolver.cpp - Resolves Atom References -----------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/Core/SymbolTable.cpp b/lib/Core/SymbolTable.cpp
index 51ae8d17181d..55cc27c38a62 100644
--- a/lib/Core/SymbolTable.cpp
+++ b/lib/Core/SymbolTable.cpp
@@ -1,9 +1,8 @@
//===- Core/SymbolTable.cpp - Main Symbol Table ---------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/Core/Writer.cpp b/lib/Core/Writer.cpp
index 51f95bc5053a..12788b187e11 100644
--- a/lib/Core/Writer.cpp
+++ b/lib/Core/Writer.cpp
@@ -1,9 +1,8 @@
//===- lib/Core/Writer.cpp ------------------------------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/Driver/DarwinLdDriver.cpp b/lib/Driver/DarwinLdDriver.cpp
index bbac230df453..8646d86c08e4 100644
--- a/lib/Driver/DarwinLdDriver.cpp
+++ b/lib/Driver/DarwinLdDriver.cpp
@@ -1,9 +1,8 @@
//===- lib/Driver/DarwinLdDriver.cpp --------------------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
@@ -334,8 +333,8 @@ bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx) {
Twine(unknownArg->getAsString(parsedArgs)));
}
- errorHandler().Verbose = parsedArgs.hasArg(OPT_v);
- errorHandler().ErrorLimit = args::getInteger(parsedArgs, OPT_error_limit, 20);
+ errorHandler().verbose = parsedArgs.hasArg(OPT_v);
+ errorHandler().errorLimit = args::getInteger(parsedArgs, OPT_error_limit, 20);
// Figure out output kind ( -dylib, -r, -bundle, -preload, or -static )
llvm::MachO::HeaderFileType fileType = llvm::MachO::MH_EXECUTE;
@@ -638,7 +637,7 @@ bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx) {
// Now that we've constructed the final set of search paths, print out those
// search paths in verbose mode.
- if (errorHandler().Verbose) {
+ if (errorHandler().verbose) {
message("Library search paths:");
for (auto path : ctx.searchDirs()) {
message(" " + path);
@@ -1146,13 +1145,13 @@ static void createFiles(MachOLinkingContext &ctx, bool Implicit) {
/// This is where the link is actually performed.
bool link(llvm::ArrayRef<const char *> args, bool CanExitEarly,
raw_ostream &Error) {
- errorHandler().LogName = args::getFilenameWithoutExe(args[0]);
- errorHandler().ErrorLimitExceededMsg =
+ errorHandler().logName = args::getFilenameWithoutExe(args[0]);
+ errorHandler().errorLimitExceededMsg =
"too many errors emitted, stopping now (use "
"'-error-limit 0' to see all errors)";
- errorHandler().ErrorOS = &Error;
- errorHandler().ExitEarly = CanExitEarly;
- errorHandler().ColorDiagnostics = Error.has_colors();
+ errorHandler().errorOS = &Error;
+ errorHandler().exitEarly = CanExitEarly;
+ errorHandler().colorDiagnostics = Error.has_colors();
MachOLinkingContext ctx;
if (!parse(args, ctx))
@@ -1197,9 +1196,9 @@ bool link(llvm::ArrayRef<const char *> args, bool CanExitEarly,
if (auto ec = pm.runOnFile(*merged)) {
// FIXME: This should be passed to logAllUnhandledErrors but it needs
// to be passed a Twine instead of a string.
- *errorHandler().ErrorOS << "Failed to run passes on file '"
+ *errorHandler().errorOS << "Failed to run passes on file '"
<< ctx.outputPath() << "': ";
- logAllUnhandledErrors(std::move(ec), *errorHandler().ErrorOS,
+ logAllUnhandledErrors(std::move(ec), *errorHandler().errorOS,
std::string());
return false;
}
@@ -1211,9 +1210,9 @@ bool link(llvm::ArrayRef<const char *> args, bool CanExitEarly,
if (auto ec = ctx.writeFile(*merged)) {
// FIXME: This should be passed to logAllUnhandledErrors but it needs
// to be passed a Twine instead of a string.
- *errorHandler().ErrorOS << "Failed to write file '" << ctx.outputPath()
+ *errorHandler().errorOS << "Failed to write file '" << ctx.outputPath()
<< "': ";
- logAllUnhandledErrors(std::move(ec), *errorHandler().ErrorOS,
+ logAllUnhandledErrors(std::move(ec), *errorHandler().errorOS,
std::string());
return false;
}
diff --git a/lib/ReaderWriter/FileArchive.cpp b/lib/ReaderWriter/FileArchive.cpp
index 2f52d9d34312..b09bf34dc47c 100644
--- a/lib/ReaderWriter/FileArchive.cpp
+++ b/lib/ReaderWriter/FileArchive.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/FileArchive.cpp -----------------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/ArchHandler.cpp b/lib/ReaderWriter/MachO/ArchHandler.cpp
index cb20907b3e30..c101f3b157bb 100644
--- a/lib/ReaderWriter/MachO/ArchHandler.cpp
+++ b/lib/ReaderWriter/MachO/ArchHandler.cpp
@@ -1,9 +1,8 @@
//===- lib/FileFormat/MachO/ArchHandler.cpp -------------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/ArchHandler.h b/lib/ReaderWriter/MachO/ArchHandler.h
index 80840b561701..83646c09b1a8 100644
--- a/lib/ReaderWriter/MachO/ArchHandler.h
+++ b/lib/ReaderWriter/MachO/ArchHandler.h
@@ -1,9 +1,8 @@
//===- lib/FileFormat/MachO/ArchHandler.h ---------------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/ArchHandler_arm.cpp b/lib/ReaderWriter/MachO/ArchHandler_arm.cpp
index 2f663c660f5c..06c98ac06fd1 100644
--- a/lib/ReaderWriter/MachO/ArchHandler_arm.cpp
+++ b/lib/ReaderWriter/MachO/ArchHandler_arm.cpp
@@ -1,9 +1,8 @@
//===- lib/FileFormat/MachO/ArchHandler_arm.cpp ---------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp b/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
index b9c815c5a320..a424edf4985a 100644
--- a/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
+++ b/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
@@ -1,9 +1,8 @@
//===- lib/FileFormat/MachO/ArchHandler_arm64.cpp -------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/ArchHandler_x86.cpp b/lib/ReaderWriter/MachO/ArchHandler_x86.cpp
index a2c68092724d..6ea8e8c42e80 100644
--- a/lib/ReaderWriter/MachO/ArchHandler_x86.cpp
+++ b/lib/ReaderWriter/MachO/ArchHandler_x86.cpp
@@ -1,9 +1,8 @@
//===- lib/FileFormat/MachO/ArchHandler_x86.cpp ---------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp b/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
index fba3d530e484..316b5bbc6f4f 100644
--- a/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
+++ b/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp
@@ -1,9 +1,8 @@
//===- lib/FileFormat/MachO/ArchHandler_x86_64.cpp ------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/Atoms.h b/lib/ReaderWriter/MachO/Atoms.h
index 573efca9f6f9..b8bca1959cfb 100644
--- a/lib/ReaderWriter/MachO/Atoms.h
+++ b/lib/ReaderWriter/MachO/Atoms.h
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/Atoms.h ---------------------------*- C++ -*-===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/CompactUnwindPass.cpp b/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
index fa0aaa103eeb..de5adb088799 100644
--- a/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
+++ b/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/CompactUnwindPass.cpp -------------*- C++ -*-===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
@@ -388,12 +387,9 @@ private:
// Gather the personality functions now, so that they're in deterministic
// order (derived from the DefinedAtom order).
- if (unwindEntry.personalityFunction) {
- auto pFunc = std::find(personalities.begin(), personalities.end(),
- unwindEntry.personalityFunction);
- if (pFunc == personalities.end())
- personalities.push_back(unwindEntry.personalityFunction);
- }
+ if (unwindEntry.personalityFunction &&
+ !llvm::count(personalities, unwindEntry.personalityFunction))
+ personalities.push_back(unwindEntry.personalityFunction);
}
}
@@ -552,8 +548,7 @@ private:
}
}
- auto personality = std::find(personalities.begin(), personalities.end(),
- entry.personalityFunction);
+ auto personality = llvm::find(personalities, entry.personalityFunction);
uint32_t personalityIdx = personality == personalities.end()
? 0
: personality - personalities.begin() + 1;
diff --git a/lib/ReaderWriter/MachO/DebugInfo.h b/lib/ReaderWriter/MachO/DebugInfo.h
index 28e41bf4263c..959e10f9a073 100644
--- a/lib/ReaderWriter/MachO/DebugInfo.h
+++ b/lib/ReaderWriter/MachO/DebugInfo.h
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/File.h ----------------------------*- C++ -*-===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/ExecutableAtoms.h b/lib/ReaderWriter/MachO/ExecutableAtoms.h
index ab14e6d8c3e7..ce94be457026 100644
--- a/lib/ReaderWriter/MachO/ExecutableAtoms.h
+++ b/lib/ReaderWriter/MachO/ExecutableAtoms.h
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/ExecutableAtoms.h ---------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/File.h b/lib/ReaderWriter/MachO/File.h
index 2bdd6342b477..1cc1c4109dce 100644
--- a/lib/ReaderWriter/MachO/File.h
+++ b/lib/ReaderWriter/MachO/File.h
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/File.h ----------------------------*- C++ -*-===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/FlatNamespaceFile.h b/lib/ReaderWriter/MachO/FlatNamespaceFile.h
index 7ccd4f19f834..1885effef49f 100644
--- a/lib/ReaderWriter/MachO/FlatNamespaceFile.h
+++ b/lib/ReaderWriter/MachO/FlatNamespaceFile.h
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/FlatNamespaceFile.h -------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/GOTPass.cpp b/lib/ReaderWriter/MachO/GOTPass.cpp
index 49e6f88d4aa4..bc66d49eafb9 100644
--- a/lib/ReaderWriter/MachO/GOTPass.cpp
+++ b/lib/ReaderWriter/MachO/GOTPass.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/GOTPass.cpp -----------------------*- C++ -*-===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
diff --git a/lib/ReaderWriter/MachO/LayoutPass.cpp b/lib/ReaderWriter/MachO/LayoutPass.cpp
index 9058e4f562e2..2718dfcf743f 100644
--- a/lib/ReaderWriter/MachO/LayoutPass.cpp
+++ b/lib/ReaderWriter/MachO/LayoutPass.cpp
@@ -1,9 +1,8 @@
//===-- ReaderWriter/MachO/LayoutPass.cpp - Layout atoms ------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/LayoutPass.h b/lib/ReaderWriter/MachO/LayoutPass.h
index c18777eded0a..904e16b7fb0e 100644
--- a/lib/ReaderWriter/MachO/LayoutPass.h
+++ b/lib/ReaderWriter/MachO/LayoutPass.h
@@ -1,9 +1,8 @@
//===------ lib/ReaderWriter/MachO/LayoutPass.h - Handles Layout of atoms -===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
index 61583963ddd7..38456024c9f8 100644
--- a/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
+++ b/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/MachOLinkingContext.cpp ---------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -768,8 +767,7 @@ void MachOLinkingContext::registerDylib(MachODylibFile *dylib,
bool upward) const {
std::lock_guard<std::mutex> lock(_dylibsMutex);
- if (std::find(_allDylibs.begin(),
- _allDylibs.end(), dylib) == _allDylibs.end())
+ if (!llvm::count(_allDylibs, dylib))
_allDylibs.push_back(dylib);
_pathToDylibMap[dylib->installName()] = dylib;
// If path is different than install name, register path too.
@@ -1016,11 +1014,10 @@ static bool isLibrary(const std::unique_ptr<Node> &elem) {
// new undefines from libraries.
void MachOLinkingContext::finalizeInputFiles() {
std::vector<std::unique_ptr<Node>> &elements = getNodes();
- std::stable_sort(elements.begin(), elements.end(),
- [](const std::unique_ptr<Node> &a,
- const std::unique_ptr<Node> &b) {
- return !isLibrary(a) && isLibrary(b);
- });
+ llvm::stable_sort(elements, [](const std::unique_ptr<Node> &a,
+ const std::unique_ptr<Node> &b) {
+ return !isLibrary(a) && isLibrary(b);
+ });
size_t numLibs = std::count_if(elements.begin(), elements.end(), isLibrary);
elements.push_back(llvm::make_unique<GroupEnd>(numLibs));
}
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFile.h b/lib/ReaderWriter/MachO/MachONormalizedFile.h
index 7eeb8adbd84f..3ef2949addab 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFile.h
+++ b/lib/ReaderWriter/MachO/MachONormalizedFile.h
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/MachONormalizedFile.h -----------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -288,7 +287,8 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb,
/// Takes in-memory normalized view and writes a mach-o object file.
llvm::Error writeBinary(const NormalizedFile &file, StringRef path);
-size_t headerAndLoadCommandsSize(const NormalizedFile &file);
+size_t headerAndLoadCommandsSize(const NormalizedFile &file,
+ bool includeFunctionStarts);
/// Parses a yaml encoded mach-o file to produce an in-memory normalized view.
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
index 7c2e833c090f..38b365374f36 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp ---------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
index ee9e174b82e0..aeb04ef4508a 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h ------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
index 7ef0237e8c36..da27c7cadf96 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp ---------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -109,7 +108,7 @@ private:
class MachOFileLayout {
public:
/// All layout computation is done in the constructor.
- MachOFileLayout(const NormalizedFile &file);
+ MachOFileLayout(const NormalizedFile &file, bool alwaysIncludeFunctionStarts);
/// Returns the final file size as computed in the constructor.
size_t size() const;
@@ -123,7 +122,8 @@ public:
llvm::Error writeBinary(StringRef path);
private:
- uint32_t loadCommandsSize(uint32_t &count);
+ uint32_t loadCommandsSize(uint32_t &count,
+ bool alwaysIncludeFunctionStarts);
void buildFileOffsets();
void writeMachHeader();
llvm::Error writeLoadCommands();
@@ -232,8 +232,9 @@ private:
ByteBuffer _exportTrie;
};
-size_t headerAndLoadCommandsSize(const NormalizedFile &file) {
- MachOFileLayout layout(file);
+size_t headerAndLoadCommandsSize(const NormalizedFile &file,
+ bool includeFunctionStarts) {
+ MachOFileLayout layout(file, includeFunctionStarts);
return layout.headerAndLoadCommandsSize();
}
@@ -250,7 +251,8 @@ size_t MachOFileLayout::headerAndLoadCommandsSize() const {
return _endOfLoadCommands;
}
-MachOFileLayout::MachOFileLayout(const NormalizedFile &file)
+MachOFileLayout::MachOFileLayout(const NormalizedFile &file,
+ bool alwaysIncludeFunctionStarts)
: _file(file),
_is64(MachOLinkingContext::is64Bit(file.arch)),
_swap(!MachOLinkingContext::isHostEndian(file.arch)),
@@ -271,7 +273,7 @@ MachOFileLayout::MachOFileLayout(const NormalizedFile &file)
_endOfLoadCommands += sizeof(version_min_command);
_countOfLoadCommands++;
}
- if (!_file.functionStarts.empty()) {
+ if (!_file.functionStarts.empty() || alwaysIncludeFunctionStarts) {
_endOfLoadCommands += sizeof(linkedit_data_command);
_countOfLoadCommands++;
}
@@ -326,7 +328,8 @@ MachOFileLayout::MachOFileLayout(const NormalizedFile &file)
} else {
// Final linked images have one load command per segment.
_endOfLoadCommands = _startOfLoadCommands
- + loadCommandsSize(_countOfLoadCommands);
+ + loadCommandsSize(_countOfLoadCommands,
+ alwaysIncludeFunctionStarts);
// Assign section file offsets.
buildFileOffsets();
@@ -375,7 +378,8 @@ MachOFileLayout::MachOFileLayout(const NormalizedFile &file)
}
}
-uint32_t MachOFileLayout::loadCommandsSize(uint32_t &count) {
+uint32_t MachOFileLayout::loadCommandsSize(uint32_t &count,
+ bool alwaysIncludeFunctionStarts) {
uint32_t size = 0;
count = 0;
@@ -445,7 +449,7 @@ uint32_t MachOFileLayout::loadCommandsSize(uint32_t &count) {
}
// Add LC_FUNCTION_STARTS if needed
- if (!_file.functionStarts.empty()) {
+ if (!_file.functionStarts.empty() || alwaysIncludeFunctionStarts) {
size += sizeof(linkedit_data_command);
++count;
}
@@ -1007,6 +1011,7 @@ llvm::Error MachOFileLayout::writeLoadCommands() {
lc += sizeof(linkedit_data_command);
}
}
+ assert(lc == &_buffer[_endOfLoadCommands]);
return llvm::Error::success();
}
@@ -1018,6 +1023,7 @@ void MachOFileLayout::writeSectionContent() {
if (s.content.empty())
continue;
uint32_t offset = _sectInfo[&s].fileOffset;
+ assert(offset >= _endOfLoadCommands);
uint8_t *p = &_buffer[offset];
memcpy(p, &s.content[0], s.content.size());
p += s.content.size();
@@ -1543,7 +1549,7 @@ llvm::Error MachOFileLayout::writeBinary(StringRef path) {
/// Takes in-memory normalized view and writes a mach-o object file.
llvm::Error writeBinary(const NormalizedFile &file, StringRef path) {
- MachOFileLayout layout(file);
+ MachOFileLayout layout(file, false);
return layout.writeBinary(path);
}
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp b/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
index e93ca86c3164..1a4603be77c0 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp ------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -588,7 +587,8 @@ void Util::layoutSectionsInTextSegment(size_t hlcSize, SegmentInfo *seg,
void Util::assignAddressesToSections(const NormalizedFile &file) {
// NOTE!: Keep this in sync with organizeSections.
- size_t hlcSize = headerAndLoadCommandsSize(file);
+ size_t hlcSize = headerAndLoadCommandsSize(file,
+ _ctx.generateFunctionStartsLoadCommand());
uint64_t address = 0;
for (SegmentInfo *seg : _segmentInfos) {
if (seg->name.equals("__PAGEZERO")) {
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
index 473de894894e..879f07fb4760 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp --------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp b/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
index 92a646dab5e0..7f53faaeaea3 100644
--- a/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
+++ b/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp -----------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/MachOPasses.h b/lib/ReaderWriter/MachO/MachOPasses.h
index cd01d4aa2c93..93cd3e4df281 100644
--- a/lib/ReaderWriter/MachO/MachOPasses.h
+++ b/lib/ReaderWriter/MachO/MachOPasses.h
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/MachOPasses.h -------------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/ObjCPass.cpp b/lib/ReaderWriter/MachO/ObjCPass.cpp
index 23c71e0f5ecd..df121f0e1d5d 100644
--- a/lib/ReaderWriter/MachO/ObjCPass.cpp
+++ b/lib/ReaderWriter/MachO/ObjCPass.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/ObjCPass.cpp -------------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/lib/ReaderWriter/MachO/SectCreateFile.h b/lib/ReaderWriter/MachO/SectCreateFile.h
index 49e65f63151d..7bb98e16695c 100644
--- a/lib/ReaderWriter/MachO/SectCreateFile.h
+++ b/lib/ReaderWriter/MachO/SectCreateFile.h
@@ -1,9 +1,8 @@
//===---- lib/ReaderWriter/MachO/SectCreateFile.h ---------------*- c++ -*-===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/MachO/ShimPass.cpp b/lib/ReaderWriter/MachO/ShimPass.cpp
index 8a2d2e910cad..b0775ad5fc26 100644
--- a/lib/ReaderWriter/MachO/ShimPass.cpp
+++ b/lib/ReaderWriter/MachO/ShimPass.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/ShimPass.cpp -------------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/lib/ReaderWriter/MachO/StubsPass.cpp b/lib/ReaderWriter/MachO/StubsPass.cpp
index 04c586df336c..fbbd8b2c7584 100644
--- a/lib/ReaderWriter/MachO/StubsPass.cpp
+++ b/lib/ReaderWriter/MachO/StubsPass.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/StubsPass.cpp ---------------------*- C++ -*-===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -271,9 +270,8 @@ public:
mergedFile.addAtom(*helperCacheNLPAtom);
// Add reference to dyld_stub_binder in libSystem.dylib
- auto I = std::find_if(
- mergedFile.sharedLibrary().begin(), mergedFile.sharedLibrary().end(),
- [&](const SharedLibraryAtom *atom) {
+ auto I = llvm::find_if(
+ mergedFile.sharedLibrary(), [&](const SharedLibraryAtom *atom) {
return atom->name().equals(_stubInfo.binderSymbolName);
});
assert(I != mergedFile.sharedLibrary().end() &&
diff --git a/lib/ReaderWriter/MachO/TLVPass.cpp b/lib/ReaderWriter/MachO/TLVPass.cpp
index e362e507ebf2..89b655e1f888 100644
--- a/lib/ReaderWriter/MachO/TLVPass.cpp
+++ b/lib/ReaderWriter/MachO/TLVPass.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/TLVPass.cpp -----------------------*- C++ -*-===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
diff --git a/lib/ReaderWriter/MachO/WriterMachO.cpp b/lib/ReaderWriter/MachO/WriterMachO.cpp
index c457e7b55a43..60e0e9dd9a81 100644
--- a/lib/ReaderWriter/MachO/WriterMachO.cpp
+++ b/lib/ReaderWriter/MachO/WriterMachO.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/MachO/WriterMachO.cpp -----------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp b/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
index 59548684e677..5feff2a0514a 100644
--- a/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
+++ b/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
@@ -1,9 +1,8 @@
//===- lib/ReaderWriter/YAML/ReaderWriterYAML.cpp -------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//