[PATCH] D23104: [XRay] Set entsize for the xray_instr_map section

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 22:44:50 PDT 2016


dberris created this revision.
dberris added reviewers: echristo, majnemer.
dberris added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.

We also add a test to show what currently happens when we create a
section per function and emit an xray_instr_map. This illustrates the
relationship (or lack thereof) between the per-function section and the
xray_instr_map section.

This test also asserts that we're setting the correct expected entry
size for the instrumentation maps.

https://reviews.llvm.org/D23104

Files:
  lib/Target/X86/X86MCInstLower.cpp
  test/CodeGen/X86/xray-section-group.ll

Index: test/CodeGen/X86/xray-section-group.ll
===================================================================
--- /dev/null
+++ test/CodeGen/X86/xray-section-group.ll
@@ -0,0 +1,7 @@
+; 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,"aGM", at progbits,32,foo,comdat
+}
Index: lib/Target/X86/X86MCInstLower.cpp
===================================================================
--- lib/Target/X86/X86MCInstLower.cpp
+++ lib/Target/X86/X86MCInstLower.cpp
@@ -1098,7 +1098,7 @@
   if (Subtarget->isTargetELF()) {
     auto *Section = OutContext.getELFSection(
         "xray_instr_map", ELF::SHT_PROGBITS,
-        ELF::SHF_ALLOC | ELF::SHF_GROUP | ELF::SHF_MERGE, 0,
+        ELF::SHF_ALLOC | ELF::SHF_GROUP | ELF::SHF_MERGE, 32,
         CurrentFnSym->getName());
     auto PrevSection = OutStreamer->getCurrentSectionOnly();
     OutStreamer->SwitchSection(Section);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23104.66614.patch
Type: text/x-patch
Size: 1099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160803/ffb17f83/attachment.bin>


More information about the llvm-commits mailing list