1//===-- aeabi_div0.c - ARM Runtime ABI support routines for compiler-rt ---===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the division by zero helper routines as specified by the
10// Run-time ABI for the ARM Architecture.
11//
12//===----------------------------------------------------------------------===//
13
14// RTABI 4.3.2 - Division by zero
15//
16// The *div0 functions:
17// - Return the value passed to them as a parameter
18// - Or, return a fixed value defined by the execution environment (such as 0)
19// - Or, raise a signal (often SIGFPE) or throw an exception, and do not return
20//
21// An application may provide its own implementations of the *div0 functions to
22// for a particular behaviour from the *div and *divmod functions called out of
23// line.
24
25#include "../int_lib.h"
26
27// provide an unused declaration to pacify pendantic compilation
28extern unsigned char declaration;
29
30#if defined(__ARM_EABI__)
31AEABI_RTABI int __attribute__((weak)) __attribute__((visibility("hidden")))
32__aeabi_idiv0(int return_value) {
33 return return_value;
34}
35
36AEABI_RTABI long long __attribute__((weak))
37__attribute__((visibility("hidden"))) __aeabi_ldiv0(long long return_value) {
38 return return_value;
39}
40#endif
41

source code of compiler-rt/lib/builtins/arm/aeabi_div0.c