summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86ELFWriterInfo.cpp
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-08-05 06:57:03 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-08-05 06:57:03 +0000
commit52d0851446afe2ae923fc7e7ee56aa4c9d61c1e1 (patch)
tree356c393902662d4ed1137c0bd285643b2694f222 /lib/Target/X86/X86ELFWriterInfo.cpp
parent61f4b721b2f268ffbd0be614a4f328d541fa1d81 (diff)
downloadllvm-52d0851446afe2ae923fc7e7ee56aa4c9d61c1e1.tar.gz
llvm-52d0851446afe2ae923fc7e7ee56aa4c9d61c1e1.tar.bz2
llvm-52d0851446afe2ae923fc7e7ee56aa4c9d61c1e1.tar.xz
- Remove custom handling of jumptables by the elf writter (this was
a dirty hack and isn't need anymore since the last x86 code emitter patch) - Add a target-dependent modifier to addend calculation - Use R_X86_64_32S relocation for X86::reloc_absolute_word_sext - Use getELFSectionFlags whenever possible - fix getTextSection to use TLOF and emit the right text section - Handle global emission for static ctors, dtors and Type::PointerTyID - Some minor fixes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86ELFWriterInfo.cpp')
-rw-r--r--lib/Target/X86/X86ELFWriterInfo.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Target/X86/X86ELFWriterInfo.cpp b/lib/Target/X86/X86ELFWriterInfo.cpp
index 096c00ee30..1597d2b31d 100644
--- a/lib/Target/X86/X86ELFWriterInfo.cpp
+++ b/lib/Target/X86/X86ELFWriterInfo.cpp
@@ -39,6 +39,8 @@ unsigned X86ELFWriterInfo::getRelocationType(unsigned MachineRelTy) const {
return R_X86_64_PC32;
case X86::reloc_absolute_word:
return R_X86_64_32;
+ case X86::reloc_absolute_word_sext:
+ return R_X86_64_32S;
case X86::reloc_absolute_dword:
return R_X86_64_64;
case X86::reloc_picrel_word:
@@ -51,6 +53,7 @@ unsigned X86ELFWriterInfo::getRelocationType(unsigned MachineRelTy) const {
return R_386_PC32;
case X86::reloc_absolute_word:
return R_386_32;
+ case X86::reloc_absolute_word_sext:
case X86::reloc_absolute_dword:
case X86::reloc_picrel_word:
default:
@@ -60,20 +63,22 @@ unsigned X86ELFWriterInfo::getRelocationType(unsigned MachineRelTy) const {
return 0;
}
-long int X86ELFWriterInfo::getDefaultAddendForRelTy(unsigned RelTy) const {
+long int X86ELFWriterInfo::getDefaultAddendForRelTy(unsigned RelTy,
+ long int Modifier) const {
if (is64Bit) {
switch(RelTy) {
- case R_X86_64_PC32: return -4;
+ case R_X86_64_PC32: return Modifier - 4;
case R_X86_64_32:
+ case R_X86_64_32S:
case R_X86_64_64:
- return 0;
+ return Modifier;
default:
llvm_unreachable("unknown x86_64 relocation type");
}
} else {
switch(RelTy) {
- case R_386_PC32: return -4;
- case R_386_32: return 0;
+ case R_386_PC32: return Modifier - 4;
+ case R_386_32: return Modifier;
default:
llvm_unreachable("unknown x86 relocation type");
}