0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-03-03 05:38:11 +00:00
termux-packages/packages/openfoam/src-OSspecific-POSIX-signals-sigFpe.C.patch
2024-03-23 20:35:52 +01:00

57 lines
1.6 KiB
Diff

--- ./src/OSspecific/POSIX/signals/sigFpe.C.orig 2023-12-21 15:23:42.000000000 +0000
+++ ./src/OSspecific/POSIX/signals/sigFpe.C 2023-12-30 17:29:06.024889247 +0000
@@ -39,7 +39,7 @@
// File-local functions
#include "signalMacros.C"
-#if defined(__linux__) && defined(__GNUC__)
+#if (defined(__linux__) && defined(__GNUC__)) || defined(__ANDROID__)
#ifndef __USE_GNU
#define __USE_GNU // To use feenableexcept()
#endif
@@ -83,13 +83,16 @@
#ifdef __linux__
extern "C"
{
- extern void* __libc_malloc(size_t size);
+ extern void* malloc(size_t size);
+ // The override below gives segmentation fault in malloc on arm so skip
+ // on android for now.
+ #ifndef __ANDROID__
// Override the GLIBC malloc to support filling with NaN
void* malloc(size_t size)
{
// Call the low-level GLIBC malloc function
- void* ptr = __libc_malloc(size);
+ void* ptr = malloc(size);
if (Foam::sigFpe::nanActive())
{
@@ -109,6 +112,7 @@
return ptr;
}
+ #endif
} // End extern C
#endif // __linux__
@@ -118,7 +122,7 @@
void Foam::sigFpe::sigHandler(int)
{
- #if (defined(__linux__) && defined(__GNUC__)) || defined(__APPLE__)
+ #if (defined(__linux__) && defined(__GNUC__)) || defined(__APPLE__) || defined(__ANDROID__)
resetHandler("SIGFPE", SIGFPE);
@@ -126,7 +130,7 @@
error::printStack(Perr);
::raise(SIGFPE); // Throw signal (to old handler)
- #endif // (__linux__ && __GNUC__) || __APPLE__
+ #endif // (__linux__ && __GNUC__) || __APPLE__ || __ANDROID__
}