aboutsummaryrefslogtreecommitdiff
path: root/lld/wasm
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2023-09-18 14:11:49 -0700
committerGitHub <noreply@github.com>2023-09-18 14:11:49 -0700
commit7bac0bc1152f89f43ce2a44df231454bed80fcd5 (patch)
treec0f9302d27b4af4805ec606ee6e1340a73e492f0 /lld/wasm
parente2a9d3f851c1d11b0bb97fd6c2b2739c992edffd (diff)
downloadllvm-7bac0bc1152f89f43ce2a44df231454bed80fcd5.zip
llvm-7bac0bc1152f89f43ce2a44df231454bed80fcd5.tar.gz
llvm-7bac0bc1152f89f43ce2a44df231454bed80fcd5.tar.bz2
[lld][WebAssembly] Improve error message on adding LTO object post-LTO. NFC (#66688)
We have been getting errors from emscripten users where including the name of the symbol that triggered the inclusion would be useful in the diagnosis. e.g: https://github.com/emscripten-core/emscripten/issues/20275
Diffstat (limited to 'lld/wasm')
-rw-r--r--lld/wasm/InputFiles.cpp6
-rw-r--r--lld/wasm/InputFiles.h2
-rw-r--r--lld/wasm/SymbolTable.cpp4
-rw-r--r--lld/wasm/SymbolTable.h2
4 files changed, 7 insertions, 7 deletions
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp
index fa20a35..96ac1e1 100644
--- a/lld/wasm/InputFiles.cpp
+++ b/lld/wasm/InputFiles.cpp
@@ -760,7 +760,7 @@ void ArchiveFile::addMember(const Archive::Symbol *sym) {
sym->getName());
InputFile *obj = createObjectFile(mb, getName(), c.getChildOffset());
- symtab->addFile(obj);
+ symtab->addFile(obj, sym->getName());
}
static uint8_t mapVisibility(GlobalValue::VisibilityTypes gvVisibility) {
@@ -826,9 +826,9 @@ BitcodeFile::BitcodeFile(MemoryBufferRef m, StringRef archiveName,
bool BitcodeFile::doneLTO = false;
-void BitcodeFile::parse() {
+void BitcodeFile::parse(StringRef symName) {
if (doneLTO) {
- error(toString(this) + ": attempt to add bitcode file after LTO.");
+ error(toString(this) + ": attempt to add bitcode file after LTO (" + symName + ")");
return;
}
diff --git a/lld/wasm/InputFiles.h b/lld/wasm/InputFiles.h
index 3278134..d9a8b53 100644
--- a/lld/wasm/InputFiles.h
+++ b/lld/wasm/InputFiles.h
@@ -176,7 +176,7 @@ public:
uint64_t offsetInArchive);
static bool classof(const InputFile *f) { return f->kind() == BitcodeKind; }
- void parse();
+ void parse(StringRef symName);
std::unique_ptr<llvm::lto::InputFile> obj;
// Set to true once LTO is complete in order prevent further bitcode objects
diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp
index d33176a..9a381e9 100644
--- a/lld/wasm/SymbolTable.cpp
+++ b/lld/wasm/SymbolTable.cpp
@@ -23,7 +23,7 @@ using namespace llvm::object;
namespace lld::wasm {
SymbolTable *symtab;
-void SymbolTable::addFile(InputFile *file) {
+void SymbolTable::addFile(InputFile *file, StringRef symName) {
log("Processing: " + toString(file));
// .a file
@@ -50,7 +50,7 @@ void SymbolTable::addFile(InputFile *file) {
// LLVM bitcode file
if (auto *f = dyn_cast<BitcodeFile>(file)) {
- f->parse();
+ f->parse(symName);
bitcodeFiles.push_back(f);
return;
}
diff --git a/lld/wasm/SymbolTable.h b/lld/wasm/SymbolTable.h
index ef2a023..59eda1c 100644
--- a/lld/wasm/SymbolTable.h
+++ b/lld/wasm/SymbolTable.h
@@ -40,7 +40,7 @@ public:
void wrap(Symbol *sym, Symbol *real, Symbol *wrap);
- void addFile(InputFile *file);
+ void addFile(InputFile *file, StringRef symName = {});
void compileBitcodeFiles();