aboutsummaryrefslogtreecommitdiff
path: root/ELF/LTO.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ELF/LTO.cpp')
-rw-r--r--ELF/LTO.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/ELF/LTO.cpp b/ELF/LTO.cpp
index dd435173101a..de0d45bea1c4 100644
--- a/ELF/LTO.cpp
+++ b/ELF/LTO.cpp
@@ -105,6 +105,11 @@ BitcodeCompiler::~BitcodeCompiler() = default;
static void undefine(Symbol *S) {
replaceBody<Undefined>(S, S->body()->getName(), /*IsLocal=*/false,
STV_DEFAULT, S->body()->Type, nullptr);
+ // It shouldn't normally matter what the binding is, but if a bug in the LTO
+ // implementation causes it to fail to provide a definition for a symbol,
+ // setting the binding to STB_GLOBAL will cause the linker to report an
+ // undefined symbol error, even if the definition was weak.
+ S->Binding = STB_GLOBAL;
}
void BitcodeCompiler::add(BitcodeFile &F) {