1 //===-- int_util.c - Implement internal utilities -------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 // NOTE: The definitions in this file are declared weak because we clients to be
12 // able to arbitrarily package individual functions into separate .a files. If
13 // we did not declare these weak, some link situations might end up seeing
14 // duplicate strong definitions of the same symbol.
16 // We can't use this solution for kernel use (which may not support weak), but
17 // currently expect that when built for kernel use all the functionality is
18 // packaged into a single library.
22 NORETURN extern void panic(const char *, ...);
24 __attribute__((visibility("hidden")))
26 void __compilerrt_abort_impl(const char *file, int line, const char *function) {
27 panic("%s:%d: abort in %s", file, line, function);
32 // from libSystem.dylib
33 NORETURN extern void __assert_rtn(const char *func, const char *file, int line,
38 __attribute__((visibility("hidden")))
40 void __compilerrt_abort_impl(const char *file, int line, const char *function) {
41 __assert_rtn(function, file, line, "libcompiler_rt abort");
48 __attribute__((visibility("hidden")))
50 void __compilerrt_abort_impl(const char *file, int line, const char *function) {
56 // Get the system definition of abort()
61 __attribute__((visibility("hidden")))
63 void __compilerrt_abort_impl(const char *file, int line, const char *function) {