summaryrefslogtreecommitdiff
path: root/lib/profile
Commit message (Collapse)AuthorAgeFilesLines
* Revert "clang-misexpect: Profile Guided Validation of Performance ↵Dmitri Gribenko2019-09-112-185/+0
| | | | | | | | | | | | | | | | | | | Annotations in LLVM" This reverts commit r371584. It introduced a dependency from compiler-rt to llvm/include/ADT, which is problematic for multiple reasons. One is that it is a novel dependency edge, which needs cross-compliation machinery for llvm/include/ADT (yes, it is true that right now compiler-rt included only header-only libraries, however, if we allow compiler-rt to depend on anything from ADT, other libraries will eventually get used). Secondly, depending on ADT from compiler-rt exposes ADT symbols from compiler-rt, which would cause ODR violations when Clang is built with the profile library. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@371598 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-misexpect: Profile Guided Validation of Performance Annotations in LLVMPetr Hosek2019-09-112-0/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains the basic functionality for reporting potentially incorrect usage of __builtin_expect() by comparing the developer's annotation against a collected PGO profile. A more detailed proposal and discussion appears on the CFE-dev mailing list (http://lists.llvm.org/pipermail/cfe-dev/2019-July/062971.html) and a prototype of the initial frontend changes appear here in D65300 We revised the work in D65300 by moving the misexpect check into the LLVM backend, and adding support for IR and sampling based profiles, in addition to frontend instrumentation. We add new misexpect metadata tags to those instructions directly influenced by the llvm.expect intrinsic (branch, switch, and select) when lowering the intrinsics. The misexpect metadata contains information about the expected target of the intrinsic so that we can check against the correct PGO counter when emitting diagnostics, and the compiler's values for the LikelyBranchWeight and UnlikelyBranchWeight. We use these branch weight values to determine when to emit the diagnostic to the user. A future patch should address the comment at the top of LowerExpectIntrisic.cpp to hoist the LikelyBranchWeight and UnlikelyBranchWeight values into a shared space that can be accessed outside of the LowerExpectIntrinsic pass. Once that is done, the misexpect metadata can be updated to be smaller. In the long term, it is possible to reconstruct portions of the misexpect metadata from the existing profile data. However, we have avoided this to keep the code simple, and because some kind of metadata tag will be required to identify which branch/switch/select instructions are influenced by the use of llvm.expect Patch By: paulkirth Differential Revision: https://reviews.llvm.org/D66324 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@371584 91177308-0d34-0410-b5e6-96231b3b80d8
* compiler-rt: Fix warning if COMPILER_RT_HAS_FCNTL_LCK is 0Nico Weber2019-08-211-0/+1
| | | | | | | Fixes "warning: implicit declaration of function 'flock' is invalid in C99" for flock(). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@369534 91177308-0d34-0410-b5e6-96231b3b80d8
* [Fuchsia] Create the VMO during initialization, not during exitPetr Hosek2019-08-171-40/+53
| | | | | | | | | | | We want to avoid doing expensive work during atexit since the process might be terminated before we can publish the VMO and write out the symbolizer markup, so move the VMO creation to the initialization phase and only write data during the atexit phase. Differential Revision: https://reviews.llvm.org/D66323 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@369180 91177308-0d34-0410-b5e6-96231b3b80d8
* compiler-rt: Rename .cc file in lib/profile to .cppNico Weber2019-07-313-2/+2
| | | | | | | | See https://reviews.llvm.org/D58620 for discussion. Note how the comment in the file already said ".cpp" :) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@367460 91177308-0d34-0410-b5e6-96231b3b80d8
* gn build: Add build files for compiler-rt/lib/profileNico Weber2019-07-311-3/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D65518 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@367450 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] In Android, do not mkdir() dirs in GCOV_PREFIXPirama Arumuga Nainar2019-07-251-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In Android, attempting to mkdir() or even stat() top-level directories like /data causes noisy selinux denials. During whole-system coverage instrumentation, this causes a deluge of noisy messages that drown out legitimate selinux denials, that should be audited and fixed. To avoid this, skip creating any directory in GCOV_PREFIX (thereby assuming that it exists). - Android platform ensures that the GCOV_PREFIX used in Android is created and read/writable by all processes. - This only affects the Android platform (by checking against __ANDROID_API_FUTURE__) and for apps built with Clang coverage, the runtime will still create any non-existent parent directories for the coverage files. Reviewers: srhines, davidxl Subscribers: krytarowski, #sanitizers, danalbert, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65245 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@367064 91177308-0d34-0410-b5e6-96231b3b80d8
* (Reland with changes) Adding a function for setting coverage output file.Sajjad Mirza2019-06-244-13/+94
| | | | | | | | | | | | | | | | | | | | | | | Summary: User code can open a file on its own and pass it to the runtime, rather than specifying a name and having the runtime open the file. This supports the use case where a process cannot open a file on its own but can receive a file descriptor from another process. Relanding https://reviews.llvm.org/D62541. The original revision unlocked the file before calling flush, this revision fixes that. Reviewers: Dor1s, davidxl Reviewed By: Dor1s Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D63581 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@364231 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r362676 "[Profile]: Add runtime interface to specify file handle for ↵Hans Wennborg2019-06-124-94/+13
| | | | | | | | | | | | | | | profile data." This caused instrumented Clang to become crashy. See llvm-commits thread for repro steps. This also reverts follow-up r362716 which added test cases. > Author: Sajjad Mirza > > Differential Revision: http://reviews.llvm.org/D62541 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@363134 91177308-0d34-0410-b5e6-96231b3b80d8
* [Profile]: Add runtime interface to specify file handle for profile data.Xinliang David Li2019-06-064-13/+94
| | | | | | | | | Author: Sajjad Mirza Differential Revision: http://reviews.llvm.org/D62541 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@362676 91177308-0d34-0410-b5e6-96231b3b80d8
* This change adds an API to allow setting the flag to indicate that the ↵Max Moroz2019-05-202-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | profile data has been dumped to the file. Summary: The main use is for users to disable dumping profile data to the file for certain processes in case the processes don't have permission to write to the disks, and trying to do so would result in side effects such as crashes. Patch by Yuke Liao (@liaoyuke). Additional context (Chromium use case): - https://bugs.chromium.org/p/chromium/issues/detail?id=842424 - https://bugs.chromium.org/p/chromium/issues/detail?id=957655 - https://chromium-review.googlesource.com/c/chromium/src/+/1610093 Reviewers: Dor1s, vsk, davidxl Reviewed By: Dor1s, davidxl Subscribers: delcypher, davidxl, sajjadm, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D62078 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@361194 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some gcc warnings in compiler-rtNico Weber2019-05-101-1/+1
| | | | | | | | - Several "warning: extra ';' [-Wpedantic]" - One "C++ style comments are not allowed in ISO C90 [enabled by default]" in a file that uses C style comments everywhere but in one place git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@360430 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Set the ZX_VMO_RESIZABLE option for zx_vmo_createPetr Hosek2019-05-021-1/+1
| | | | | | | | | | | | | Currently VMO in Zircon create using the zx_vmo_create is resizable by default, but we'll be changing this in the future, requiring an explicit flag to make the VMO resizable. Prepare for this change by passing ZX_VMO_RESIZABLE option to all zx_vmo_create calls that need resizable VMO. Differential Revision: https://reviews.llvm.org/D61450 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359803 91177308-0d34-0410-b5e6-96231b3b80d8
* The error message for mismatched value sites is very cryptic.Dmitry Mikulin2019-04-232-6/+6
| | | | | | | | Make it more readable for an average user. Differential Revision: https://reviews.llvm.org/D60896 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359043 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland compiler-rt support for order file instrumentation.Manman Ren2019-03-087-0/+131
| | | | | | | | | | | | | | | | r355343 was landed and was reverted in r355363 due to build breakage. This patch adds Linux/Windows support on top of r355343. In this patch, Darwin should be working with testing case. Linux should be working, I will enable the testing case in a follwup diff. Windows/Other should be building. Correct implementation for Other platforms will be added. Thanks David for reviewing the original diff, helping me with issues on Linux, and giving suggestions for adding support for Other platforms. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355701 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert compiler-rt diffs for order file instrumentation to get bot green!Manman Ren2019-03-057-129/+0
| | | | | | | | | | This caused issues on Linux/Windows and other platforms. r355343 355350 355350 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355363 91177308-0d34-0410-b5e6-96231b3b80d8
* Attemp to fix windows profile-rt build breakage.Manman Ren2019-03-051-0/+1
| | | | | | | | Followup to D57530. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355357 91177308-0d34-0410-b5e6-96231b3b80d8
* Attemp to fix build brokage due to D57530.Manman Ren2019-03-043-0/+11
| | | | | | | | By adding implementations for __llvm_profile_begin_orderfile for non-Darwin platforms. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355350 91177308-0d34-0410-b5e6-96231b3b80d8
* Order File Instrumentation: dump the data in compiler-rtManman Ren2019-03-044-0/+117
| | | | | | | | | | The profile data will be dumped in a file default_xxx.profraw.order. Differential Revision: https://reviews.llvm.org/D57530 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355343 91177308-0d34-0410-b5e6-96231b3b80d8
* [PGO] Update InstrProfData.inc to sync with llvmRong Xu2019-02-281-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355119 91177308-0d34-0410-b5e6-96231b3b80d8
* [llvm-cov] Fix llvm-cov on Windows and un-XFAIL testReid Kleckner2019-02-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The llvm-cov tool needs to be able to find coverage names in the executable, so the .lprfn and .lcovmap sections cannot be merged into .rdata. Also, the linker merges .lprfn$M into .lprfn, so llvm-cov needs to handle that when looking up sections. It has to support running on both relocatable object files and linked PE files. Lastly, when loading .lprfn from a PE file, llvm-cov needs to skip the leading zero byte added by the profile runtime. Reviewers: vsk Subscribers: hiraditya, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58661 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354840 91177308-0d34-0410-b5e6-96231b3b80d8
* Set hidden attribute on lprofMergeValueProfDataAna Pazos2019-02-141-0/+1
| | | | | | | | | | | | | | | | | | | | | Summary: The changes in https://reviews.llvm.org/D44847 cause load time failure due to lprofMergeValueProfData in Android libs enabled with profile generation: "dlopen failed: cannot locate symbol "lprofMergeValueProfData" referenced by..." Marking lprofMergeValueProfData as hidden so the correct in-module definition is picked by the linker. Reviewers: davidxl Reviewed By: davidxl Subscribers: efriedma, xur, davidxl, llvm-commits Differential Revision: https://reviews.llvm.org/D55893 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354064 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Provide lprofGetHostName for all windows environmentsMartin Storsjo2019-02-131-1/+1
| | | | | | | | | This function doesn't use anything MSVC specific but works fine for any _WIN32 target. Differential Revision: https://reviews.llvm.org/D58106 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@353918 91177308-0d34-0410-b5e6-96231b3b80d8
* [InstrProf] Fix darwin errors after r353547Francis Visoiu Mistrih2019-02-081-8/+8
| | | | | | | | | | The macros were changed but not updated in the Darwin version. Fail here: http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/53739/ rdar://47925820 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@353560 91177308-0d34-0410-b5e6-96231b3b80d8
* [InstrProf] Implement static profdata registrationReid Kleckner2019-02-086-56/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The motivating use case is eliminating duplicate profile data registered for the same inline function in two object files. Before this change, users would observe multiple symbol definition errors with VC link, but links with LLD would succeed. Users (Mozilla) have reported that PGO works well with clang-cl and LLD, but when using LLD without this static registration, we would get into a "relocation against a discarded section" situation. I'm not sure what happens in that situation, but I suspect that duplicate, unused profile information was retained. If so, this change will reduce the size of such binaries with LLD. Now, Windows uses static registration and is in line with all the other platforms. Reviewers: davidxl, wmi, inglorion, void, calixte Subscribers: mgorny, krytarowski, eraman, fedor.sergeev, hiraditya, #sanitizers, dmajor, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D57929 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@353547 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence -Wformat warnings about GetLastError returning ULONGReid Kleckner2019-02-071-7/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@353485 91177308-0d34-0410-b5e6-96231b3b80d8
* [InstrProf] Merge COFF .lprof* and .lcovmap sections into .data/.rdataReid Kleckner2019-02-051-0/+9
| | | | | | | | | | | There is no reason for these sections to remain separate in the final DLL or EXE. I have not yet added a InstrProfilingPlatformWindows.c for these, since avoiding dynamic profile data registration is a larger project for later. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@353221 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1921-84/+63
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Sync up InstrProfData.inc with llvm copy /NFCRong Xu2019-01-151-10/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@351257 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for LLVM profile for NetBSDKamil Rytarowski2018-12-222-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Summary: NetBSD uses typical UNIX interfaces. All tests pass except instrprof-dlopen-dlclose-gcov.test, as there is not supported semantics of atexit(3) in dlopen(3)ed+dlclose(3)d DSO. NetBSD also ships an older version of LLVM profile (ABI v.2 predating ABI v.4 in upstream version) inside libc. That copy has been manually removed during the porting and testing process of the upstream version to NetBSD. Otherwise there were conflicts between them two. Reviewers: joerg, vitalybuka, vsk Subscribers: srhines, fedor.sergeev, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55997 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@349994 91177308-0d34-0410-b5e6-96231b3b80d8
* [GCOV] Close file mapping handle on Windows, so flushed gcda files can be ↵Marco Castelluccio2018-11-073-8/+57
| | | | | | removed while the process is in execution git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@346300 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Remove unused formal parameters from allocateOneNode. NFC.Matt Davis2018-10-091-3/+2
| | | | | | | | | | | | | | Summary: This is just a minor cleanup to the allocateOneNode interface. The formals are no-longer used, so I just removed them. Reviewers: davidxl, void Reviewed By: davidxl Subscribers: dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D52509 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@344073 91177308-0d34-0410-b5e6-96231b3b80d8
* [Windows] Include BaseTsd.h with lowercaseMartin Storsjo2018-09-101-1/+1
| | | | | | | | | | This fixes building on a case sensitive filesystem with mingw-w64 headers, where all headers are lowercase. This header actually also is named with a lowercase name in the Windows SDK as well. Differential Revision: https://reviews.llvm.org/D51877 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341857 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Add a routine to specify the mode used when creating profile dirs.Matt Davis2018-07-312-1/+16
| | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces `llvm_profile_set_dir_mode` and `llvm_profile_get_dir_mode` to the compiler-rt profile API. Originally, profile data was placed into a directory that was created with a hard-coded mode value of 0755 (for non-win32 builds). In certain cases, it can be helpful to create directories with a different mode other than 0755. This patch introduces set/get routines to allow users to specify a desired mode. The default remains at 0755. Reviewers: void, probinson Reviewed By: probinson Subscribers: probinson, dberris, cfe-commits Differential Revision: https://reviews.llvm.org/D49953 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@338456 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Support profiling runtime on FuchsiaPetr Hosek2018-07-256-1/+197
| | | | | | | | | | | | | This ports the profiling runtime on Fuchsia and enables the instrumentation. Unlike on other platforms, Fuchsia doesn't use files to dump the instrumentation data since on Fuchsia, filesystem may not be accessible to the instrumented process. We instead use the data sink to pass the profiling data to the system the same sanitizer runtimes do. Differential Revision: https://reviews.llvm.org/D47208 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337881 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Fix finding the first and last directory separators on Windows.Igor Kudrin2018-07-241-10/+8
| | | | | | | | | Until now, our code preferred backslashes to slashes, whereas Windows allows using both types of directory separators in one path string. Differential Revision: https://reviews.llvm.org/D49664 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337826 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Fix a possible memory leak in parseFilenamePattern().Igor Kudrin2018-07-241-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D49666 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337823 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Add interface to get profile filenameTeresa Johnson2018-07-192-12/+55
| | | | | | | | | | | | | | | | Summary: Add __llvm_profile_get_filename interface to get the profile filename, which can be used for identifying which profile file belongs to an app when multiple binaries are instrumented and dumping profiles into the same directory. The filename includes the path. Reviewers: davidxl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D49529 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337482 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix reading 32 bit gcov tag values on little-endian machinesMarco Castelluccio2018-07-111-1/+1
| | | | | | | | | | | | | | | | | Summary: The write buffer contains signed chars, which means the shift operations caused values such as the arc tag value (0x01a10000) to be read incorrectly (0xffa10000). This fixes a regression from https://reviews.llvm.org/D49132. Reviewers: uweigand, davidxl Reviewed By: uweigand Subscribers: llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49161 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336775 91177308-0d34-0410-b5e6-96231b3b80d8
* [gcov] Fix fallout from r336693Ulrich Weigand2018-07-101-1/+2
| | | | | | | | | Fix building GCDAProfiling.c with pre-C99 compilers. This caused a build bot failure. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336706 91177308-0d34-0410-b5e6-96231b3b80d8
* [gcov] Fix gcov profiling on big-endian machinesUlrich Weigand2018-07-101-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | Two fixes required to handle big-endian systems: - 64-bit counter values are stored in a mixed-endian format in the gcov files: a 32-bit low-part followed by a 32-bit high part. Note that this is already implemented correctly on the LLVM side, see GCOVBuffer::readInt64. - The tag values (e.g. arcs tag, object summary tag, ...) are aways written as the same sequence of bytes independent of byte order. But when *reading* them back in, the code reads them as 32-bit values in host byte order. For the comparisons to work correctly, this should instead always read them as little-endian values. Fixes PR 38121. Reviewed By: marco-c Differential Revision: https://reviews.llvm.org/D49132 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336693 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply "Make __gcov_flush flush counters for all shared libraries"Marco Castelluccio2018-07-101-69/+80
| | | | | | | | This reapplies r336365, after marking tests as failing on various configurations. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336678 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Add compiler-rt header files to the list of sources for targetsDan Liew2018-07-101-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when building with an IDE so that header files show up in the UI. This massively improves the development workflow in IDEs. To implement this a new function `compiler_rt_process_sources(...)` has been added that adds header files to the list of sources when the generator is an IDE. For non-IDE generators (e.g. Ninja/Makefile) no changes are made to the list of source files. The function can be passed a list of headers via the `ADDITIONAL_HEADERS` argument. For each runtime library a list of explicit header files has been added and passed via `ADDITIONAL_HEADERS`. For `tsan` and `sanitizer_common` a list of headers was already present but it was stale and has been updated to reflect the current state of the source tree. The original version of this patch used file globbing (`*.{h,inc,def}`) to find the headers but the approach was changed due to this being a CMake anti-pattern (if the list of headers changes CMake won't automatically re-generate if globbing is used). The LLVM repo contains a similar function named `llvm_process_sources()` but we don't use it here for several reasons: * It depends on the `LLVM_ENABLE_OPTION` cache variable which is not set in standalone compiler-rt builds. * We would have to `include(LLVMProcessSources)` which I'd like to avoid because it would include a bunch of stuff we don't need. Differential Revision: https://reviews.llvm.org/D48422 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336663 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Make __gcov_flush flush counters for all shared libraries"Michael Zolotukhin2018-07-071-80/+69
| | | | | | | This reverts r336365: the added tests are failing on various configurations (e.g. on green-dragon). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336474 91177308-0d34-0410-b5e6-96231b3b80d8
* Make __gcov_flush flush counters for all shared librariesMarco Castelluccio2018-07-051-69/+80
| | | | | | | | | | | | | | | | | Summary: This will make the behavior of __gcov_flush match the GCC behavior. I would like to rename __gcov_flush to __llvm_gcov_flush (in case of programs linking to libraries built with different compilers), but I guess we can't for compatibility reasons. Reviewers: davidxl Reviewed By: davidxl Subscribers: samsonov, vitalybuka, pcc, kcc, junbuml, glider, fhahn, eugenis, dvyukov, davidxl, srhines, chh, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D48538 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336365 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Add llvm_gcov_flush to be called outside a shared libraryChih-Hung Hsieh2018-06-291-0/+10
| | | | | | | | | | | __gcov_flush is hidden. For applications to dump profiling data of selected .so files, they can use dlsym to find and call llvm_gcov_flush in each .so file. Differential Revision: https://reviews.llvm.org/D45454 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336019 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Build shared version of runtimes for FuchsiaPetr Hosek2018-05-091-1/+1
| | | | | | | | | Fuchsia is no longer treated as UNIX which means we need to explicitly enable building of shared versions of runtimes. Differential Revision: https://reviews.llvm.org/D46609 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@331922 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix clang-cl warnings in compiler-rtReid Kleckner2018-04-231-1/+2
| | | | | | | | | The profile library was missing some includes and was erroneously using ftruncate. WinASan was using `= {0}` to initialize structs, which creates -Wmissing-field-initializers and -Wmissing-braces warnings with clang. Use `= {}` instead, since this is C++. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330616 91177308-0d34-0410-b5e6-96231b3b80d8
* [profile] Fix value profile runtime merging issuesRong Xu2018-04-026-18/+45
| | | | | | | | | | | | | | | | | This patch fixes the following issues: (1) The strong definition of the merge hook function was not working which breaks the online value profile merging. This patch removes the weak attribute of VPMergeHook and assigns the value dynamically. (2) Truncate the proifle file so that we don't have garbage data at the end of the file. (3) Add new __llvm_profile_instrument_target_value() interface to do the value profile update in batch. This is needed as the original incremental by 1 in __llvm_profile_instrument_target() is too slow for online merge. Differential Revision: https://reviews.llvm.org/D44847 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328987 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] fix trivial typos in commentsHiroshi Inoue2018-01-221-1/+1
| | | | | | | | "the the" -> "the" git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323080 91177308-0d34-0410-b5e6-96231b3b80d8