diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-19 19:31:37 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-19 19:31:37 +0000 |
commit | bd70118f163f94a4d77eb036e6f83dd0bfcb6268 (patch) | |
tree | d2a106ccd4b5d1b580ab48dd26009bf55bd04160 /lib/MC/ELFObjectWriter.cpp | |
parent | 2312842de0c641107dd04d7e056d02491cc781ca (diff) |
Small cleanups and fixes in preparation for fixing _GLOBAL_OFFSET_TABLE_.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116848 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | lib/MC/ELFObjectWriter.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index adaecc0c02..b6b71be7de 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -703,9 +703,16 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm, // instead? case X86::reloc_signed_4byte: case X86::reloc_pcrel_4byte: + case FK_Data_4: switch (Modifier) { default: llvm_unreachable("Unimplemented"); + case MCSymbolRefExpr::VK_None: + if (Symbol->getName() == "_GLOBAL_OFFSET_TABLE_") + Type = ELF::R_386_GOTPC; + else + Type = ELF::R_386_32; + break; case MCSymbolRefExpr::VK_GOT: Type = ELF::R_386_GOT32; break; @@ -714,12 +721,6 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm, break; } break; - case FK_Data_4: - if (Symbol->getName() == "_GLOBAL_OFFSET_TABLE_") - Type = ELF::R_386_GOTPC; - else - Type = ELF::R_386_32; - break; case FK_Data_2: Type = ELF::R_386_16; break; case X86::reloc_pcrel_1byte: case FK_Data_1: Type = ELF::R_386_8; break; @@ -761,11 +762,14 @@ ELFObjectWriterImpl::getSymbolIndexInSymbolTable(const MCAssembler &Asm, static bool isInSymtab(const MCAssembler &Asm, const MCSymbolData &Data, bool Used) { + if (Used) + return true; + const MCSymbol &Symbol = Data.getSymbol(); if (!Asm.isSymbolLinkerVisible(Symbol) && !Symbol.isUndefined()) return false; - if (!Used && Symbol.isTemporary()) + if (Symbol.isTemporary()) return false; return true; |