[PATCH] D23104: [XRay] Make the xray_instr_map section specification more correct
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 3 00:29:44 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL277580: [XRay] Make the xray_instr_map section specification more correct (authored by dberris).
Changed prior to commit:
https://reviews.llvm.org/D23104?vs=66621&id=66624#toc
Repository:
rL LLVM
https://reviews.llvm.org/D23104
Files:
llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
llvm/trunk/test/CodeGen/X86/xray-section-group.ll
Index: llvm/trunk/test/CodeGen/X86/xray-section-group.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/xray-section-group.ll
+++ llvm/trunk/test/CodeGen/X86/xray-section-group.ll
@@ -0,0 +1,14 @@
+; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu -function-sections < %s | FileCheck %s
+
+define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" {
+; CHECK: .section .text.foo,"ax", at progbits
+ ret i32 0
+; CHECK: .section xray_instr_map,"a", at progbits
+}
+
+$bar = comdat any
+define i32 @comdat() nounwind noinline uwtable "function-instrument"="xray-always" comdat($bar) {
+; CHECK: .section .text.comdat,"axG", at progbits,bar,comdat
+ ret i32 1
+; CHECK: .section xray_instr_map,"aG", at progbits,bar,comdat
+}
Index: llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
@@ -1096,11 +1096,18 @@
if (Sleds.empty())
return;
if (Subtarget->isTargetELF()) {
- auto *Section = OutContext.getELFSection(
- "xray_instr_map", ELF::SHT_PROGBITS,
- ELF::SHF_ALLOC | ELF::SHF_GROUP | ELF::SHF_MERGE, 0,
- CurrentFnSym->getName());
auto PrevSection = OutStreamer->getCurrentSectionOnly();
+ auto Fn = MF->getFunction();
+ MCSection *Section = nullptr;
+ if (Fn->hasComdat()) {
+ Section = OutContext.getELFSection("xray_instr_map", ELF::SHT_PROGBITS,
+ ELF::SHF_ALLOC | ELF::SHF_GROUP, 0,
+ Fn->getComdat()->getName());
+ OutStreamer->SwitchSection(Section);
+ } else {
+ Section = OutContext.getELFSection("xray_instr_map", ELF::SHT_PROGBITS,
+ ELF::SHF_ALLOC);
+ }
OutStreamer->SwitchSection(Section);
for (const auto &Sled : Sleds) {
OutStreamer->EmitSymbolValue(Sled.Sled, 8);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23104.66624.patch
Type: text/x-patch
Size: 2025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160803/311b25fc/attachment.bin>
More information about the llvm-commits
mailing list