Skip to content

Commit 12cd91c

Browse files
committed
Merge clang, llvm, lld, lldb, compiler-rt and libc++ 5.0.0 release.
MFC r309126 (by emaste): Correct lld llvm-tblgen dependency file name MFC r309169: Get rid of separate Subversion mergeinfo properties for llvm-dwarfdump and llvm-lto. The mergeinfo confuses Subversion enormously, and these directories will just use the mergeinfo for llvm itself. MFC r312765: Pull in r276136 from upstream llvm trunk (by Wei Mi): Use ValueOffsetPair to enhance value reuse during SCEV expansion. In D12090, the ExprValueMap was added to reuse existing value during SCEV expansion. However, const folding and sext/zext distribution can make the reuse still difficult. A simplified case is: suppose we know S1 expands to V1 in ExprValueMap, and S1 = S2 + C_a S3 = S2 + C_b where C_a and C_b are different SCEVConstants. Then we'd like to expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is helpful when S2 is a complex SCEV expr and S2 has no entry in ExprValueMap, which is usually caused by the fact that S3 is generated from S1 after const folding. In order to do that, we represent ExprValueMap as a mapping from SCEV to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a} into the ExprValueMap when we create SCEV for V1. When S3 is expanded, it will first expand S2 to V1 - C_a because of S2->{V1, C_a} in the map, then expand S3 to V1 - C_a + C_b. Differential Revision: https://reviews.llvm.org/D21313 This should fix assertion failures when building OpenCV >= 3.1. PR: 215649 MFC r312831: Revert r312765 for now, since it causes assertions when building lang/spidermonkey24. Reported by: antoine PR: 215649 MFC r316511 (by jhb): Add an implementation of __ffssi2() derived from __ffsdi2(). Newer versions of GCC include an __ffssi2() symbol in libgcc and the compiler can emit calls to it in generated code. This is true for at least GCC 6.2 when compiling world for mips and mips64. Reviewed by: jmallett, dim Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D10086 MFC r318601 (by adrian): [libcompiler-rt] add bswapdi2/bswapsi2 This is required for mips gcc 6.3 userland to build/run. Reviewed by: emaste, dim Approved by: emaste Differential Revision: https://reviews.freebsd.org/D10838 MFC r318884 (by emaste): lldb: map TRAP_CAP to a trace trap In the absense of a more specific handler for TRAP_CAP (generated by ENOTCAPABLE or ECAPMODE while in capability mode) treat it as a trace trap. Example usage (testing the bug in PR219173): % proccontrol -m trapcap lldb usr.bin/hexdump/obj/hexdump -- -Cv -s 1 /bin/ls ... (lldb) run Process 12980 launching Process 12980 launched: '.../usr.bin/hexdump/obj/hexdump' (x86_64) Process 12980 stopped * thread #1, stop reason = trace frame #0: 0x0000004b80c65f1a libc.so.7`__sys_lseek + 10 ... In the future we should have LLDB control the trapcap procctl itself (as it does with ASLR), as well as report a specific stop reason. This change eliminates an assertion failure from LLDB for now. MFC r319796: Remove a few unneeded files from libllvm, libclang and liblldb. MFC r319885 (by emaste): lld: ELF: Fix ICF crash on absolute symbol relocations. If two sections contained relocations to absolute symbols with the same value we would crash when trying to access their sections. Add a check that both symbols point to sections before accessing their sections, and treat absolute symbols as equal if their values are equal. Obtained from: LLD commit r292578 MFC r319918: Revert r319796 for now, it can cause undefined references when linking in some circumstances. Reported by: Shawn Webb <[email protected]> MFC r319957 (by emaste): lld: Add armelf emulation mode Obtained from: LLD r305375 MFC r321369: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 5.0.0 (trunk r308421). Upstream has branched for the 5.0.0 release, which should be in about a month. Please report bugs and regressions, so we can get them into the release. Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11 support to build; see UPDATING for more information. MFC r321420: Add a few more object files to liblldb, which should solve errors when linking the lldb executable in some cases. In particular, when the -ffunction-sections -fdata-sections options are turned off, or ineffective. Reported by: Shawn Webb, Mark Millard MFC r321433: Cleanup stale Options.inc files from the previous libllvm build for clang 4.0.0. Otherwise, these can get included before the two newly generated ones (which are different) for clang 5.0.0. Reported by: Mark Millard MFC r321439 (by bdrewery): Move llvm Options.inc hack from r321433 for NO_CLEAN to lib/clang/libllvm. The files are only ever generated to .OBJDIR, not to WORLDTMP (as a sysroot) and are only ever included from a compilation. So using a beforebuild target here removes the file before the compilation tries to include it. MFC r321664: Pull in r308891 from upstream llvm trunk (by Benjamin Kramer): [CodeGenPrepare] Cut off FindAllMemoryUses if there are too many uses. This avoids excessive compile time. The case I'm looking at is Function.cpp from an old version of LLVM that still had the giant memcmp string matcher in it. Before r308322 this compiled in about 2 minutes, after it, clang takes infinite* time to compile it. With this patch we're at 5 min, which is still bad but this is a pathological case. The cut off at 20 uses was chosen by looking at other cut-offs in LLVM for user scanning. It's probably too high, but does the job and is very unlikely to regress anything. Fixes PR33900. * I'm impatient and aborted after 15 minutes, on the bug report it was killed after 2h. Pull in r308986 from upstream llvm trunk (by Simon Pilgrim): [X86][CGP] Reduce memcmp() expansion to 2 load pairs (PR33914) D35067/rL308322 attempted to support up to 4 load pairs for memcmp inlining which resulted in regressions for some optimized libc memcmp implementations (PR33914). Until we can match these more optimal cases, this patch reduces the memcmp expansion to a maximum of 2 load pairs (which matches what we do for -Os). This patch should be considered for the 5.0.0 release branch as well Differential Revision: https://reviews.llvm.org/D35830 These fix a hang (or extremely long compile time) when building older LLVM ports. Reported by: antoine PR: 219139 MFC r321719: Pull in r309503 from upstream clang trunk (by Richard Smith): PR33902: Invalidate line number cache when adding more text to existing buffer. This led to crashes as the line number cache would report a bogus line number for a line of code, and we'd try to find a nonexistent column within the line when printing diagnostics. This fixes an assertion when building the graphics/champlain port. Reported by: antoine, kwm PR: 219139 MFC r321723: Upgrade our copies of clang, llvm, lld and lldb to r309439 from the upstream release_50 branch. This is just after upstream's 5.0.0-rc1. MFC r322320: Upgrade our copies of clang, llvm and libc++ to r310316 from the upstream release_50 branch. MFC r322326 (by emaste): lldb: Make i386-*-freebsd expression work on JIT path * Enable i386 ABI creation for freebsd * Added an extra argument in ABISysV_i386::PrepareTrivialCall for mmap syscall * Unlike linux, the last argument of mmap is actually 64-bit(off_t). This requires us to push an additional word for the higher order bits. * Prior to this change, ktrace dump will show mmap failures due to invalid argument coming from the 6th mmap argument. Submitted by: Karnajit Wangkhem Differential Revision: https://reviews.llvm.org/D34776 MFC r322360 (by emaste): lldb: Report inferior signals as signals, not exceptions, on FreeBSD This is the FreeBSD equivalent of LLVM r238549. This serves 2 purposes: * LLDB should handle inferior process signals SIGSEGV/SIGILL/SIGBUS/ SIGFPE the way it is suppose to be handled. Prior to this fix these signals will neither create a coredump, nor exit from the debugger or work for signal handling scenario. * eInvalidCrashReason need not report "unknown crash reason" if we have a valid si_signo llvm.org/pr23699 Patch by Karnajit Wangkhem Differential Revision: https://reviews.llvm.org/D35223 Submitted by: Karnajit Wangkhem Obtained from: LLVM r310591 MFC r322474 (by emaste): lld: Add `-z muldefs` option. Obtained from: LLVM r310757 MFC r322740: Upgrade our copies of clang, llvm, lld and libc++ to r311219 from the upstream release_50 branch. MFC r322855: Upgrade our copies of clang, llvm, lldb and compiler-rt to r311606 from the upstream release_50 branch. As of this version, lib/msun's trig test should also work correctly again (see bug 220989 for more information). PR: 220989 MFC r323112: Upgrade our copies of clang, llvm, lldb and compiler-rt to r312293 from the upstream release_50 branch. This corresponds to 5.0.0 rc4. As of this version, the cad/stepcode port should now compile in a more reasonable time on i386 (see bug 221836 for more information). PR: 221836 MFC r323245: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 5.0.0 release (upstream r312559). Release notes for llvm, clang and lld will be available here soon: <http://releases.llvm.org/5.0.0/docs/ReleaseNotes.html> <http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html> <http://releases.llvm.org/5.0.0/tools/lld/docs/ReleaseNotes.html> Relnotes: yes
1 parent b605203 commit 12cd91c

