This is an archive of the discontinued LLVM Phabricator instance.

[XRay][CodeGen] Use the current function symbol as the associated symbol for the instrumentation map
ClosedPublic

Authored by dberris on Sep 12 2017, 10:42 PM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

dberris created this revision.Sep 12 2017, 10:42 PM
dberris updated this revision to Diff 115167.Sep 13 2017, 10:52 PM
dberris edited the summary of this revision. (Show Details)
dberris added reviewers: dblaikie, echristo.

Reworded description, added a test.

pcc accepted this revision.Sep 13 2017, 11:16 PM

Perhaps simplify the test a little by requesting asm output and checking that the section directives are correct.

Lgtm otherwise.

This revision is now accepted and ready to land.Sep 13 2017, 11:16 PM
dberris updated this revision to Diff 115169.Sep 13 2017, 11:32 PM
  • fixup: simplify test to use asm instead; remove some unnecessary attributes and directives
dberris updated this revision to Diff 115170.Sep 13 2017, 11:38 PM
  • fixup: still test the generated object file
dberris updated this revision to Diff 115171.Sep 13 2017, 11:43 PM
dberris edited the summary of this revision. (Show Details)
dberris removed a subscriber: JDevlieghere.

Re-word to explain how we found the bug.

This revision was automatically updated to reflect the committed changes.