From nobody Mon Jul 31 17:28:34 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 4RF4ys6Pc7z4pLpb; Mon, 31 Jul 2023 17:30:59 +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 4RF4w41L8Mz3hkc; Mon, 31 Jul 2023 17:28:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690824516; 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=7g47/aPMlbWDdKeck02eQLqoK75oFcBoxYfLkSM/woQ=; b=akjIYOE5a7tBb8VP66d2xH657tBn9Pmym6kU1q+q5dUtdQcLerBvYhH+wQSuwbSUivT+da waF4Xu2mK7MSNhRM7g7d/GBIxGwzB+rhT31WUCQazOuiEaoQ3Y+vV0ns7o5YD8nVkOXEVq pOlzzl47IqPDNvZvyoe6ia2A2ABFX16GGmT1+0uxaFIQ0wH49NI9LF/tTyu+Xe9U1qYEeA AsFbAw4Kiy+7O8qsF9GsMNTJLI0X6IF7N1DZCyaVg1WHkSztdpX/WuXSYBdG60lE76CBWR hpaNhJcH+e5mIsBRGzqtj1YX4kZ9+UbwR4m2cun467v60ddv+9t6AnXEPBmtCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690824516; 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=7g47/aPMlbWDdKeck02eQLqoK75oFcBoxYfLkSM/woQ=; b=lQAW28amAuexH9cTVD/1zSMCbQ64e2I4ySvflLgS+PIAzKmHViCn+kIYQumIxXsnugH29E Vm4Mt2hUxOgM83OzaC8ekeTeiOBEp14rlKPk12ApOd1TDrPD/tgQS+Ry8lEhUhsq6SUxEn 1PJKz08p1F1+Wws0aczPSLmahdDhY090dzqHtwCLd/oh3wk6X7YVDtm2dinUNcFYtAjqpc o6ttMHvyNuMp7N75K40/DIrc1PduzmunpIondVAW/mHv+WwcY9gVxljN5Fs94xOqXRSBH2 AIJ6kH0nwa80IHoOPi2Y0ymf0NT07HznVzjvX2enetoZSszFsfdxhbW7Qgb+aw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690824516; a=rsa-sha256; cv=none; b=UWCGwIGjb/OSkBAaSeIHB6SlpVVlVelxDp/vwdRu2OmLnrR5eQm8pLlWAE78RtDcfnXhj7 acyfeT7YGlGEVpe6bfYDoBp64DEtFMlzFgy/ng9K6ijvym6v/bqnBWkDU2CUgaAUII/CCo 3UkODS7tihUIrz0pBIA6Fn3S8Y53ka5pIm0QJsH+CTKYKT+2730EJRJfYP4p7Du15Srjdp dY/yiuz6/sKt3h9hXu8K+K+8kMq40Wlirp3/Fo6ViVih+DFvGrSKqvS1SOrZJ9CCFKI/mE 3xAhkDGjji1P1Q4YwOKrz217yay9s8+v4sTvs3XVCe6a9hKFdAPdz1aGZR7YpQ== 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 4RF4w255Vqz140W; Mon, 31 Jul 2023 17:28:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36VHSYVb058122; Mon, 31 Jul 2023 17:28:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36VHSY2t058121; Mon, 31 Jul 2023 17:28:34 GMT (envelope-from git) Date: Mon, 31 Jul 2023 17:28:34 GMT Message-Id: <202307311728.36VHSY2t058121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 01718a2e94da - main - tools/build: Work around broken Clang FreeBSD resource dir logic pre-13 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: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 01718a2e94dae03994448f40e0b57a3432f5272c Auto-Submitted: auto-generated The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=01718a2e94dae03994448f40e0b57a3432f5272c commit 01718a2e94dae03994448f40e0b57a3432f5272c Author: Jessica Clarke AuthorDate: 2023-07-31 17:28:08 +0000 Commit: Jessica Clarke CommitDate: 2023-07-31 17:28:08 +0000 tools/build: Work around broken Clang FreeBSD resource dir logic pre-13 Prior to Clang 13 (e.g. in the Clang 11 present in 13.0-RELEASE), the resource directory logic for FreeBSD was broken and would not resolve symlinks, meaning symlinks would only work if in a directory next to the containing lib directory. Therefore we cannot even use a symlink for worldtmp, we have to make a wrapper script that execs the real binary via an absolute path. Reported by: markj Reviewed by: markj Fixes: 65f28f63a73d ("tools/build: Create toolchain symlinks for non-absolute compiler/linker") Differential Revision: https://reviews.freebsd.org/D41238 --- tools/build/Makefile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tools/build/Makefile b/tools/build/Makefile index 46fd5c7d3159..fd7fd158f169 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -338,10 +338,21 @@ _host_tools_to_symlink:= ${_host_tools_to_symlink:Nsh} .endif # We also need to symlink any non-absolute toolchain commands. Clang finds its -# resource directory relative to itself, so CC/CXX/CPP must be symlinked, and -# we do the same for LD for consistency. There should be no concerns about -# installing over the current system since we don't use the toolchain during -# install. +# resource directory relative to itself, so CC/CXX/CPP cannot be copied, and +# there should be no concerns about installing over the current system since we +# don't use the toolchain during install, so that's not an issue. However, +# before Clang 13 there was no symlink detection for FreeBSD so that was broken +# in the same way as copying (https://reviews.llvm.org/D103346), thus create a +# wrapper script for each to work around this and behave like a symlink. +# Remove this hack and just use a symlink once Clang 13 can be assumed. +# For consistency, we use the same strategy for LD. +.include +.if ${.MAKE.OS} == "FreeBSD" && ${COMPILER_TYPE} == "clang" && \ + ${COMPILER_VERSION} < 130000 +_WRAP_HOST_TOOL= sh -c "printf '\#!/bin/sh\nexec \"\%s\" \"\$$@\"\n' \"\$$0\" > \"\$$1\" && chmod +x \"\$$1\"" +.else +_WRAP_HOST_TOOL= ${_LINK_HOST_TOOL} +.endif .for var in CC CXX CPP LD .for X in $${_empty_var_} X .if !empty(${X}${var}) && !${${X}${var}:M/*} && \ @@ -382,7 +393,7 @@ host-symlinks: echo "Cannot find host tool '${_tool}' in PATH ($$PATH)." >&2; false; \ fi; \ rm -f "${DESTDIR}/bin/${_tool}"; \ - ${_LINK_HOST_TOOL} "$${source_path}" "${DESTDIR}/bin/${_tool}" + ${_WRAP_HOST_TOOL} "$${source_path}" "${DESTDIR}/bin/${_tool}" .endfor # Create all the directories that are needed during the legacy, bootstrap-tools