[lld] [llvm] [DTLTO][ELF][COFF] Add archive support for DTLTO. (PR #157043)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 07:28:42 PST 2025
================
@@ -0,0 +1,216 @@
+//===- Dtlto.cpp - Distributed ThinLTO implementation --------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// \file
+// This file implements support functions for Distributed ThinLTO, focusing on
+// archive file handling.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DTLTO/DTLTO.h"
+
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Magic.h"
+#include "llvm/LTO/LTO.h"
+#include "llvm/Object/Archive.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/MemoryBufferRef.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Process.h"
+#include "llvm/Support/raw_ostream.h"
+
+#include <iostream>
+#include <string>
+
+using namespace llvm;
+
+namespace dtlto {
+
+// Writes the content of a memory buffer into a file.
+static llvm::Error saveBuffer(StringRef FileBuffer, StringRef FilePath) {
----------------
teresajohnson wrote:
rather than make this static, just make the namespace enclosing this anonymous. Also do computeThinArchiveMemberPath, saveInputArchiveMember, and saveInputArchiveMembers need to be in a named namespace since they are only called within this TU? I'd suggest putting all of these into an anonymous namespace
https://github.com/llvm/llvm-project/pull/157043
More information about the llvm-commits
mailing list