Fix build of stand/ when building world with ASAN
The userboot/test program links against the default userspace libraries (e.g. shared libgcc_s.so) that will be instrumented if WITH_ASAN is set. All other programs link against libsa instead of libc and therefore can't use the sanitizer runtime library. To fix the stand/ build with sanitizers, we disable MK_ASAN/MK_UBSAN if -nostdlib is found in the LDFLAGS (i.e. we are using libsa instead of libc). Reviewed By: imp, tsoome Differential Revision: https://reviews.freebsd.org/D31047
This commit is contained in:
parent
c826e08841
commit
5e9226f063
@ -24,6 +24,12 @@ INTERNALLIB=
|
|||||||
# enough to make that hassle worth chasing.
|
# enough to make that hassle worth chasing.
|
||||||
_CPUCFLAGS=
|
_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 <src.opts.mk>
|
.include <src.opts.mk>
|
||||||
.include <bsd.linker.mk>
|
.include <bsd.linker.mk>
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@ LOADER_CD9660_SUPPORT?= no
|
|||||||
LOADER_EXT2FS_SUPPORT?= no
|
LOADER_EXT2FS_SUPPORT?= no
|
||||||
PIC=yes
|
PIC=yes
|
||||||
|
|
||||||
|
# Note: -nostdlib needs to be added to LDFLAGS before including defs.mk
|
||||||
|
LDFLAGS+= -nostdlib -Wl,-Bsymbolic
|
||||||
|
|
||||||
.include <bsd.init.mk>
|
.include <bsd.init.mk>
|
||||||
|
|
||||||
SHLIB_NAME= userboot_${LOADER_INTERP}.so
|
SHLIB_NAME= userboot_${LOADER_INTERP}.so
|
||||||
@ -39,8 +42,6 @@ CFLAGS.main.c+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs
|
|||||||
CFLAGS.gfx_fb.c+= -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite
|
CFLAGS.gfx_fb.c+= -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite
|
||||||
CWARNFLAGS.main.c += -Wno-implicit-function-declaration
|
CWARNFLAGS.main.c += -Wno-implicit-function-declaration
|
||||||
|
|
||||||
LDFLAGS+= -nostdlib -Wl,-Bsymbolic
|
|
||||||
|
|
||||||
NEWVERSWHAT= "User boot ${LOADER_INTERP}" ${MACHINE_CPUARCH}
|
NEWVERSWHAT= "User boot ${LOADER_INTERP}" ${MACHINE_CPUARCH}
|
||||||
VERSION_FILE= ${.CURDIR}/../userboot/version
|
VERSION_FILE= ${.CURDIR}/../userboot/version
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user