Skip to content

Commit 57ff3e0

Browse files
committed
Remove thin-archive bitcode member support
This change removes the DTLTO support for thin-archive bitcode members from this patch. This makes the patch simpler and more amenable to review. We are also exploring how to support bitcode members in non-thin archives. That work is progressing and may require a different approach for thin-archive support than was originally implemented. If that is the case, reviewing the current implementation would waste reviewers' time. Note that with this support removed, this patch is no longer sufficient to allow for self-hosting an LLVM build with DTLTO. Theoretically, --start-lib/--end-lib could be used instead. However, unlike thin-archives, it's unclear how --start-lib/--end-lib can be easily used with the LLVM build system.
1 parent 1680a58 commit 57ff3e0

File tree

5 files changed

+7
-187
lines changed

5 files changed

+7
-187
lines changed

cross-project-tests/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ set(CROSS_PROJECT_TEST_DEPS
1919
FileCheck
2020
check-gdb-llvm-support
2121
count
22-
llvm-ar
23-
llvm-config
2422
llvm-dwarfdump
23+
llvm-config
2524
llvm-objdump
26-
not
2725
split-file
26+
not
2827
)
2928

3029
if ("clang" IN_LIST LLVM_ENABLE_PROJECTS)

cross-project-tests/dtlto/archive-thin.test

Lines changed: 0 additions & 65 deletions
This file was deleted.

cross-project-tests/lit.cfg.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
2020

2121
# suffixes: A list of file extensions to treat as test files.
22-
config.suffixes = [".c", ".cl", ".cpp", ".m", ".test"]
22+
config.suffixes = [".c", ".cl", ".cpp", ".m"]
2323

2424
# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
2525
# subdirectories contain auxiliary inputs for various tests in their parent
@@ -107,8 +107,6 @@ def get_required_attr(config, attr_name):
107107
if lldb_path is not None:
108108
config.available_features.add("lldb")
109109

110-
if llvm_config.use_llvm_tool("llvm-ar"):
111-
config.available_features.add("llvm-ar")
112110

113111
def configure_dexter_substitutions():
114112
"""Configure substitutions for host platform and return list of dependencies"""

lld/ELF/InputFiles.cpp

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,33 +1740,6 @@ static uint8_t getOsAbi(const Triple &t) {
17401740
}
17411741
}
17421742

1743-
// For DTLTO, bitcode member names must be valid paths to files on disk.
1744-
// For thin archives, resolve `memberPath` relative to the archive's location.
1745-
// Returns true if adjusted; false otherwise. Non-thin archives are unsupported.
1746-
static bool dtltoAdjustMemberPathIfThinArchive(Ctx &ctx, StringRef archivePath,
1747-
std::string &memberPath) {
1748-
assert(!archivePath.empty() && !ctx.arg.dtltoDistributor.empty());
1749-
1750-
// Check if the archive file is a thin archive by reading its header.
1751-
auto bufferOrErr =
1752-
MemoryBuffer::getFileSlice(archivePath, sizeof(ThinArchiveMagic) - 1, 0);
1753-
if (std::error_code ec = bufferOrErr.getError()) {
1754-
ErrAlways(ctx) << "cannot open " << archivePath << ": " << ec.message();
1755-
return false;
1756-
}
1757-
1758-
if (!bufferOrErr->get()->getBuffer().starts_with(ThinArchiveMagic))
1759-
return false;
1760-
1761-
SmallString<64> resolvedPath;
1762-
if (path::is_relative(memberPath)) {
1763-
resolvedPath = path::parent_path(archivePath);
1764-
path::append(resolvedPath, memberPath);
1765-
memberPath = resolvedPath.str();
1766-
}
1767-
return true;
1768-
}
1769-
17701743
BitcodeFile::BitcodeFile(Ctx &ctx, MemoryBufferRef mb, StringRef archiveName,
17711744
uint64_t offsetInArchive, bool lazy)
17721745
: InputFile(ctx, BitcodeKind, mb) {
@@ -1784,13 +1757,10 @@ BitcodeFile::BitcodeFile(Ctx &ctx, MemoryBufferRef mb, StringRef archiveName,
17841757
// symbols later in the link stage). So we append file offset to make
17851758
// filename unique.
17861759
StringSaver &ss = ctx.saver;
1787-
StringRef name =
1788-
(archiveName.empty() ||
1789-
(!ctx.arg.dtltoDistributor.empty() &&
1790-
dtltoAdjustMemberPathIfThinArchive(ctx, archiveName, path)))
1791-
? ss.save(path)
1792-
: ss.save(archiveName + "(" + path::filename(path) + " at " +
1793-
utostr(offsetInArchive) + ")");
1760+
StringRef name = archiveName.empty()
1761+
? ss.save(path)
1762+
: ss.save(archiveName + "(" + path::filename(path) +
1763+
" at " + utostr(offsetInArchive) + ")");
17941764
MemoryBufferRef mbref(mb.getBuffer(), name);
17951765

17961766
obj = CHECK2(lto::InputFile::create(mbref), this);

lld/test/ELF/dtlto/archive-thin.test

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)