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

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 23:09:12 PDT 2017


> On 13 Sep 2017, at 23:07, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Tue, Sep 12, 2017 at 10:42 PM Dean Michael Berris via Phabricator via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> 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 statement "unfortunately for in-lined functions where we're also generating the comdat definition for debugging purposes" is still confusing to me - I don't think this has anything to do with comdats.

Yes, I've updated the description. PTAL.

> 
> Indeed I think the test case you mentioned having had no inline functions at all - just that if type units are enabled and any debug types are emitted during endFunction, then that causes a switch to the debug_types section, rather than the text section. (most of the DWARF emission is delayed - we mostly don't switch to DWARF sections and produce DWARF bytes until the end of the module - except for type units, since they're whole/complete by themselves the moment we emit the type, so for those we do it immediately - causing section changes)
>  

That's correct. Please see the updated description?

> 
> 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 <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;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170913/9ae6870a/attachment.html>


More information about the llvm-commits mailing list