Use a better name for the label relocations while emitting them for Jump Tables
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Sat, 18 Jul 2009 20:52:11 +0000 (20:52 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Sat, 18 Jul 2009 20:52:11 +0000 (20:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76334 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetELFWriterInfo.h
lib/CodeGen/ELFCodeEmitter.cpp
lib/Target/X86/X86ELFWriterInfo.cpp
lib/Target/X86/X86ELFWriterInfo.h

index dbcffe0ca64f72efa988f63e6e8637b88285779b..7eb53529af98b3dae2309623ce980a36509f843b 100644 (file)
@@ -106,7 +106,7 @@ namespace llvm {
 
     /// getJumpTableRelocationTy - Returns the machine relocation type used
     /// to reference a jumptable.
-    virtual unsigned getJumpTableMachineRelocationTy() const = 0;
+    virtual unsigned getAbsoluteLabelMachineRelTy() const = 0;
   };
 
 } // end llvm namespace
index 6e6ba8ec6ac24c45bf18439fc3fd4dadc5ec022d..6e502465942b265d536cbbf82818e81ad08d51f0 100644 (file)
@@ -185,7 +185,7 @@ void ELFCodeEmitter::emitJumpTables(MachineJumpTableInfo *MJTI) {
     // Each MBB entry in the Jump table section has a relocation entry
     // against the current text section.
     for (unsigned mi = 0, me = MBBs.size(); mi != me; ++mi) {
-      unsigned MachineRelTy = TEW->getJumpTableMachineRelocationTy();
+      unsigned MachineRelTy = TEW->getAbsoluteLabelMachineRelTy();
       MachineRelocation MR =
         MachineRelocation::getBB(JTSection.size(),
                                  MachineRelTy,
index 4002e265304fb547ab842a8be17475f27af8366a..4e4b6f1d9177f835111aa094b5398cb54c344faa 100644 (file)
@@ -102,7 +102,8 @@ unsigned X86ELFWriterInfo::getRelocationTySize(unsigned RelTy) const {
   return 0;
 }
 
-unsigned X86ELFWriterInfo::getJumpTableMachineRelocationTy() const {
-  return X86::reloc_absolute_dword;
+unsigned X86ELFWriterInfo::getAbsoluteLabelMachineRelTy() const {
+  return is64Bit ?
+    X86::reloc_absolute_dword : X86::reloc_absolute_word;
 }
 
index f372658f706c7b3d13c4443eb3c091cf13759bfc..7782a5b12fb7d92d0eb709d19cf91569ad642408 100644 (file)
@@ -58,7 +58,7 @@ namespace llvm {
 
     /// getJumpTableRelocationTy - Returns the machine relocation type used
     /// to reference a jumptable.
-    virtual unsigned getJumpTableMachineRelocationTy() const;
+    virtual unsigned getAbsoluteLabelMachineRelTy() const;
   };
 
 } // end llvm namespace