blob: 6cc3505dc9c9e698c5b987a4f140adf6456c78ef [file] [log] [blame]
Saleem Abdulrasoola0a58732014-09-06 21:34:02 +00001/* ===-- 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/*
Saleem Abdulrasoolc89ae722014-09-08 01:49:24 +000017 * RTABI 4.3.2 - Division by zero
Saleem Abdulrasoola0a58732014-09-06 21:34:02 +000018 *
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 */
30extern unsigned char declaration;
31
32#if defined(__ARM_EABI__)
Saleem Abdulrasool36ac5dd2017-05-16 16:41:37 +000033AEABI_RTABI int __attribute__((weak)) __attribute__((visibility("hidden")))
Saleem Abdulrasoola0a58732014-09-06 21:34:02 +000034__aeabi_idiv0(int return_value) {
35 return return_value;
36}
37
Saleem Abdulrasool36ac5dd2017-05-16 16:41:37 +000038AEABI_RTABI long long __attribute__((weak)) __attribute__((visibility("hidden")))
Saleem Abdulrasoola0a58732014-09-06 21:34:02 +000039__aeabi_ldiv0(long long return_value) {
40 return return_value;
41}
42#endif
43