1*3cab2bb3Spatrick //===-- aeabi_div0.c - ARM Runtime ABI support routines for compiler-rt ---===// 2*3cab2bb3Spatrick // 3*3cab2bb3Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*3cab2bb3Spatrick // See https://llvm.org/LICENSE.txt for license information. 5*3cab2bb3Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*3cab2bb3Spatrick // 7*3cab2bb3Spatrick //===----------------------------------------------------------------------===// 8*3cab2bb3Spatrick // 9*3cab2bb3Spatrick // This file implements the division by zero helper routines as specified by the 10*3cab2bb3Spatrick // Run-time ABI for the ARM Architecture. 11*3cab2bb3Spatrick // 12*3cab2bb3Spatrick //===----------------------------------------------------------------------===// 13*3cab2bb3Spatrick 14*3cab2bb3Spatrick // RTABI 4.3.2 - Division by zero 15*3cab2bb3Spatrick // 16*3cab2bb3Spatrick // The *div0 functions: 17*3cab2bb3Spatrick // - Return the value passed to them as a parameter 18*3cab2bb3Spatrick // - Or, return a fixed value defined by the execution environment (such as 0) 19*3cab2bb3Spatrick // - Or, raise a signal (often SIGFPE) or throw an exception, and do not return 20*3cab2bb3Spatrick // 21*3cab2bb3Spatrick // An application may provide its own implementations of the *div0 functions to 22*3cab2bb3Spatrick // for a particular behaviour from the *div and *divmod functions called out of 23*3cab2bb3Spatrick // line. 24*3cab2bb3Spatrick 25*3cab2bb3Spatrick #include "../int_lib.h" 26*3cab2bb3Spatrick 27*3cab2bb3Spatrick // provide an unused declaration to pacify pendantic compilation 28*3cab2bb3Spatrick extern unsigned char declaration; 29*3cab2bb3Spatrick 30*3cab2bb3Spatrick #if defined(__ARM_EABI__) 31*3cab2bb3Spatrick AEABI_RTABI int __attribute__((weak)) __attribute__((visibility("hidden"))) __aeabi_idiv0(int return_value)32*3cab2bb3Spatrick__aeabi_idiv0(int return_value) { 33*3cab2bb3Spatrick return return_value; 34*3cab2bb3Spatrick } 35*3cab2bb3Spatrick 36*3cab2bb3Spatrick AEABI_RTABI long long __attribute__((weak)) __aeabi_ldiv0(long long return_value)37*3cab2bb3Spatrick__attribute__((visibility("hidden"))) __aeabi_ldiv0(long long return_value) { 38*3cab2bb3Spatrick return return_value; 39*3cab2bb3Spatrick } 40*3cab2bb3Spatrick #endif 41