diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-12-09 03:03:58 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-12-09 03:03:58 +0000 |
commit | 1d5969d839ddc4d0af93fd035aa13131e5c6fa82 (patch) | |
tree | f8ece0fa5ab18b73f4147e015731f3b6292f6d26 /lib/MC/ELFObjectWriter.cpp | |
parent | 85f5a1ae396880b5f0c4b344217ab3ce6dc70b28 (diff) |
Handle the case of the magical _GLOBAL_OFFSET_TABLE_ showing up in a
symbol difference. This matches gas behavior and fixes PR11513.
We still don't handle _GLOBAL_OFFSET_TABLE_ in data sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146238 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | lib/MC/ELFObjectWriter.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 935ef4209d..14ca509d75 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -1742,14 +1742,25 @@ unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target, } } else { if (IsPCRel) { - switch (Modifier) { - default: - llvm_unreachable("Unimplemented"); - case MCSymbolRefExpr::VK_None: - Type = ELF::R_386_PC32; + switch ((unsigned)Fixup.getKind()) { + default: llvm_unreachable("invalid fixup kind!"); + + case X86::reloc_global_offset_table: + Type = ELF::R_386_GOTPC; break; - case MCSymbolRefExpr::VK_PLT: - Type = ELF::R_386_PLT32; + + case FK_PCRel_4: + case FK_Data_4: + switch (Modifier) { + default: + llvm_unreachable("Unimplemented"); + case MCSymbolRefExpr::VK_None: + Type = ELF::R_386_PC32; + break; + case MCSymbolRefExpr::VK_PLT: + Type = ELF::R_386_PLT32; + break; + } break; } } else { |