summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-09-14 07:08:23 +0000
committerDean Michael Berris <dberris@google.com>2017-09-14 07:08:23 +0000
commit01fd7c8bd4fb3385215bff758b0bf68f179e842b (patch)
tree5011a57d546211e2955c54ddc93ff7067684cded /llvm/lib/CodeGen
parent0fd7c5ccd6a15198c0cce4e8b83728ede7b7c7e4 (diff)
downloadbcm5719-llvm-01fd7c8bd4fb3385215bff758b0bf68f179e842b.tar.gz
bcm5719-llvm-01fd7c8bd4fb3385215bff758b0bf68f179e842b.zip
[XRay][CodeGen] Use the current function symbol as the associated symbol for the instrumentation map
Summary: XRay had been assuming that the previous section is the "text" section of the function when lowering the instrumentation map. Unfortunately this is not a safe assumption, because we may be coming from lowering debug type information for the function being lowered. This fixes an issue with combining -gsplit-dwarf, -generate-type-units, -debug-compile and -fxray-instrument for sole member functions. When the split dwarf 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. We found the bug while attempting to strip the split debug sections off an XRay-instrumented object file, which had a peculiar edge-case for single-function classes where the single function is being lowered. Because XRay had assocaited the instrumentation map for a function to the debug types section instead of the function's section, the objcopy call will fail due to the misplaced reference from the xray_instr_map section. Reviewers: pcc, dblaikie, echristo Subscribers: llvm-commits, aprantl Differential Revision: https://reviews.llvm.org/D37791 llvm-svn: 313233
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 87399354945..ee5cb35fa9d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2785,7 +2785,7 @@ void AsmPrinter::emitXRayTable() {
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;
OpenPOWER on IntegriCloud