tsan: fix strerror interceptor (eliminate false positives)
[blocksruntime.git] / lib / int_util.c
blob6d8922a7da43140d27eb96e9f53ddf32b7a7baf7
1 /* ===-- int_util.c - Implement internal utilities --------------------------===
3 * The LLVM Compiler Infrastructure
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
8 * ===----------------------------------------------------------------------===
9 */
11 #include "int_util.h"
12 #include "int_lib.h"
14 /* NOTE: The definitions in this file are declared weak because we clients to be
15 * able to arbitrarily package individual functions into separate .a files. If
16 * we did not declare these weak, some link situations might end up seeing
17 * duplicate strong definitions of the same symbol.
19 * We can't use this solution for kernel use (which may not support weak), but
20 * currently expect that when built for kernel use all the functionality is
21 * packaged into a single library.
24 #ifdef KERNEL_USE
26 extern void panic(const char *, ...) __attribute__((noreturn));
27 #ifndef _WIN32
28 __attribute__((visibility("hidden")))
29 #endif
30 void compilerrt_abort_impl(const char *file, int line, const char *function) {
31 panic("%s:%d: abort in %s", file, line, function);
34 #elif __APPLE__ && !__STATIC__
36 /* from libSystem.dylib */
37 extern void __assert_rtn(const char *func, const char *file,
38 int line, const char * message) __attribute__((noreturn));
40 #ifndef _WIN32
41 __attribute__((weak))
42 __attribute__((visibility("hidden")))
43 #endif
44 void compilerrt_abort_impl(const char *file, int line, const char *function) {
45 __assert_rtn(function, file, line, "libcompiler_rt abort");
49 #else
51 /* Get the system definition of abort() */
52 #include <stdlib.h>
54 #ifndef _WIN32
55 __attribute__((weak))
56 __attribute__((visibility("hidden")))
57 #endif
58 void compilerrt_abort_impl(const char *file, int line, const char *function) {
59 abort();
62 #endif