From 2f6e0e68a455aa6bd6da74c3256470bd94c0b6f2 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 24 Aug 2010 17:34:39 +0000 Subject: [PATCH] Relocate against parent if the symbol is not in section or it's a common symbol, from Roman Divacky. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111925 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/ELFObjectWriter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 3b07a53f06f..8fb6ff60f89 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -477,7 +477,8 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm, const MCSymbolData *Base = Asm.getAtom(Layout, &SD); if (Base) { - if (MCFragment *F = SD.getFragment()) { + MCFragment *F = SD.getFragment(); + if (F && (!Symbol->isInSection() || SD.isCommon())) { Index = F->getParent()->getOrdinal() + LocalSymbolData.size() + 1; Value += Layout.getSymbolAddress(&SD); } else