Section relative fixups are a coff concept, not a x86 one. Replace the

x86 specific reloc_coff_secrel32 with a generic FK_SecRel_4.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147252 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2011-12-24 14:47:52 +00:00
parent 7782102c70
commit ce618af3e8
6 changed files with 16 additions and 10 deletions

View File

@@ -39,17 +39,20 @@ static unsigned getFixupKindLog2Size(unsigned Kind) {
switch (Kind) {
default: assert(0 && "invalid fixup kind!");
case FK_PCRel_1:
case FK_SecRel_1:
case FK_Data_1: return 0;
case FK_PCRel_2:
case FK_SecRel_2:
case FK_Data_2: return 1;
case FK_PCRel_4:
case X86::reloc_riprel_4byte:
case X86::reloc_riprel_4byte_movq_load:
case X86::reloc_signed_4byte:
case X86::reloc_global_offset_table:
case X86::reloc_coff_secrel32:
case FK_SecRel_4:
case FK_Data_4: return 2;
case FK_PCRel_8:
case FK_SecRel_8:
case FK_Data_8: return 3;
}
}
@@ -77,8 +80,7 @@ public:
{ "reloc_riprel_4byte", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel },
{ "reloc_riprel_4byte_movq_load", 0, 4 * 8, MCFixupKindInfo::FKF_IsPCRel},
{ "reloc_signed_4byte", 0, 4 * 8, 0},
{ "reloc_global_offset_table", 0, 4 * 8, 0},
{ "reloc_coff_secrel32", 0, 4 * 8, 0}
{ "reloc_global_offset_table", 0, 4 * 8, 0}
};
if (Kind < FirstTargetFixupKind)

View File

@@ -23,8 +23,6 @@ enum Fixups {
reloc_global_offset_table, // 32-bit, relative to the start
// of the instruction. Used only
// for _GLOBAL_OFFSET_TABLE_.
reloc_coff_secrel32, // PE-COFF section relative 32
// (only valid for win32 COFF)
// Marker
LastTargetFixupKind,
NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind

View File

@@ -55,7 +55,7 @@ unsigned X86WinCOFFObjectWriter::getRelocType(unsigned FixupKind) const {
else
llvm_unreachable("unsupported relocation type");
break;
case X86::reloc_coff_secrel32:
case FK_SecRel_4:
return Is64Bit ? COFF::IMAGE_REL_AMD64_SREL32 : COFF::IMAGE_REL_I386_SECREL;
break;
default: