[PATCH] D37791: [XRay][CodeGen] Use the current function symbol as the associated symbol for the instrumentation map

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 22:42:10 PDT 2017


dberris created this revision.
Herald added a subscriber: aprantl.

XRay had been assuming that the previous section is the "text" section
of the function. Unfortunately for in-lined functions where we're also
generating the comdat definition for debugging purposes, we may be
coming from a section that isn't "text" (could be .zdebug_types).

This fixes an issue with combining -gsplit-dwarf and -fxray-instrument
for functions inlined, where the original definition may be lowered
into the debug sections. When the debug section is stripped, we're
left with references from the xray_instr_map to the debug section. The
change now uses the function's symbol instead of the previous
section's start symbol.


https://reviews.llvm.org/D37791

Files:
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp


Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2785,7 +2785,7 @@
   MCSection *InstMap = nullptr;
   MCSection *FnSledIndex = nullptr;
   if (MF->getSubtarget().getTargetTriple().isOSBinFormatELF()) {
-    auto Associated = dyn_cast<MCSymbolELF>(PrevSection->getBeginSymbol());
+    auto Associated = dyn_cast<MCSymbolELF>(CurrentFnSym);
     assert(Associated != nullptr);
     auto Flags = ELF::SHF_WRITE | ELF::SHF_ALLOC | ELF::SHF_LINK_ORDER;
     std::string GroupName;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37791.114973.patch
Type: text/x-patch
Size: 629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170913/5b22a964/attachment.bin>


More information about the llvm-commits mailing list