aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-10-18 18:36:12 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-10-18 18:36:12 +0000
commitaa85c216334a6adac7e0a154d357b370629dc1bc (patch)
treef8baf27c702a7adc97542719b1e00ef5c95d4528 /lib
parent01b58f637c23e203dd95a4709bdd40cdfc31ffa9 (diff)
downloadexternal_llvm-aa85c216334a6adac7e0a154d357b370629dc1bc.zip
external_llvm-aa85c216334a6adac7e0a154d357b370629dc1bc.tar.gz
external_llvm-aa85c216334a6adac7e0a154d357b370629dc1bc.tar.bz2
Produce ELF::R_386_GOTPC relocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116728 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/MC/ELFObjectWriter.cpp7
-rw-r--r--lib/Target/X86/X86AsmBackend.cpp5
2 files changed, 11 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;
diff --git a/lib/Target/X86/X86AsmBackend.cpp b/lib/Target/X86/X86AsmBackend.cpp
index 853d3ed..83fca51 100644
--- a/lib/Target/X86/X86AsmBackend.cpp
+++ b/lib/Target/X86/X86AsmBackend.cpp
@@ -72,6 +72,11 @@ static unsigned getRelaxedOpcode(unsigned Op) {
default:
return Op;
+ // This is used on i386 with things like addl $foo, %ebx
+ // FIXME: Should the other *i8 instructions be here too? If not, it might
+ // be better to just select X86::ADD32ri instead of X86::ADD32ri8.
+ case X86::ADD32ri8: return X86::ADD32ri;
+
case X86::JAE_1: return X86::JAE_4;
case X86::JA_1: return X86::JA_4;
case X86::JBE_1: return X86::JBE_4;