aeabi_div0.c 1.4 KB

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