diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 7ba1bf8a634..ed4f972be59 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -364,7 +364,7 @@ void ELFObjectWriterImpl::WriteSymbol(MCDataFragment *F, ELFSymbolData &MSD, if (Data.isCommon() && Data.isExternal()) Value = Data.getCommonAlignment(); - if (!Data.isCommon()) + if (!Data.isCommon() && !(Data.getFlags() & ELF_STB_Weak)) if (MCFragment *FF = Data.getFragment()) Value = Layout.getSymbolAddress(&Data) - Layout.getSectionAddress(FF->getParent());