summaryrefslogtreecommitdiff
path: root/lib/profile/CMakeLists.txt
AgeCommit message (Collapse)Author
2017-12-14[profile] Port the runtime to Solaris (retry)Vedant Kumar
This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Hopefully the Windows support is fixed now. Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320731 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14Revert "(HEAD -> master, origin/master, origin/HEAD) [profile] Port the ↵Vedant Kumar
runtime to Solaris" This reverts commit r320726. It looks like flock isn't available on Windows: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21317/steps/build%20compiler-rt/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320728 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[profile] Port the runtime to SolarisVedant Kumar
This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320726 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-29[profile] Move __llvm_profile_filename into a separate objectVedant Kumar
Users can specify the path a raw profile is written to by passing -fprofile-instr-generate=<path>, but this functionality broke on Darwin after __llvm_profile_filename was made weak [1], resulting in profiles being written to "default.profraw" even when <path> is specified. The situation is that instrumented programs provide a weak definition of __llvm_profile_filename, which conflicts with a weak redefinition provided by the profiling runtime. The linker appears to pick the 'winning' definition arbitrarily: on Darwin, it usually prefers the larger definition, which is probably why the instrprof-override-filename.c test has been passing. The fix is to move the runtime's definition into a separate object file within the archive. This means that the linker won't "see" the runtime's definition unless the user program has not provided one. I couldn't think of a great way to test this other than to mimic the Darwin failure: use -fprofile-instr-generate=<some-small-path>. Testing: check-{clang,profile}, modified instrprof-override-filename.c. [1] [Profile] deprecate __llvm_profile_override_default_filename https://reviews.llvm.org/D22613 https://reviews.llvm.org/D22614 Differential Revision: https://reviews.llvm.org/D34797 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@306710 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[CMake] Connect Compiler-RT targets to LLVM Runtimes directoryChris Bieneman
This patch builds on LLVM r279776. In this patch I've done some cleanup and abstracted three common steps runtime components have in their CMakeLists files, and added a fourth. The three steps I abstract are: (1) Add a top-level target (i.e asan, msan, ...) (2) Set the target properties for sorting files in IDE generators (3) Make the compiler-rt target depend on the top-level target The new step is to check if a command named "runtime_register_component" is defined, and to call it with the component name. The runtime_register_component command is defined in llvm/runtimes/CMakeLists.txt, and presently just adds the component to a list of sub-components, which later gets used to generate target mappings. With this patch a new workflow for runtimes builds is supported. The new workflow when building runtimes from the LLVM runtimes directory is: > cmake [...] > ninja runtimes-configure > ninja asan The "runtimes-configure" target builds all the dependencies for configuring the runtimes projects, and runs CMake on the runtimes projects. Running the runtimes CMake generates a list of targets to bind into the top-level CMake so subsequent build invocations will have access to some of Compiler-RT's targets through the top-level build. Note: This patch does exclude some top-level targets from compiler-rt libraries because they either don't install files (sanitizer_common), or don't have a cooresponding `check` target (stats). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279863 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11[compiler-rt] Fix VisualStudio virtual folders layoutEtienne Bergeron
Summary: This patch is a refactoring of the way cmake 'targets' are grouped. It won't affect non-UI cmake-generators. Clang/LLVM are using a structured way to group targets which ease navigation through Visual Studio UI. The Compiler-RT projects differ from the way Clang/LLVM are grouping targets. This patch doesn't contain behavior changes. Reviewers: kubabrecka, rnk Subscribers: wang0109, llvm-commits, kubabrecka, chrisha Differential Revision: http://reviews.llvm.org/D21952 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275111 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17Fix most MSVC warnings in compiler-rt profiling libraryReid Kleckner
Here's the warnings and how they were fixed: - InstrProfilingUtil.c(110): warning C4013: '_open_osfhandle' undefined; assuming extern returning int Include io.h to get the prototype. - warning C4005: 'FILE_MAP_EXECUTE': macro redefinition Stop trying to support pre-XP versions of Windows, don't attempt to define this macro. - InstrProfilingWriter.c(271): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Header' - InstrProfilingWriter.c(275): warning C4221: nonstandard extension used: 'Data': cannot be initialized using address of automatic variable 'Zeroes' Turn this warning off. This is definitely legal in C++, all compilers accept it, and I only have room for half of one language standard in my brain. - InstrProfilingValue.c(320): warning C4113: 'uint32_t (__cdecl *)()' differs in parameter lists from 'uint32_t (__cdecl *)(void)' Fix this with an explicit (void) in the prototype. - InstrProfilingMerge.c.obj : warning LNK4006: _VPMergeHook already defined in InstrProfilingMergeFile.c.obj; second definition ignored Last remaining warning. This is from linking a selectany definition with a strong definition. We need to sort out weak symbols in compiler-rt in general, though. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273026 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08[profile] Pass extra build flags (feature enabling macros) to Darwin buildXinliang David Li
Differential Revision: http://reviews.llvm.org/D21119 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272162 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06[profile] in-process mergeing support (part-2)Xinliang David Li
(Part-1 merging API is in profile runtime) This patch implements a portable file opening API with exclusive access for the process. In-process profile merge requires profile file update to be atomic/fully sychronized. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03[PGO] Add API for profile merge from bufferXinliang David Li
Differential Revision: http://reviews.llvm.org/D17831 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262644 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-08profile: Do not pass -fPIC on Windows.Peter Collingbourne
Unbreaks clang-cl build (cl warns on this flag, clang-cl errors on it). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257136 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-06[compiler-rt] Fix empty translation unit warningNathan Slingerland
Change to not compile in WindowsMMap.c on anything except WIN32. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@256947 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-05[PGO] Enable building compiler-rt profile support library on WindowsNathan Slingerland
Summary: This change configures Windows builds to build the complier-rt profile support library (clang_rt.profile-i386.lib). Windows API incompatibilities in the compiler-rt profile lib are also fixed. Reviewers: davidxl, dnovillo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15830 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@256848 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-10[PGO] Split value profiling runtime into its own fileXinliang David Li
Value profile runtime depends on libc which breaks buffer API implemenation with current file organization. Test case is also updated to check more symbols. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255294 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-09[PGO] Add cmake check to determine atomics op availabilityXinliang David Li
This allows the profile runtime to pick the right impl for cmp&swap for a given target. Differential Revision: http://reviews.llvm.org/D15248 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255173 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18[PGO] Refactor File and Buffer API profile writing codeXinliang David Li
With this change, Buffer API and File API implementations are unified. Differential Revision: http://reviews.llvm.org/D14692 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253500 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13[PGO] Ensure profile section symbols are created (linux)Xinliang David Li
- This is to handle a corner case where profile lib is linked in but non of the modules are instrumented (On linux, since we avoided the overhead to emit runtime hook use functions so this is the side effect of that size optimization). - Added a profile runtime test case to cover all scenarios of shared library builds. Differential Revision: http://reviews.llvm.org/D14468 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253098 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10Rollback 252570 for further investigationXinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@252575 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10[PGO] Add LLVM main include dir to profile runtime buildXinliang David Li
Runtime code implicitly depends on the defintions and const values defined in LLVM proper, but currently such dependency is made implicitly by duplicating code across two dirs. As part of the PGO cleanup effort, there will be changes to share common sources. This is a preparation patch to enable it (NFC). Differential Revision: http://reviews.llvm.org/D14487 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@252570 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13[PGO]: Eliminate calls to __llvm_profile_register_function for Linux.Xinliang David Li
On Linux, the profile runtime can use __start_SECTNAME and __stop_SECTNAME symbols defined by the linker to locate the start and end location of a named section (with C name). This eliminates the need for instrumented binary to call __llvm_profile_register_function during start-up time. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@250200 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-30[CMake] [Darwin] Add and populate PROFILE_SUPPORTED_OS to enable building ↵Chris Bieneman
libclang_rt.profile for iOS. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@248948 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25[CMake] merge add_compiler_rt_runtime and add_compiler_rt_darwin_runtime ↵Chris Bieneman
into a single function Summary: This refactoring moves much of the Apple-specific behavior into a function in AddCompilerRT. The next cleanup patch will remove more of the if(APPLE) checks in the outlying CMakeLists. This patch adds a bunch of new functionality to add_compiler_rt_runtime so that the target names don't need to be reconstructed outside the call. It also updates some of the call sites to exercise the new functionality, but does not update all uses fully. Subsequent patches will further update call sites and move to using the new features. Reviewers: filcab, bogner, kubabrecka, zaks.anna, glider, samsonov Subscribers: beanz, rengolin, llvm-commits Differential Revision: http://reviews.llvm.org/D12292 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@245970 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18[CMake] Backing out part of r245317. Turns out safestack and profile don't ↵Chris Bieneman
work correctly on the iOS simulator and enabling it breaks tests. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@245326 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18[CMake] Refactoring add_compiler_rt functions for darwin runtimes.Chris Bieneman
Summary: This patch consolidates add_compiler_rt_osx_static_runtime and add_compiler_rt_darwin_dynamic_runtime into a single new function add_compiler_rt_darwin_runtime. Reviewers: filcab, samsonov, bogner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12106 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@245317 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09Add support for generating profiles in a given directory.Diego Novillo
When the file is initialized, this patch checks whether the path specifies a directory. If so, it creates the directory tree before truncating the file. Use default.profdata instead of pgo-data for default indexed profile name. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@241824 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-19CMake: Stop using LLVM's custom parse_arguments. NFCFilipe Cabecinhas
Summary: Use CMake's cmake_parse_arguments() instead. It's called in a slightly different way, but supports all our use cases. It's in CMake 2.8.8, which is our minimum supported version. CMake 3.0 doc (roughly the same. No direct link to 2.8.8 doc): http://www.cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html?highlight=cmake_parse_arguments Since I was already changing these calls, I changed ARCH and LIB into ARCHS and LIBS to make it more clear that they're lists of arguments. Reviewers: eugenis, samsonov, beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10529 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@240120 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14[Profile] Always build profile runtime library with -fPIC.Alexey Samsonov
This change removes libclang_rt.profile-pic-<arch>.a version of profile runtime. Instead, it's sufficient to always build libclang_rt.profile-<arch>.a with -fPIC, as it can be linked into both executables and shared objects. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221952 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-16InstrProf: Create a PIC version of the profile runtimeDuncan P. N. Exon Smith
These tests were XPASS-ing on Linux bots creating Mach-O, which makes sense, since the real difference is the object format. I'm hoping a short-term fix to get these tests passing on ELF is to create two copies of the runtime -- one built with -fPIC, and one without. A follow-up patch will change clang's driver to pick between them depending on whether `-shared` is specified. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208947 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-22[profile] Flatten profile runtime - define platform-specific code in ↵Alexey Samsonov
sources, not in the build system git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206915 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31InstrProf: Add simple compiler-rt testDuncan P. N. Exon Smith
Add the test infrastructure for testing lib/profile and a single test. This initial commit only enables the tests on Darwin, but they'll be enabled on Linux soon after. <rdar://problem/16458307> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@205256 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31[CMake] Rename add_compiler_rt_static_runtime to add_compiler_rt_runtime.Alexey Samsonov
Soon there will be an option to build compiler-rt parts as shared libraries on Linux. Extracted from http://llvm-reviews.chandlerc.com/D3042 by Yuri Gribov. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@205183 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21InstrProf: Reorganize files; no functionality changeDuncan P. N. Exon Smith
Move functions around to prepare for some other changes. - Merge InstrProfilingExtras.h with InstrProfiling.h. There's no benefit to having these split. - Rename InstrProfilingExtras.c to InstrProfilingFile.c. - Split actual buffer writing code out of InstrProfiling.c into InstrProfilingBuffer.c. - Drive-by corrections of a couple of header comments. <rdar://problem/15943240> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204497 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20PGO: Add explicit static initializationDuncan P. N. Exon Smith
Instead of relying on explicit static initialization from translation units, create a new file, InstrProfilingRuntime.cc, with an __llvm_pgo_runtime variable. After this commit (and its pair in clang), the driver will create a use of this variable. Unless the user defines their own version, the new object file will get pulled in, including that C++ static initialization that calls __llvm_pgo_register_write_atexit. The result is that, at least on Darwin, static initialization typically consists of a single function call, which registers a writeout functino atexit. Furthermore, users can skip even this behaviour by defining their own __llvm_pgo_runtime. <rdar://problem/15943240> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204380 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20PGO: Moving files for clarityDuncan P. N. Exon Smith
<rdar://problem/15943240> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204373 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20PGO: Implement Darwin linker magic for instrumentationDuncan P. N. Exon Smith
Use Darwin linker magic to find bounds of instrumentation data sections at link time instead of runtime. <rdar://problem/15943240> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204302 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20PGO: Split out initialization of section boundsDuncan P. N. Exon Smith
Currently we register instrumentation data at runtime to determine the bounds of the sections where the data lives. Soon we'll implement platform-specific linker magic to determine this at link time. Move this logic to a separate file, so that our build system can choose the correct platform-specific code. No functionality change intended. <rdar://problem/15943240> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204299 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-19PGO: Splitting implementation files; no functionality changeDuncan P. N. Exon Smith
Split implementation files along a uses-libc/shouldn't-use-libc boundary. - InstrProfiling.h is a shared header. - InstrProfiling.c provides an API to extract profiling data from the runtime, but avoids the use of libc. Currently this is a lie: __llvm_pgo_write_buffer() uses `FILE*` and related functions. It will be updated soon to write to a `char*` buffer instead. - InstrProfilingExtras.c provides a more convenient API for interfacing with the profiling runtime, but has logic that does (and will continue to) use libc. <rdar://problem/15943240> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204268 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-18[CMake] Add top-level target for each compiler-rt library, and add ↵Alexey Samsonov
'compiler-rt' target encompassing them all. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201556 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-31Enable compilation of RT on ARMRenato Golin
Adding the ARM RT sources to the CMake files, and enabling some sanitizers to also build on ARM. This is far from supported or production quality, but enabling it to build will get us errors that we can actually fix. Having said that, the Compiler-RT and the Asan libraries are know to work on some variations of ARM. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200546 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-06profile: Rudimentary suppport for PGO instrumentationJustin Bogner
This is fairly minimal support for instrumentation based PGO. The data format is inefficient, and the output file name is hardcoded to pgo-data. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@198638 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-25Remove the sysroot restriction from building GCDAProfiling.c.Chandler Carruth
We really need the C standard library to be available to implement the profiling runtime library reasonably, and replicating everything in the SDKs tree really isn't addressing any problems we have. Notably, all of the sanitizer runtimes take the same approach, and this isn't a library which could end up in a bootstrapping problem where the system headers aren't even available. This will hopefully prevent subsequent changes which start using various other bits of C standard library to make things more debuggable. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@184798 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-25Add basic support for building profile compiler-rt library in CMake build on ↵Alexey Samsonov
Darwin git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177870 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19Don't use --sysroot to linux SDK when building libprofile - SDK on Linux ↵Alexey Samsonov
seems to be incomplete. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177396 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19Support CMake build of profile runtime library on LinuxAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177382 91177308-0d34-0410-b5e6-96231b3b80d8