Skip to content

Commit c8710a6

Browse files
committed
Trap on heap corruption
Optimize compute_tree_index
1 parent 15970cd commit c8710a6

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

libc/malloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,13 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
591591
#if defined(__DEVKITPRO__)
592592
#include <sys/config.h>
593593
#include <reent.h>
594+
#define ABORT __builtin_trap()
594595
#define FOOTERS 1
595596
#define HAVE_MMAP 0
596597
#define MALLOC_ALIGNMENT ((size_t)32U)
597598
#define MALLOC_INSPECT_ALL 1
598599
#define MMAP_CLEARS 0
599600
#define MSPACES 1
600-
#define USE_BUILTIN_FFS 1
601601
#define USE_DL_PREFIX
602602
#define USE_LOCKS 1
603603
#define USE_SPIN_LOCKS 0
@@ -2905,7 +2905,7 @@ static size_t traverse_and_check(mstate m);
29052905
#define treebin_at(M,i) (&((M)->treebins[i]))
29062906

29072907
/* assign tree index for size S to variable I. Use x86 asm if possible */
2908-
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
2908+
#if defined(__GNUC__) && __GNUC__ >= 3
29092909
#define compute_tree_index(S, I)\
29102910
{\
29112911
unsigned int X = S >> TREEBIN_SHIFT;\
@@ -3008,7 +3008,7 @@ static size_t traverse_and_check(mstate m);
30083008

30093009
/* index corresponding to given bit. Use x86 asm if possible */
30103010

3011-
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
3011+
#if defined(__GNUC__) && __GNUC__ >= 3
30123012
#define compute_bit2idx(X, I)\
30133013
{\
30143014
unsigned int J;\

0 commit comments

Comments
 (0)