1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Implement DTPOFF.

llvm-svn: 117546
This commit is contained in:
Rafael Espindola 2010-10-28 14:48:59 +00:00
parent 884f6a3c67
commit 8372247e83
4 changed files with 16 additions and 0 deletions

View File

@ -139,6 +139,7 @@ public:
VK_TLSGD,
VK_TLSLDM,
VK_TPOFF,
VK_DTPOFF,
VK_ARM_HI16, // The R_ARM_MOVT_ABS relocation (:upper16: in the asm file)
VK_ARM_LO16, // The R_ARM_MOVW_ABS_NC relocation (:lower16: in the asm file)
VK_ARM_PLT, // ARM-style PLT symbol references. i.e., (PLT) instead of @PLT

View File

@ -92,6 +92,7 @@ static bool RelocNeedsGOT(MCSymbolRefExpr::VariantKind Variant) {
case MCSymbolRefExpr::VK_NTPOFF:
case MCSymbolRefExpr::VK_GOTNTPOFF:
case MCSymbolRefExpr::VK_TLSLDM:
case MCSymbolRefExpr::VK_DTPOFF:
return true;
}
}
@ -788,6 +789,9 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm,
case MCSymbolRefExpr::VK_TLSLDM:
Type = ELF::R_386_TLS_LDM;
break;
case MCSymbolRefExpr::VK_DTPOFF:
Type = ELF::R_386_TLS_LDO_32;
break;
}
break;
case FK_Data_2: Type = ELF::R_386_16; break;

View File

@ -180,6 +180,7 @@ StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
case VK_TLSGD: return "TLSGD";
case VK_TLSLDM: return "TLSLDM";
case VK_TPOFF: return "TPOFF";
case VK_DTPOFF: return "DTPOFF";
case VK_ARM_HI16: return ":upper16:";
case VK_ARM_LO16: return ":lower16:";
case VK_ARM_PLT: return "(PLT)";
@ -201,6 +202,7 @@ MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
.Case("TLSGD", VK_TLSGD)
.Case("TLSLDM", VK_TLSLDM)
.Case("TPOFF", VK_TPOFF)
.Case("DTPOFF", VK_DTPOFF)
.Case("TLVP", VK_TLVP)
.Default(VK_Invalid);
}

View File

@ -91,6 +91,14 @@
// CHECK-NEXT: ('r_sym', 0x0000000b)
// CHECK-NEXT: ('r_type', 0x00000013)
// CHECK-NEXT: ),
// Relocation 11 (foo@DTPOFF) is of type R_386_TLS_LDO_32
// CHECK-NEXT: # Relocation 0x0000000b
// CHECK-NEXT: (('r_offset', 0x00000043)
// CHECK-NEXT: ('r_sym', 0x0000000b)
// CHECK-NEXT: ('r_type', 0x00000020)
// CHECK-NEXT: ),
.text
bar:
leal .Lfoo@GOTOFF(%ebx), %eax
@ -113,6 +121,7 @@ bar2:
addl foo@NTPOFF(%eax), %eax
addl foo@GOTNTPOFF(%ebx), %ecx
leal foo@TLSLDM(%ebx), %eax
leal foo@DTPOFF(%eax), %edx
.section .rodata.str1.16,"aMS",@progbits,1
.Lfoo: