[XRay][clang+compiler-rt] Support build-time mode selection
authorDean Michael Berris <dberris@google.com>
Wed, 11 Apr 2018 01:28:25 +0000 (01:28 +0000)
committerDean Michael Berris <dberris@google.com>
Wed, 11 Apr 2018 01:28:25 +0000 (01:28 +0000)
commit826e666cc716ad4e731d0b6826d5b4d80727c49b
treef3cda763f52feb4359f70c13c71898c546057bde
parentee2c1dea4d9bb318da8af18d1bfadad8f7ce8013
[XRay][clang+compiler-rt] Support build-time mode selection

Summary:
This patch implements the `-fxray-modes=` flag which allows users
building with XRay instrumentation to decide which modes to pre-package
into the binary being linked. The default is the status quo, which will
link all the available modes.

For this to work we're also breaking apart the mode implementations
(xray-fdr and xray-basic) from the main xray runtime. This gives more
granular control of which modes are pre-packaged, and picked from
clang's invocation.

This fixes llvm.org/PR37066.

Note that in the future, we may change the default for clang to only
contain the profiling implementation under development in D44620, when
that implementation is ready.

Reviewers: echristo, eizan, chandlerc

Reviewed By: echristo

Subscribers: mgorny, mgrang, cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D45474

llvm-svn: 329772
clang/include/clang/Driver/Options.td
clang/include/clang/Driver/XRayArgs.h
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/XRayArgs.cpp
clang/test/Driver/XRay/xray-mode-flags.cpp [new file with mode: 0644]
compiler-rt/lib/xray/CMakeLists.txt
compiler-rt/lib/xray/tests/CMakeLists.txt