Skip to content

Commit da45393

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 d3e6ce0 commit da45393

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
@@ -1754,33 +1754,6 @@ static uint8_t getOsAbi(const Triple &t) {
17541754
}
17551755
}
17561756

1757-
// For DTLTO, bitcode member names must be valid paths to files on disk.
1758-
// For thin archives, resolve `memberPath` relative to the archive's location.
1759-
// Returns true if adjusted; false otherwise. Non-thin archives are unsupported.
1760-
static bool dtltoAdjustMemberPathIfThinArchive(Ctx &ctx, StringRef archivePath,
1761-
std::string &memberPath) {
1762-
assert(!archivePath.empty() && !ctx.arg.dtltoDistributor.empty());
1763-
1764-
// Check if the archive file is a thin archive by reading its header.
1765-
auto bufferOrErr =
1766-
MemoryBuffer::getFileSlice(archivePath, sizeof(ThinArchiveMagic) - 1, 0);
1767-
if (std::error_code ec = bufferOrErr.getError()) {
1768-
ErrAlways(ctx) << "cannot open " << archivePath << ": " << ec.message();
1769-
return false;
1770-
}
1771-
1772-
if (!bufferOrErr->get()->getBuffer().starts_with(ThinArchiveMagic))
1773-
return false;
1774-
1775-
SmallString<64> resolvedPath;
1776-
if (path::is_relative(memberPath)) {
1777-
resolvedPath = path::parent_path(archivePath);
1778-
path::append(resolvedPath, memberPath);
1779-
memberPath = resolvedPath.str();
1780-
}
1781-
return true;
1782-
}
1783-
17841757
BitcodeFile::BitcodeFile(Ctx &ctx, MemoryBufferRef mb, StringRef archiveName,
17851758
uint64_t offsetInArchive, bool lazy)
17861759
: InputFile(ctx, BitcodeKind, mb) {
@@ -1798,13 +1771,10 @@ BitcodeFile::BitcodeFile(Ctx &ctx, MemoryBufferRef mb, StringRef archiveName,
17981771
// symbols later in the link stage). So we append file offset to make
17991772
// filename unique.
18001773
StringSaver &ss = ctx.saver;
1801-
StringRef name =
1802-
(archiveName.empty() ||
1803-
(!ctx.arg.dtltoDistributor.empty() &&
1804-
dtltoAdjustMemberPathIfThinArchive(ctx, archiveName, path)))
1805-
? ss.save(path)
1806-
: ss.save(archiveName + "(" + path::filename(path) + " at " +
1807-
utostr(offsetInArchive) + ")");
1774+
StringRef name = archiveName.empty()
1775+
? ss.save(path)
1776+
: ss.save(archiveName + "(" + path::filename(path) +
1777+
" at " + utostr(offsetInArchive) + ")");
18081778
MemoryBufferRef mbref(mb.getBuffer(), name);
18091779

18101780
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)