From 3a25d84a510c7aec668138960394c3d300259cae Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 9 Aug 2016 10:42:11 +0000 Subject: [PATCH] [XRay] Test for xray_instr_map in object file. (NFC) This makes a trivial change in the emission of the per-function XRay tables, and makes sure that the xray_instr_map section does show up in the object file. llvm-svn: 278113 --- llvm/lib/Target/X86/X86MCInstLower.cpp | 1 - llvm/test/CodeGen/X86/xray-section-group.ll | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp index 58033ee..e5e8fe7 100644 --- a/llvm/lib/Target/X86/X86MCInstLower.cpp +++ b/llvm/lib/Target/X86/X86MCInstLower.cpp @@ -1105,7 +1105,6 @@ void X86AsmPrinter::EmitXRayTable() { 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); diff --git a/llvm/test/CodeGen/X86/xray-section-group.ll b/llvm/test/CodeGen/X86/xray-section-group.ll index 9f7558f..7dab8c2 100644 --- a/llvm/test/CodeGen/X86/xray-section-group.ll +++ b/llvm/test/CodeGen/X86/xray-section-group.ll @@ -1,4 +1,6 @@ ; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu -function-sections < %s | FileCheck %s +; RUN: llc -filetype=obj -o %t -mtriple=x86_64-unknown-linux-gnu -function-sections < %s +; RUN: llvm-objdump -triple x86_64-unknown-linux-gnu -disassemble-all %t | FileCheck %s --check-prefix=CHECK-OBJ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" { ; CHECK: .section .text.foo,"ax",@progbits @@ -7,8 +9,10 @@ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" } $bar = comdat any -define i32 @comdat() nounwind noinline uwtable "function-instrument"="xray-always" comdat($bar) { -; CHECK: .section .text.comdat,"axG",@progbits,bar,comdat +define i32 @bar() nounwind noinline uwtable "function-instrument"="xray-always" comdat($bar) { +; CHECK: .section .text.bar,"axG",@progbits,bar,comdat ret i32 1 ; CHECK: .section xray_instr_map,"aG",@progbits,bar,comdat } + +; CHECK-OBJ: section xray_instr_map: -- 2.7.4