From: Peter Smith Date: Tue, 19 Jul 2016 14:15:33 +0000 (+0000) Subject: Add support for tlsldm assembler operator to ARM target X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cbcecca538e380ead0b07bb2549e262e2458f54d;p=platform%2Fupstream%2Fllvm.git Add support for tlsldm assembler operator to ARM target The standard local dynamic model for TLS on ARM systems needs two relocations: - R_ARM_TLS_LDM32 (module idx) - R_ARM_TLS_LDO32 (offset of object from origin of module TLS block) In GNU style assembler we use symbol(tlsldm) and symbol(tlsldo) to produce these relocations. llvm-mc for ARM supports symbol(tlsldo) but does not support symbol(tlsldm). This patch wires up the existing symbol(tlsldm) to R_ARM_TLS_LDM32. TLS for ARM is defined in Addenda to, and Errata in, the ABI for the ARM Architecture Differential Revision: https://reviews.llvm.org/D22461 llvm-svn: 275977 --- diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp index 4118fe8..bb562df 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp @@ -221,6 +221,9 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target, case MCSymbolRefExpr::VK_TLSDESC: Type = ELF::R_ARM_TLS_GOTDESC; break; + case MCSymbolRefExpr::VK_TLSLDM: + Type = ELF::R_ARM_TLS_LDM32; + break; case MCSymbolRefExpr::VK_ARM_TLSDESCSEQ: Type = ELF::R_ARM_TLS_DESCSEQ; break; diff --git a/llvm/test/MC/ARM/symbol-variants.s b/llvm/test/MC/ARM/symbol-variants.s index c5419058..96fa180 100644 --- a/llvm/test/MC/ARM/symbol-variants.s +++ b/llvm/test/MC/ARM/symbol-variants.s @@ -90,8 +90,14 @@ bl f05(plt) @CHECK: 68 R_ARM_PREL31 f26 @CHECK: 6c R_ARM_PREL31 f27 +@ tlsldm +.word f28(TLSLDM) +.word f29(tlsldm) +@CHECK: 70 R_ARM_TLS_LDM32 f28 +@CHECK: 74 R_ARM_TLS_LDM32 f29 + @ got_prel -.word f28(GOT_PREL) + (. - .Lsym) - ldr r3, =f29(GOT_PREL) -@ CHECK: 70 R_ARM_GOT_PREL f28 -@ CHECK: 78 R_ARM_GOT_PREL f29 +.word f30(GOT_PREL) + (. - .Lsym) + ldr r3, =f31(GOT_PREL) +@ CHECK: 78 R_ARM_GOT_PREL f30 +@ CHECK: 80 R_ARM_GOT_PREL f31