File tree

5,339 files changed

+473199
-225474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,339 files changed

+473199
-225474
lines changed

ObsoleteFiles.inc

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,119 @@
3838
# xargs -n1 | sort | uniq -d;
3939
# done
4040

41+
# 2017mmdd: new clang import which bumps version from 4.0.0 to 5.0.0.
42+
OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/allocator_interface.h
43+
OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/asan_interface.h
44+
OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/common_interface_defs.h
45+
OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/coverage_interface.h
46+
OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/dfsan_interface.h
47+
OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/esan_interface.h
48+
OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/linux_syscall_hooks.h
49+
OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/lsan_interface.h
50+
OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/msan_interface.h
51+
OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/tsan_interface_atomic.h
52+
OLD_DIRS+=usr/lib/clang/4.0.0/include/sanitizer
53+
OLD_FILES+=usr/lib/clang/4.0.0/include/__clang_cuda_builtin_vars.h
54+
OLD_FILES+=usr/lib/clang/4.0.0/include/__clang_cuda_cmath.h
55+
OLD_FILES+=usr/lib/clang/4.0.0/include/__clang_cuda_complex_builtins.h
56+
OLD_FILES+=usr/lib/clang/4.0.0/include/__clang_cuda_intrinsics.h
57+
OLD_FILES+=usr/lib/clang/4.0.0/include/__clang_cuda_math_forward_declares.h
58+
OLD_FILES+=usr/lib/clang/4.0.0/include/__clang_cuda_runtime_wrapper.h
59+
OLD_FILES+=usr/lib/clang/4.0.0/include/__stddef_max_align_t.h
60+
OLD_FILES+=usr/lib/clang/4.0.0/include/__wmmintrin_aes.h
61+
OLD_FILES+=usr/lib/clang/4.0.0/include/__wmmintrin_pclmul.h
62+
OLD_FILES+=usr/lib/clang/4.0.0/include/adxintrin.h
63+
OLD_FILES+=usr/lib/clang/4.0.0/include/altivec.h
64+
OLD_FILES+=usr/lib/clang/4.0.0/include/ammintrin.h
65+
OLD_FILES+=usr/lib/clang/4.0.0/include/arm_acle.h
66+
OLD_FILES+=usr/lib/clang/4.0.0/include/arm_neon.h
67+
OLD_FILES+=usr/lib/clang/4.0.0/include/armintr.h
68+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx2intrin.h
69+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512bwintrin.h
70+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512cdintrin.h
71+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512dqintrin.h
72+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512erintrin.h
73+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512fintrin.h
74+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512ifmaintrin.h
75+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512ifmavlintrin.h
76+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512pfintrin.h
77+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512vbmiintrin.h
78+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512vbmivlintrin.h
79+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512vlbwintrin.h
80+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512vlcdintrin.h
81+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512vldqintrin.h
82+
OLD_FILES+=usr/lib/clang/4.0.0/include/avx512vlintrin.h
83+
OLD_FILES+=usr/lib/clang/4.0.0/include/avxintrin.h
84+
OLD_FILES+=usr/lib/clang/4.0.0/include/bmi2intrin.h
85+
OLD_FILES+=usr/lib/clang/4.0.0/include/bmiintrin.h
86+
OLD_FILES+=usr/lib/clang/4.0.0/include/clflushoptintrin.h
87+
OLD_FILES+=usr/lib/clang/4.0.0/include/cpuid.h
88+
OLD_FILES+=usr/lib/clang/4.0.0/include/emmintrin.h
89+
OLD_FILES+=usr/lib/clang/4.0.0/include/f16cintrin.h
90+
OLD_FILES+=usr/lib/clang/4.0.0/include/fma4intrin.h
91+
OLD_FILES+=usr/lib/clang/4.0.0/include/fmaintrin.h
92+
OLD_FILES+=usr/lib/clang/4.0.0/include/fxsrintrin.h
93+
OLD_FILES+=usr/lib/clang/4.0.0/include/htmintrin.h
94+
OLD_FILES+=usr/lib/clang/4.0.0/include/htmxlintrin.h
95+
OLD_FILES+=usr/lib/clang/4.0.0/include/ia32intrin.h
96+
OLD_FILES+=usr/lib/clang/4.0.0/include/immintrin.h
97+
OLD_FILES+=usr/lib/clang/4.0.0/include/lzcntintrin.h
98+
OLD_FILES+=usr/lib/clang/4.0.0/include/mm3dnow.h
99+
OLD_FILES+=usr/lib/clang/4.0.0/include/mm_malloc.h
100+
OLD_FILES+=usr/lib/clang/4.0.0/include/mmintrin.h
101+
OLD_FILES+=usr/lib/clang/4.0.0/include/module.modulemap
102+
OLD_FILES+=usr/lib/clang/4.0.0/include/msa.h
103+
OLD_FILES+=usr/lib/clang/4.0.0/include/mwaitxintrin.h
104+
OLD_FILES+=usr/lib/clang/4.0.0/include/nmmintrin.h
105+
OLD_FILES+=usr/lib/clang/4.0.0/include/opencl-c.h
106+
OLD_FILES+=usr/lib/clang/4.0.0/include/pkuintrin.h
107+
OLD_FILES+=usr/lib/clang/4.0.0/include/pmmintrin.h
108+
OLD_FILES+=usr/lib/clang/4.0.0/include/popcntintrin.h
109+
OLD_FILES+=usr/lib/clang/4.0.0/include/prfchwintrin.h
110+
OLD_FILES+=usr/lib/clang/4.0.0/include/rdseedintrin.h
111+
OLD_FILES+=usr/lib/clang/4.0.0/include/rtmintrin.h
112+
OLD_FILES+=usr/lib/clang/4.0.0/include/s390intrin.h
113+
OLD_FILES+=usr/lib/clang/4.0.0/include/shaintrin.h
114+
OLD_FILES+=usr/lib/clang/4.0.0/include/smmintrin.h
115+
OLD_FILES+=usr/lib/clang/4.0.0/include/tbmintrin.h
116+
OLD_FILES+=usr/lib/clang/4.0.0/include/tmmintrin.h
117+
OLD_FILES+=usr/lib/clang/4.0.0/include/vadefs.h
118+
OLD_FILES+=usr/lib/clang/4.0.0/include/vecintrin.h
119+
OLD_FILES+=usr/lib/clang/4.0.0/include/wmmintrin.h
120+
OLD_FILES+=usr/lib/clang/4.0.0/include/x86intrin.h
121+
OLD_FILES+=usr/lib/clang/4.0.0/include/xmmintrin.h
122+
OLD_FILES+=usr/lib/clang/4.0.0/include/xopintrin.h
123+
OLD_FILES+=usr/lib/clang/4.0.0/include/xsavecintrin.h
124+
OLD_FILES+=usr/lib/clang/4.0.0/include/xsaveintrin.h
125+
OLD_FILES+=usr/lib/clang/4.0.0/include/xsaveoptintrin.h
126+
OLD_FILES+=usr/lib/clang/4.0.0/include/xsavesintrin.h
127+
OLD_FILES+=usr/lib/clang/4.0.0/include/xtestintrin.h
128+
OLD_DIRS+=usr/lib/clang/4.0.0/include
129+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.asan-i386.a
130+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.asan-i386.so
131+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.asan-preinit-i386.a
132+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.asan-preinit-x86_64.a
133+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.asan-x86_64.a
134+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.asan-x86_64.so
135+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.asan_cxx-i386.a
136+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.asan_cxx-x86_64.a
137+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.profile-arm.a
138+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.profile-i386.a
139+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.profile-x86_64.a
140+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.safestack-i386.a
141+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.safestack-x86_64.a
142+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.stats-i386.a
143+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.stats-x86_64.a
144+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.stats_client-i386.a
145+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.stats_client-x86_64.a
146+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.ubsan_standalone-i386.a
147+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.ubsan_standalone-x86_64.a
148+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-i386.a
149+
OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-x86_64.a
150+
OLD_DIRS+=usr/lib/clang/4.0.0/lib/freebsd
151+
OLD_DIRS+=usr/lib/clang/4.0.0/lib
152+
OLD_DIRS+=usr/lib/clang/4.0.0
153+
OLD_FILES+=usr/bin/llvm-pdbdump
41154
# 20170802: ksyms(4) ioctl interface was removed
42155
OLD_FILES+=usr/include/sys/ksyms.h
43156
# 20170620: remove stale manpage

