blob: dc3031326e37dd87274363d9acdf053a15b14398 [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
Saleem Abdulrasool92a239b2017-05-16 18:19:44 +000029#include "../int_lib.h"
30
Saleem Abdulrasoola0a58732014-09-06 21:34:02 +000031/* provide an unused declaration to pacify pendantic compilation */
32extern unsigned char declaration;
33
34#if defined(__ARM_EABI__)
Saleem Abdulrasool36ac5dd2017-05-16 16:41:37 +000035AEABI_RTABI int __attribute__((weak)) __attribute__((visibility("hidden")))
Saleem Abdulrasoola0a58732014-09-06 21:34:02 +000036__aeabi_idiv0(int return_value) {
37 return return_value;
38}
39
Saleem Abdulrasool36ac5dd2017-05-16 16:41:37 +000040AEABI_RTABI long long __attribute__((weak)) __attribute__((visibility("hidden")))
Saleem Abdulrasoola0a58732014-09-06 21:34:02 +000041__aeabi_ldiv0(long long return_value) {
42 return return_value;
43}
44#endif
45