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