aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debug/Makefile28
-rw-r--r--malloc/malloc.c2
2 files changed, 29 insertions, 1 deletions
diff --git a/debug/Makefile b/debug/Makefile
index 4020184..f29bd20 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -278,6 +278,34 @@ LDFLAGS-tst-backtrace4 = -rdynamic
LDFLAGS-tst-backtrace5 = -rdynamic
LDFLAGS-tst-backtrace6 = -rdynamic
+# When SFrame is enabled, make sure the dwarf unwinder is also exercised.
+ifeq ($(enable-gsframe),yes)
+dw_unwind_pair := \
+ tst-backtrace7:tst-backtrace2 \
+ tst-backtrace8:tst-backtrace3 \
+ tst-backtrace9:tst-backtrace4 \
+ tst-backtrace10:tst-backtrace5 \
+ tst-backtrace11:tst-backtrace6
+
+first_column = $(foreach pair,$(dw_unwind_pair),$(word 1,$(subst :, ,$(pair))))
+tests-dw-unwind = $(patsubst %,$(objpfx)%.out,$(first_column))
+tests-special += $(tests-dw-unwind)
+endif
+
+define make-strip-rule
+$(objpfx)$(word 1,$(subst :, ,$(1))): $(objpfx)$(word 2,$(subst :, ,$(1)))
+ strip --remove-section=.sframe $$< -o $$@
+endef
+
+$(foreach pair,$(dw_unwind_pair),$(eval $(call make-strip-rule,$(pair))))
+
+define make-run-rule
+$(objpfx)$(word 1,$(subst :, ,$(1))).out: /dev/null $(objpfx)$(word 1,$(subst :, ,$(1)))
+ $$(make-test-out) > $$@; $$(evaluate-test)
+endef
+
+$(foreach pair,$(dw_unwind_pair),$(eval $(call make-run-rule,$(pair))))
+
CFLAGS-tst-ssp-1.c += -fstack-protector-all
# Disable compiler optimizations around vsprintf (the function under test).
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 6da40ad..5ca390c 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -294,7 +294,7 @@
# define TCACHE_SMALL_BINS 64
# define TCACHE_LARGE_BINS 12 /* Up to 4M chunks */
# define TCACHE_MAX_BINS (TCACHE_SMALL_BINS + TCACHE_LARGE_BINS)
-# define MAX_TCACHE_SMALL_SIZE tidx2usize (TCACHE_MAX_BINS-1)
+# define MAX_TCACHE_SMALL_SIZE tidx2usize (TCACHE_SMALL_BINS-1)
/* Only used to pre-fill the tunables. */
# define tidx2usize(idx) (((size_t) idx) * MALLOC_ALIGNMENT + MINSIZE - SIZE_SZ)