aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MC/ELFObjectWriter.cpp')
-rw-r--r--lib/MC/ELFObjectWriter.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp
index 45e9c3b..2eb6208 100644
--- a/lib/MC/ELFObjectWriter.cpp
+++ b/lib/MC/ELFObjectWriter.cpp
@@ -707,7 +707,12 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm,
break;
}
break;
- case FK_Data_4: Type = ELF::R_386_32; 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;