[mips][ias] Support .dtprel[d]word and .tprel[d]word directives
Assembler directives .dtprelword, .dtpreldword, .tprelword, and
.tpreldword generates relocations R_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL64,
R_MIPS_TLS_TPREL32, and R_MIPS_TLS_TPREL64 respectively.
The main motivation for this patch is to be able to write test cases
for checking correctness of the LLD linker's behaviour.
Differential Revision: https://reviews.llvm.org/D23669
llvm-svn: 279439
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index ed85f15..c471229 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -180,6 +180,11 @@
void EmitSLEB128Value(const MCExpr *Value) override;
+ void EmitDTPRel32Value(const MCExpr *Value) override;
+ void EmitDTPRel64Value(const MCExpr *Value) override;
+ void EmitTPRel32Value(const MCExpr *Value) override;
+ void EmitTPRel64Value(const MCExpr *Value) override;
+
void EmitGPRel64Value(const MCExpr *Value) override;
void EmitGPRel32Value(const MCExpr *Value) override;
@@ -856,6 +861,34 @@
EmitEOL();
}
+void MCAsmStreamer::EmitDTPRel64Value(const MCExpr *Value) {
+ assert(MAI->getDTPRel64Directive() != nullptr);
+ OS << MAI->getDTPRel64Directive();
+ Value->print(OS, MAI);
+ EmitEOL();
+}
+
+void MCAsmStreamer::EmitDTPRel32Value(const MCExpr *Value) {
+ assert(MAI->getDTPRel32Directive() != nullptr);
+ OS << MAI->getDTPRel32Directive();
+ Value->print(OS, MAI);
+ EmitEOL();
+}
+
+void MCAsmStreamer::EmitTPRel64Value(const MCExpr *Value) {
+ assert(MAI->getTPRel64Directive() != nullptr);
+ OS << MAI->getTPRel64Directive();
+ Value->print(OS, MAI);
+ EmitEOL();
+}
+
+void MCAsmStreamer::EmitTPRel32Value(const MCExpr *Value) {
+ assert(MAI->getTPRel32Directive() != nullptr);
+ OS << MAI->getTPRel32Directive();
+ Value->print(OS, MAI);
+ EmitEOL();
+}
+
void MCAsmStreamer::EmitGPRel64Value(const MCExpr *Value) {
assert(MAI->getGPRel64Directive() != nullptr);
OS << MAI->getGPRel64Directive();