[llvm-commits] [llvm] r117546 - in /llvm/trunk: include/llvm/MC/MCExpr.h lib/MC/ELFObjectWriter.cpp lib/MC/MCExpr.cpp test/MC/ELF/relocation-386.s
Rafael Espindola
rafael.espindola at gmail.com
Thu Oct 28 07:48:59 PDT 2010
Author: rafael
Date: Thu Oct 28 09:48:59 2010
New Revision: 117546
URL: http://llvm.org/viewvc/llvm-project?rev=117546&view=rev
Log:
Implement DTPOFF.
Modified:
llvm/trunk/include/llvm/MC/MCExpr.h
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/lib/MC/MCExpr.cpp
llvm/trunk/test/MC/ELF/relocation-386.s
Modified: llvm/trunk/include/llvm/MC/MCExpr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=117546&r1=117545&r2=117546&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCExpr.h (original)
+++ llvm/trunk/include/llvm/MC/MCExpr.h Thu Oct 28 09:48:59 2010
@@ -139,6 +139,7 @@
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
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=117546&r1=117545&r2=117546&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Thu Oct 28 09:48:59 2010
@@ -92,6 +92,7 @@
case MCSymbolRefExpr::VK_NTPOFF:
case MCSymbolRefExpr::VK_GOTNTPOFF:
case MCSymbolRefExpr::VK_TLSLDM:
+ case MCSymbolRefExpr::VK_DTPOFF:
return true;
}
}
@@ -788,6 +789,9 @@
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;
Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=117546&r1=117545&r2=117546&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Thu Oct 28 09:48:59 2010
@@ -180,6 +180,7 @@
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 @@
.Case("TLSGD", VK_TLSGD)
.Case("TLSLDM", VK_TLSLDM)
.Case("TPOFF", VK_TPOFF)
+ .Case("DTPOFF", VK_DTPOFF)
.Case("TLVP", VK_TLVP)
.Default(VK_Invalid);
}
Modified: llvm/trunk/test/MC/ELF/relocation-386.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relocation-386.s?rev=117546&r1=117545&r2=117546&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/relocation-386.s (original)
+++ llvm/trunk/test/MC/ELF/relocation-386.s Thu Oct 28 09:48:59 2010
@@ -91,6 +91,14 @@
// CHECK-NEXT: ('r_sym', 0x0000000b)
// CHECK-NEXT: ('r_type', 0x00000013)
// CHECK-NEXT: ),
+
+// Relocation 11 (foo at 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 at GOTOFF(%ebx), %eax
@@ -113,6 +121,7 @@
addl foo at NTPOFF(%eax), %eax
addl foo at GOTNTPOFF(%ebx), %ecx
leal foo at TLSLDM(%ebx), %eax
+ leal foo at DTPOFF(%eax), %edx
.section .rodata.str1.16,"aMS", at progbits,1
.Lfoo:
More information about the llvm-commits
mailing list