1353358Sdim//===-- aeabi_div0.c - ARM Runtime ABI support routines for compiler-rt ---===//
2353358Sdim//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6353358Sdim//
7353358Sdim//===----------------------------------------------------------------------===//
8353358Sdim//
9353358Sdim// This file implements the division by zero helper routines as specified by the
10353358Sdim// Run-time ABI for the ARM Architecture.
11353358Sdim//
12353358Sdim//===----------------------------------------------------------------------===//
13276789Sdim
14353358Sdim// RTABI 4.3.2 - Division by zero
15353358Sdim//
16353358Sdim// The *div0 functions:
17353358Sdim// - Return the value passed to them as a parameter
18353358Sdim// - Or, return a fixed value defined by the execution environment (such as 0)
19353358Sdim// - Or, raise a signal (often SIGFPE) or throw an exception, and do not return
20353358Sdim//
21353358Sdim// An application may provide its own implementations of the *div0 functions to
22353358Sdim// for a particular behaviour from the *div and *divmod functions called out of
23353358Sdim// line.
24276789Sdim
25321369Sdim#include "../int_lib.h"
26321369Sdim
27353358Sdim// provide an unused declaration to pacify pendantic compilation
28276789Sdimextern unsigned char declaration;
29276789Sdim
30276789Sdim#if defined(__ARM_EABI__)
31321369SdimAEABI_RTABI int __attribute__((weak)) __attribute__((visibility("hidden")))
32276789Sdim__aeabi_idiv0(int return_value) {
33276789Sdim  return return_value;
34276789Sdim}
35276789Sdim
36353358SdimAEABI_RTABI long long __attribute__((weak))
37353358Sdim__attribute__((visibility("hidden"))) __aeabi_ldiv0(long long return_value) {
38276789Sdim  return return_value;
39276789Sdim}
40276789Sdim#endif
41