diff --git a/stand/defs.mk b/stand/defs.mk --- a/stand/defs.mk +++ b/stand/defs.mk @@ -24,6 +24,12 @@ # enough to make that hassle worth chasing. _CPUCFLAGS= +.if ${LDFLAGS:M-nostdlib} +# Sanitizers won't work unless we link against libc (e.g. in userboot/test). +MK_ASAN:= no +MK_UBSAN:= no +.endif + .include .include diff --git a/stand/userboot/userboot/Makefile b/stand/userboot/userboot/Makefile --- a/stand/userboot/userboot/Makefile +++ b/stand/userboot/userboot/Makefile @@ -6,6 +6,9 @@ LOADER_EXT2FS_SUPPORT?= no PIC=yes +# Note: -nostdlib needs to be added to LDFLAGS before including defs.mk +LDFLAGS+= -nostdlib -Wl,-Bsymbolic + .include SHLIB_NAME= userboot_${LOADER_INTERP}.so @@ -39,8 +42,6 @@ CFLAGS.gfx_fb.c+= -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite CWARNFLAGS.main.c += -Wno-implicit-function-declaration -LDFLAGS+= -nostdlib -Wl,-Bsymbolic - NEWVERSWHAT= "User boot ${LOADER_INTERP}" ${MACHINE_CPUARCH} VERSION_FILE= ${.CURDIR}/../userboot/version