1276789Sdim/* ===-- aeabi_div0.c - ARM Runtime ABI support routines for compiler-rt ---===
2276789Sdim *
3276789Sdim *                     The LLVM Compiler Infrastructure
4276789Sdim *
5276789Sdim * This file is dual licensed under the MIT and the University of Illinois Open
6276789Sdim * Source Licenses. See LICENSE.TXT for details.
7276789Sdim *
8276789Sdim * ===----------------------------------------------------------------------===
9276789Sdim *
10276789Sdim * This file implements the division by zero helper routines as specified by the
11276789Sdim * Run-time ABI for the ARM Architecture.
12276789Sdim *
13276789Sdim * ===----------------------------------------------------------------------===
14276789Sdim */
15276789Sdim
16276789Sdim/*
17276789Sdim * RTABI 4.3.2 - Division by zero
18276789Sdim *
19276789Sdim * The *div0 functions:
20276789Sdim * - Return the value passed to them as a parameter
21276789Sdim * - Or, return a fixed value defined by the execution environment (such as 0)
22276789Sdim * - Or, raise a signal (often SIGFPE) or throw an exception, and do not return
23276789Sdim *
24276789Sdim * An application may provide its own implementations of the *div0 functions to
25276789Sdim * for a particular behaviour from the *div and *divmod functions called out of
26276789Sdim * line.
27276789Sdim */
28276789Sdim
29276789Sdim/* provide an unused declaration to pacify pendantic compilation */
30276789Sdimextern unsigned char declaration;
31276789Sdim
32276789Sdim#if defined(__ARM_EABI__)
33276789Sdimint __attribute__((weak)) __attribute__((visibility("hidden")))
34276789Sdim__aeabi_idiv0(int return_value) {
35276789Sdim  return return_value;
36276789Sdim}
37276789Sdim
38276789Sdimlong long __attribute__((weak)) __attribute__((visibility("hidden")))
39276789Sdim__aeabi_ldiv0(long long return_value) {
40276789Sdim  return return_value;
41276789Sdim}
42276789Sdim#endif
43276789Sdim
44