Skip to content

Commit 1733d94

Browse files
committed
Revert "[lld] Preliminary fat-lto-object support"
This reverts commit c9953d9 and a forward fix in 3a45b84. D14677 causes some failure on windows bots that the forward fix did not address. Thus I'm reverting until the underlying cause can me triaged.
1 parent 71efd20 commit 1733d94

File tree

7 files changed

+6
-147
lines changed

7 files changed

+6
-147
lines changed

lld/ELF/Config.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ class LinkerDriver {
125125
void inferMachineType();
126126
void link(llvm::opt::InputArgList &args);
127127
template <class ELFT> void compileBitcodeFiles(bool skipLinkedOutput);
128-
bool tryAddFatLTOFile(MemoryBufferRef mb, StringRef archiveName,
129-
uint64_t offsetInArchive, bool lazy);
128+
130129
// True if we are in --whole-archive and --no-whole-archive.
131130
bool inWholeArchive = false;
132131

@@ -206,7 +205,6 @@ struct Config {
206205
callGraphProfile;
207206
bool cmseImplib = false;
208207
bool allowMultipleDefinition;
209-
bool fatLTOObjects;
210208
bool androidPackDynRelocs = false;
211209
bool armHasBlx = false;
212210
bool armHasMovtMovw = false;

lld/ELF/Driver.cpp

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
#include "llvm/Config/llvm-config.h"
5353
#include "llvm/LTO/LTO.h"
5454
#include "llvm/Object/Archive.h"
55-
#include "llvm/Object/IRObjectFile.h"
5655
#include "llvm/Remarks/HotnessThresholdParser.h"
5756
#include "llvm/Support/CommandLine.h"
5857
#include "llvm/Support/Compression.h"
@@ -238,19 +237,6 @@ static bool isBitcode(MemoryBufferRef mb) {
238237
return identify_magic(mb.getBuffer()) == llvm::file_magic::bitcode;
239238
}
240239

241-
bool LinkerDriver::tryAddFatLTOFile(MemoryBufferRef mb, StringRef archiveName,
242-
uint64_t offsetInArchive, bool lazy) {
243-
if (!config->fatLTOObjects)
244-
return false;
245-
Expected<MemoryBufferRef> fatLTOData =
246-
IRObjectFile::findBitcodeInMemBuffer(mb);
247-
if (errorToBool(fatLTOData.takeError()))
248-
return false;
249-
files.push_back(
250-
make<BitcodeFile>(*fatLTOData, archiveName, offsetInArchive, lazy));
251-
return true;
252-
}
253-
254240
// Opens a file and create a file object. Path has to be resolved already.
255241
void LinkerDriver::addFile(StringRef path, bool withLOption) {
256242
using namespace sys::fs;
@@ -275,7 +261,7 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
275261
for (const std::pair<MemoryBufferRef, uint64_t> &p : members) {
276262
if (isBitcode(p.first))
277263
files.push_back(make<BitcodeFile>(p.first, path, p.second, false));
278-
else if (!tryAddFatLTOFile(p.first, path, p.second, false))
264+
else
279265
files.push_back(createObjFile(p.first, path));
280266
}
281267
return;
@@ -299,10 +285,9 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
299285
InputFile::isInGroup = true;
300286
for (const std::pair<MemoryBufferRef, uint64_t> &p : members) {
301287
auto magic = identify_magic(p.first.getBuffer());
302-
if (magic == file_magic::elf_relocatable) {
303-
if (!tryAddFatLTOFile(p.first, path, p.second, true))
304-
files.push_back(createObjFile(p.first, path, true));
305-
} else if (magic == file_magic::bitcode)
288+
if (magic == file_magic::elf_relocatable)
289+
files.push_back(createObjFile(p.first, path, true));
290+
else if (magic == file_magic::bitcode)
306291
files.push_back(make<BitcodeFile>(p.first, path, p.second, true));
307292
else
308293
warn(path + ": archive member '" + p.first.getBufferIdentifier() +
@@ -334,8 +319,7 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
334319
files.push_back(make<BitcodeFile>(mbref, "", 0, inLib));
335320
break;
336321
case file_magic::elf_relocatable:
337-
if (!tryAddFatLTOFile(mbref, "", 0, inLib))
338-
files.push_back(createObjFile(mbref, "", inLib));
322+
files.push_back(createObjFile(mbref, "", inLib));
339323
break;
340324
default:
341325
error(path + ": unknown file type");
@@ -1154,8 +1138,6 @@ static void readConfigs(opt::InputArgList &args) {
11541138
args.hasFlag(OPT_android_memtag_heap, OPT_no_android_memtag_heap, false);
11551139
config->androidMemtagStack = args.hasFlag(OPT_android_memtag_stack,
11561140
OPT_no_android_memtag_stack, false);
1157-
config->fatLTOObjects =
1158-
args.hasFlag(OPT_fat_lto_objects, OPT_no_fat_lto_objects, false);
11591141
config->androidMemtagMode = getMemtagMode(args);
11601142
config->auxiliaryList = args::getStrings(args, OPT_auxiliary);
11611143
config->armBe8 = args.hasArg(OPT_be8);

lld/ELF/Options.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -647,10 +647,6 @@ def thinlto_prefix_replace_eq: JJ<"thinlto-prefix-replace=">;
647647
def thinlto_single_module_eq: JJ<"thinlto-single-module=">,
648648
HelpText<"Specify a single module to compile in ThinLTO mode, for debugging only">;
649649

650-
defm fat_lto_objects: BB<"fat-lto-objects",
651-
"Use the .llvm.lto section, which contains LLVM bitcode, in fat LTO object files to perform LTO.",
652-
"Ignore the .llvm.lto section in relocatable object files (default).">;
653-
654650
def: J<"plugin-opt=O">, Alias<lto_O>, HelpText<"Alias for --lto-O">;
655651
def: F<"plugin-opt=debug-pass-manager">,
656652
Alias<lto_debug_pass_manager>, HelpText<"Alias for --lto-debug-pass-manager">;

lld/docs/ReleaseNotes.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ ELF Improvements
3131
* ``PT_RISCV_ATTRIBUTES`` is added to include the SHT_RISCV_ATTRIBUTES section.
3232
(`D152065 <https://reviews.llvm.org/D152065>`_)
3333

34-
- ``--fat-lto-objects`` option is added to support LLVM FatLTO.
35-
Without ``--fat-lto-objects``, LLD will link LLVM FatLTO objects using the
36-
relocatable object file. (`D146778 <https://reviews.llvm.org/D146778>`_)
37-
3834
Breaking changes
3935
----------------
4036

lld/docs/ld.lld.1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,6 @@ Number of threads.
621621
(default) means all of concurrent threads supported.
622622
.Cm 1
623623
disables multi-threading.
624-
.It Fl -fat-lto-objects
625-
Use the .llvm.lto section, which contains LLVM bitcode, in fat LTO object files to perform LTO.
626-
.It Fl -no-fat-lto-objects
627-
Ignore the .llvm.lto section in relocatable object files (default).
628624
.It Fl -time-trace
629625
Record time trace.
630626
.It Fl -time-trace-file Ns = Ns Ar file

lld/test/ELF/fatlto/fatlto.invalid.s

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

lld/test/ELF/fatlto/fatlto.test

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

0 commit comments

Comments
 (0)