From nobody Tue Jan 24 22:09:52 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P1h3P2Trdz3bdRv; Tue, 24 Jan 2023 22:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P1h3P1MZbz4HCF; Tue, 24 Jan 2023 22:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1klWYLZ6F+mE12hqhMu2fxLzXD10IKJ5c0tP5UQ0BLM=; b=WF8VroZcCe2MNlb2uUdyIGhqX3tumEXool+VyYw9TIejIN8RY/qHOM9Zu0jnt7hYEhDZRq 2KHfe65i+DJcIYI6Pp1c0P55COmiaybAkuqYmmsfXCwTTGQv7HUgVTm/LSl9GWeBuKAV2x iuhEBfB/VDyNbo92UEOkZII1Xj9pywzUfhVw/zNfeXIUE+iwNaXef+gC+9mWbozVDjth3I tRS8zTxaZGmNB7wrq6CmKQSbLKFQeukbOyD3VOufWT7P/pLTCUzKRP7c44OtYT3MPIiBq0 6d8Uj17Rp3f+gHNL19ZMNM2rg9+rgWEdby2ONeNRXl06RMePBLsZOHUSTgBvEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1klWYLZ6F+mE12hqhMu2fxLzXD10IKJ5c0tP5UQ0BLM=; b=fc1ocCNkjnORhyre6ayrS/a05snBqFh9FexnS0s3GZ+Sg8JwkxaxOtH7O9W1lR8tbxL/3K ypzRL4Xv4rDVcrIprFq4aAaLB6r8A/QjqvgOx2eqk1Qy7XXGgeMqQcHHbW420GVs7dc/F7 ZQXL85o0g5pMtOIXAqEXqtWEJECAWnCtL0Xz6t+Y9fVhvnhdin8Bz1Wg19Bo1eVbMvSvV5 rTzv+Iy3aR2I0S6GKz4P/qaL/8yRbvxGaVp1F7kKR45XSwhUTnv9DWux9/iswE+WwSjiYW kizJ0sjH1Zu75wnDVO1yx7TvKfNIlKw5eQJr24d8Qd711WhioQVXVL6VP3JPmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598193; a=rsa-sha256; cv=none; b=TebEvd27YIj6IZG1sJj28MLg2AZISHg9QGKrzu0bbbiM0ohs0G2VKRFYzqb40oKk3pywfQ nwDj5TII+gk3WpuvnHbdXTSq/7qf+OwSJy1lONAJ6C35Nhq3IeQyxvn7W+YMF1EDGwobqS En30kJktFgBqJ0cX5JYq+sor4JyvAcjXcNupUbXiV3JXmuRQtAByI0BCKihqJWG+BFu19L RYpX1EmOVX2GUYX6zoHtBNqYCKgb/2kr01htIXiwel92GiMVq634NdpIVIz+qHFCvVUEzC 93lrlJ3JSUyI2MFg3hrEcSfx4YkfouJ2qIm6P1u9FPDYbOHIwMwtzzU5xgbKhQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P1h3P0PkPzQF7; Tue, 24 Jan 2023 22:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30OM9qVT070901; Tue, 24 Jan 2023 22:09:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OM9q3C070900; Tue, 24 Jan 2023 22:09:52 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:09:52 GMT Message-Id: <202301242209.30OM9q3C070900@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 4f2e5793d753 - stable/13 - Fix build of stand/ when building world with ASAN List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4f2e5793d753cdd2e5625fc292a9d8e1ab4dfa39 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4f2e5793d753cdd2e5625fc292a9d8e1ab4dfa39 commit 4f2e5793d753cdd2e5625fc292a9d8e1ab4dfa39 Author: Alex Richardson AuthorDate: 2021-08-02 08:50:16 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:17 +0000 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 (cherry picked from commit 5e9226f063bc43574e2168b4aafad8232f08002a) --- stand/defs.mk | 6 ++++++ stand/userboot/userboot/Makefile | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/stand/defs.mk b/stand/defs.mk index bbebf270c7ef..765fd046a879 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -25,6 +25,12 @@ INTERNALLIB= # 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 index 767840101200..60fcf57d9697 100644 --- a/stand/userboot/userboot/Makefile +++ b/stand/userboot/userboot/Makefile @@ -6,6 +6,9 @@ LOADER_CD9660_SUPPORT?= no 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.main.c+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs 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