UPDATING

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to
1616
the tip of head, and then rebuild without this option. The bootstrap process
1717
from older version of current across the gcc/clang cutover is a bit fragile.
1818

19+
2017mmdd:
20+
Clang, llvm, lldb, compiler-rt and libc++ have been upgraded to 5.0.0.
21+
Please see the 20141231 entry below for information about prerequisites
22+
and upgrading, if you are not already using clang 3.5.0 or higher.
23+
1924
20170822:
2025
Since the switch to GPT disk labels, fsck for UFS/FFS has been
2126
unable to automatically find alternate superblocks. As of r322806,

contrib/compiler-rt/include/sanitizer/common_interface_defs.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,10 @@ extern "C" {
158158
// Prints stack traces for all live heap allocations ordered by total
159159
// allocation size until `top_percent` of total live heap is shown.
160160
// `top_percent` should be between 1 and 100.
161+
// At most `max_number_of_contexts` contexts (stack traces) is printed.
161162
// Experimental feature currently available only with asan on Linux/x86_64.
162-
void __sanitizer_print_memory_profile(size_t top_percent);
163+
void __sanitizer_print_memory_profile(size_t top_percent,
164+
size_t max_number_of_contexts);
163165

164166
// Fiber annotation interface.
165167
// Before switching to a different stack, one must call

contrib/compiler-rt/include/sanitizer/coverage_interface.h

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,13 @@
1919
extern "C" {
2020
#endif
2121

22-
// Initialize coverage.
23-
void __sanitizer_cov_init();
2422
// Record and dump coverage info.
2523
void __sanitizer_cov_dump();
2624

2725
// Dump collected coverage info. Sorts pcs by module into individual
2826
// .sancov files.
2927
void __sanitizer_dump_coverage(const uintptr_t *pcs, uintptr_t len);
3028

31-
// Open <name>.sancov.packed in the coverage directory and return the file
32-
// descriptor. Returns -1 on failure, or if coverage dumping is disabled.
33-
// This is intended for use by sandboxing code.
34-
intptr_t __sanitizer_maybe_open_cov_file(const char *name);
35-
// Get the number of unique covered blocks (or edges).
36-
// This can be useful for coverage-directed in-process fuzzers.
37-
uintptr_t __sanitizer_get_total_unique_coverage();
38-
// Get the number of unique indirect caller-callee pairs.
39-
uintptr_t __sanitizer_get_total_unique_caller_callee_pairs();
40-
41-
// Reset the basic-block (edge) coverage to the initial state.
42-
// Useful for in-process fuzzing to start collecting coverage from scratch.
43-
// Experimental, will likely not work for multi-threaded process.
44-
void __sanitizer_reset_coverage();
45-
// Set *data to the array of covered PCs and return the size of that array.
46-
// Some of the entries in *data will be zero.
47-
uintptr_t __sanitizer_get_coverage_guards(uintptr_t **data);
48-
49-
// The coverage instrumentation may optionally provide imprecise counters.
50-
// Rather than exposing the counter values to the user we instead map
51-
// the counters to a bitset.
52-
// Every counter is associated with 8 bits in the bitset.
53-
// We define 8 value ranges: 1, 2, 3, 4-7, 8-15, 16-31, 32-127, 128+
54-
// The i-th bit is set to 1 if the counter value is in the i-th range.
55-
// This counter-based coverage implementation is *not* thread-safe.
56-
57-
// Returns the number of registered coverage counters.
58-
uintptr_t __sanitizer_get_number_of_counters();
59-
// Updates the counter 'bitset', clears the counters and returns the number of
60-
// new bits in 'bitset'.
61-
// If 'bitset' is nullptr, only clears the counters.
62-
// Otherwise 'bitset' should be at least
63-
// __sanitizer_get_number_of_counters bytes long and 8-aligned.
64-
uintptr_t
65-
__sanitizer_update_counter_bitset_and_clear_counters(uint8_t *bitset);
66-
6729
#ifdef __cplusplus
6830
} // extern "C"
6931
#endif
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
//===-- tsan_interface.h ----------------------------------------*- C++ -*-===//
2+
//
3+
// The LLVM Compiler Infrastructure
4+
//
5+
// This file is distributed under the University of Illinois Open Source
6+
// License. See LICENSE.TXT for details.
7+
//
8+
//===----------------------------------------------------------------------===//
9+
//
10+
// This file is a part of ThreadSanitizer (TSan), a race detector.
11+
//
12+
// Public interface header for TSan.
13+
//===----------------------------------------------------------------------===//
14+
#ifndef SANITIZER_TSAN_INTERFACE_H
15+
#define SANITIZER_TSAN_INTERFACE_H
16+
17+
#include <sanitizer/common_interface_defs.h>
18+
19+
#ifdef __cplusplus
20+
extern "C" {
21+
#endif
22+
23+
// __tsan_release establishes a happens-before relation with a preceding
24+
// __tsan_acquire on the same address.
25+
void __tsan_acquire(void *addr);
26+
void __tsan_release(void *addr);
27+
28+
// Annotations for custom mutexes.
29+
// The annotations allow to get better reports (with sets of locked mutexes),
30+
// detect more types of bugs (e.g. mutex misuses, races between lock/unlock and
31+
// destruction and potential deadlocks) and improve precision and performance
32+
// (by ignoring individual atomic operations in mutex code). However, the
33+
// downside is that annotated mutex code itself is not checked for correctness.
34+
35+
// Mutex creation flags are passed to __tsan_mutex_create annotation.
36+
// If mutex has no constructor and __tsan_mutex_create is not called,
37+
// the flags may be passed to __tsan_mutex_pre_lock/__tsan_mutex_post_lock
38+
// annotations.
39+
40+
// Mutex has static storage duration and no-op constructor and destructor.
41+
// This effectively makes tsan ignore destroy annotation.
42+
const unsigned __tsan_mutex_linker_init = 1 << 0;
43+
// Mutex is write reentrant.
44+
const unsigned __tsan_mutex_write_reentrant = 1 << 1;
45+
// Mutex is read reentrant.
46+
const unsigned __tsan_mutex_read_reentrant = 1 << 2;
47+
48+
// Mutex operation flags:
49+
50+
// Denotes read lock operation.
51+
const unsigned __tsan_mutex_read_lock = 1 << 3;
52+
// Denotes try lock operation.
53+
const unsigned __tsan_mutex_try_lock = 1 << 4;
54+
// Denotes that a try lock operation has failed to acquire the mutex.
55+
const unsigned __tsan_mutex_try_lock_failed = 1 << 5;
56+
// Denotes that the lock operation acquires multiple recursion levels.
57+
// Number of levels is passed in recursion parameter.
58+
// This is useful for annotation of e.g. Java builtin monitors,
59+
// for which wait operation releases all recursive acquisitions of the mutex.
60+
const unsigned __tsan_mutex_recursive_lock = 1 << 6;
61+
// Denotes that the unlock operation releases all recursion levels.
62+
// Number of released levels is returned and later must be passed to
63+
// the corresponding __tsan_mutex_post_lock annotation.
64+
const unsigned __tsan_mutex_recursive_unlock = 1 << 7;
65+
66+
// Annotate creation of a mutex.
67+
// Supported flags: mutex creation flags.
68+
void __tsan_mutex_create(void *addr, unsigned flags);
69+
70+
// Annotate destruction of a mutex.
71+
// Supported flags:
72+
// - __tsan_mutex_linker_init
73+
void __tsan_mutex_destroy(void *addr, unsigned flags);
74+
75+
// Annotate start of lock operation.
76+
// Supported flags:
77+
// - __tsan_mutex_read_lock
78+
// - __tsan_mutex_try_lock
79+
// - all mutex creation flags
80+
void __tsan_mutex_pre_lock(void *addr, unsigned flags);
81+
82+
// Annotate end of lock operation.
83+
// Supported flags:
84+
// - __tsan_mutex_read_lock (must match __tsan_mutex_pre_lock)
85+
// - __tsan_mutex_try_lock (must match __tsan_mutex_pre_lock)
86+
// - __tsan_mutex_try_lock_failed
87+
// - __tsan_mutex_recursive_lock
88+
// - all mutex creation flags
89+
void __tsan_mutex_post_lock(void *addr, unsigned flags, int recursion);
90+
91+
// Annotate start of unlock operation.
92+
// Supported flags:
93+
// - __tsan_mutex_read_lock
94+
// - __tsan_mutex_recursive_unlock
95+
int __tsan_mutex_pre_unlock(void *addr, unsigned flags);
96+
97+
// Annotate end of unlock operation.
98+
// Supported flags:
99+
// - __tsan_mutex_read_lock (must match __tsan_mutex_pre_unlock)
100+
void __tsan_mutex_post_unlock(void *addr, unsigned flags);
101+
102+
// Annotate start/end of notify/signal/broadcast operation.
103+
// Supported flags: none.
104+
void __tsan_mutex_pre_signal(void *addr, unsigned flags);
105+
void __tsan_mutex_post_signal(void *addr, unsigned flags);
106+
107+
// Annotate start/end of a region of code where lock/unlock/signal operation
108+
// diverts to do something else unrelated to the mutex. This can be used to
109+
// annotate, for example, calls into cooperative scheduler or contention
110+
// profiling code.
111+
// These annotations must be called only from within
112+
// __tsan_mutex_pre/post_lock, __tsan_mutex_pre/post_unlock,
113+
// __tsan_mutex_pre/post_signal regions.
114+
// Supported flags: none.
115+
void __tsan_mutex_pre_divert(void *addr, unsigned flags);
116+
void __tsan_mutex_post_divert(void *addr, unsigned flags);
117+
118+
// External race detection API.
119+
// Can be used by non-instrumented libraries to detect when their objects are
120+
// being used in an unsafe manner.
121+
// - __tsan_external_read/__tsan_external_write annotates the logical reads
122+
// and writes of the object at the specified address. 'caller_pc' should
123+
// be the PC of the library user, which the library can obtain with e.g.
124+
// `__builtin_return_address(0)`.
125+
// - __tsan_external_register_tag registers a 'tag' with the specified name,
126+
// which is later used in read/write annotations to denote the object type
127+
// - __tsan_external_assign_tag can optionally mark a heap object with a tag
128+
void *__tsan_external_register_tag(const char *object_type);
129+
void __tsan_external_register_header(void *tag, const char *header);
130+
void __tsan_external_assign_tag(void *addr, void *tag);
131+
void __tsan_external_read(void *addr, void *caller_pc, void *tag);
132+
void __tsan_external_write(void *addr, void *caller_pc, void *tag);
133+
134+
#ifdef __cplusplus
135+
} // extern "C"
136+
#endif
137+
138+
#endif // SANITIZER_TSAN_INTERFACE_H

0 commit comments

Comments
 (0)