Workaround for random crash of userland binaries, as reported in

PR port-alpha/54307.

If rtree.c and tcache.c are compiled with -O0, userland just works
without problems as far as I can see. Alternately, you can specify
-DJEMALLOC_DEBUG to avoid random crash. Smells like compiler bug,
or wrong coding which relies on some undefined behavior.

Anyway, we need to pull this up into netbsd-9 asap.
This commit is contained in:
rin 2019-11-01 20:53:10 +00:00
parent 7030aa5735
commit 3972598af1

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.10 2019/07/23 06:31:20 martin Exp $
# $NetBSD: Makefile.inc,v 1.11 2019/11/01 20:53:10 rin Exp $
JEMALLOC:=${.PARSEDIR}/..
@ -51,6 +51,14 @@ COPTS.ctl.c+=-Wno-error=stack-protector
COPTS.stats.c+=-Wno-error=stack-protector
COPTS.tcache.c+=-Wno-error=stack-protector
.if ${MACHINE} == "alpha"
# These files need to be compiled with -O0, or build everything with
# -DJEMALLOC_DEBUG. Otherwise, userland binaries crash randomly, as
# reported in port-alpha/54307.
COPTS.rtree.c+=-O0
COPTS.tcache.c+=-O0
.endif
.if ${MACHINE_ARCH} == "vax"
# in merge_overlapping_regs, at regrename.c
COPTS.arena.c+=-O0