forked from jcmvbkbc/crosstool-NG
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy path0012-xtensa-Configurable-exception-emergency-pool-size.patch
45 lines (40 loc) · 1.48 KB
/
0012-xtensa-Configurable-exception-emergency-pool-size.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From a39da3dc47b6e88daa20f5ef435a0fb3979c18f8 Mon Sep 17 00:00:00 2001
From: Alexey Gerenkov <[email protected]>
Date: Thu, 16 Nov 2017 15:06:35 +0300
Subject: [PATCH 12/18] xtensa: Configurable exception emergency pool size
---
libstdc++-v3/libsupc++/eh_alloc.cc | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc
index 7ddd2b746d8..aca2e37799a 100644
--- a/libstdc++-v3/libsupc++/eh_alloc.cc
+++ b/libstdc++-v3/libsupc++/eh_alloc.cc
@@ -73,6 +73,13 @@ using namespace __cxxabiv1;
# define EMERGENCY_OBJ_COUNT 4
#endif
+static const size_t DEFAULT_ARENA_SIZE = EMERGENCY_OBJ_SIZE * EMERGENCY_OBJ_COUNT * sizeof (__cxa_dependent_exception);
+
+extern "C" size_t __cxx_eh_arena_size_get() __attribute__((weak));
+extern "C" size_t __cxx_eh_arena_size_get()
+{
+ return DEFAULT_ARENA_SIZE;
+}
namespace
{
@@ -112,9 +119,11 @@ namespace
{
// Allocate the arena - we could add a GLIBCXX_EH_ARENA_SIZE environment
// to make this tunable.
- arena_size = (EMERGENCY_OBJ_SIZE * EMERGENCY_OBJ_COUNT
- + EMERGENCY_OBJ_COUNT * sizeof (__cxa_dependent_exception));
- arena = (char *)malloc (arena_size);
+ arena = NULL;
+ arena_size = __cxx_eh_arena_size_get();
+ if (arena_size > 0) {
+ arena = (char *)malloc (arena_size);
+ }
if (!arena)
{
// If the allocation failed go without an emergency pool.
--
2.21.0 (Apple Git-122)