This is an archive of the discontinued LLVM Phabricator instance.

[XRay][compiler-rt] Disable XRay instrumentation of the XRay runtime.
ClosedPublic

Authored by dberris on Nov 13 2016, 9:42 PM.

Details

Summary

Adds a CMake check for whether the compiler used to build the XRay
library supports XRay-instrumentation. If the compiler we're using does
support the -fxray-instrument flag (i.e. recently-built Clang), we
define the XRAY_NEVER_INSTRUMENT macro that then makes sure that the
XRay runtime functions never get XRay-instrumented.

This prevents potential weirdness involved with building the XRay
library with a Clang that supports XRay-instrumentation, and is
attempting to XRay-instrument the build of compiler-rt.

Diff Detail

Repository
rL LLVM

Event Timeline

dberris updated this revision to Diff 77768.Nov 13 2016, 9:42 PM
dberris retitled this revision from to [XRay][compiler-rt] Disable XRay instrumentation of the XRay runtime..
dberris updated this object.
dberris added reviewers: majnemer, rSerge, echristo.
dberris added a subscriber: llvm-commits.
rSerge added inline comments.Nov 14 2016, 9:38 AM
cmake/builtin-config-ix.cmake
14 ↗(On Diff #77768)

Is this a check that the host compiler (not the one being compiled) supports XRay instrumentation? A comment would help.

lib/xray/xray_arm.cc
74–76 ↗(On Diff #77768)

The function header could take only 2 lines if the second line starts after a single indentation (2 spaces). Is it a LLVM requirement to indent so much when a function header doesn't fit 1 line?

rSerge added inline comments.Nov 14 2016, 10:25 AM
lib/xray/xray_defs.h
16 ↗(On Diff #77768)

I prefer to avoid double negation because it's harder to read. Can you change this to ifdef and swap the bodies?

dberris updated this revision to Diff 77943.Nov 14 2016, 9:53 PM
dberris marked 3 inline comments as done.
  • Address review comments

PTAL

cmake/builtin-config-ix.cmake
14 ↗(On Diff #77768)

Is this a check that the host compiler (not the one being compiled) supports XRay instrumentation? A comment would help.

It's exactly the same as the ones it's grouped with, documentation on the builtin_check_c_compiler_flag macro says this too.

lib/xray/xray_arm.cc
74–76 ↗(On Diff #77768)

I just follow what clang-format does. :)

rSerge accepted this revision.Nov 15 2016, 5:25 AM
rSerge edited edge metadata.
This revision is now accepted and ready to land.Nov 15 2016, 5:25 AM
This revision was automatically updated to reflect the committed changes.