[PATCH] D54937: [mips] Fix TestDWARF32Version5Addr8AllForms test failure on MIPS hosts

Simon Atanasyan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 27 01:56:21 PST 2018


atanasyan created this revision.
atanasyan added reviewers: dblaikie, abeserminji, petarj, smaksimovic.
Herald added subscribers: jrtc27, JDevlieghere, arichardson, aprantl, sdardis.

The `DIEExpr` is used in debug information entries for either TLS variables or call sites. For now the last case is unsupported for targets with delay slots, for MIPS in particular.

The `DIEExpr::EmitValue` method calls a virtual `EmitDebugThreadLocal` routine which, in case of MIPS, always emits either `.dtprelword` or `.dtpreldword` directives. That is okay for "main" code, but in unit tests `DIEExpr` instances can be created not for TLS variables only even on MIPS hosts. That is a reason of the `TestDWARF32Version5Addr8AllForms` failure because handling of the `R_MIPS_TLS_DTPREL` relocation writes incorrect value into dwarf structures. And anyway unconditional emitting of `.dtprelword` directives will be incorrect when/if debug information entries for call sites become supported on MIPS.

The patch solves the problem by wrapping expression created in the `MipsTargetObjectFile::getDebugThreadLocalSymbol` method in to the `MipsMCExpr` expression with a new `MEK_DTPREL` tag. This tag is recognized in the `MipsAsmPrinter::EmitDebugThreadLocal` method and `.dtprelword` directives created in this case only. In other cases the expression saved as a regular data.


Repository:
  rL LLVM

https://reviews.llvm.org/D54937

Files:
  lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp
  lib/Target/Mips/MCTargetDesc/MipsMCExpr.h
  lib/Target/Mips/MipsAsmPrinter.cpp
  lib/Target/Mips/MipsTargetObjectFile.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54937.175420.patch
Type: text/x-patch
Size: 3498 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181127/e302c025/attachment.bin>


More information about the llvm-commits mailing list