From 274c9ff5404582ff22769d9599ab10ed216ceec3 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 2 May 2017 18:31:09 +0000 Subject: Vendor import of lld trunk r301939: https://llvm.org/svn/llvm-project/lld/trunk@301939 --- ELF/LTO.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ELF/LTO.cpp') 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(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) { -- cgit v1.3