• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ===-- aeabi_div0.c - ARM Runtime ABI support routines for compiler-rt ---===
2  *
3  *                     The LLVM Compiler Infrastructure
4  *
5  * This file is dual licensed under the MIT and the University of Illinois Open
6  * Source Licenses. See LICENSE.TXT for details.
7  *
8  * ===----------------------------------------------------------------------===
9  *
10  * This file implements the division by zero helper routines as specified by the
11  * Run-time ABI for the ARM Architecture.
12  *
13  * ===----------------------------------------------------------------------===
14  */
15 
16 /*
17  * RTABI 4.3.2 - Division by zero
18  *
19  * The *div0 functions:
20  * - Return the value passed to them as a parameter
21  * - Or, return a fixed value defined by the execution environment (such as 0)
22  * - Or, raise a signal (often SIGFPE) or throw an exception, and do not return
23  *
24  * An application may provide its own implementations of the *div0 functions to
25  * for a particular behaviour from the *div and *divmod functions called out of
26  * line.
27  */
28 
29 /* provide an unused declaration to pacify pendantic compilation */
30 extern unsigned char declaration;
31 
32 #if defined(__ARM_EABI__)
33 int __attribute__((weak)) __attribute__((visibility("hidden")))
__aeabi_idiv0(int return_value)34 __aeabi_idiv0(int return_value) {
35   return return_value;
36 }
37 
38 long long __attribute__((weak)) __attribute__((visibility("hidden")))
__aeabi_ldiv0(long long return_value)39 __aeabi_ldiv0(long long return_value) {
40   return return_value;
41 }
42 #endif
43 
44