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
This commit is contained in:
Benjamin Kramer 2010-08-24 17:34:39 +00:00
parent 53c36c41ae
commit 2f6e0e68a4

View File

@ -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