From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 078FD158015 for ; Fri, 22 Dec 2023 05:32:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EAD532BC029; Fri, 22 Dec 2023 05:31:59 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CDA652BC027 for ; Fri, 22 Dec 2023 05:31:59 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D2902340DE6 for ; Fri, 22 Dec 2023 05:31:58 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 38CA29C4 for ; Fri, 22 Dec 2023 05:31:57 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1703223074.8f404c038705389cefd86e8a1fba1b50074a01ae.vapier@gentoo> Subject: [gentoo-commits] proj/pax-utils:master commit in: / X-VCS-Repository: proj/pax-utils X-VCS-Files: lddtree.py X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 8f404c038705389cefd86e8a1fba1b50074a01ae X-VCS-Branch: master Date: Fri, 22 Dec 2023 05:31:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f4317322-77c1-4a3d-9f5d-b563cddf0bd8 X-Archives-Hash: 6ad4127e0f8243e69572da9d58eb388f commit: 8f404c038705389cefd86e8a1fba1b50074a01ae Author: Takuto Ikuta chromium org> AuthorDate: Wed Aug 29 06:07:30 2018 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Fri Dec 22 05:31:14 2023 +0000 URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=8f404c03 lddtree: keep relativeness of invoked program in elf wrapper This makes clang's resource dir relative when we pass -no-canonical-prefixes flag like below. $ chromium/.cros_cache/chrome-sdk/tarballs/$BOARD+$VERSION+target_toolchain/usr/bin/clang -no-canonical-prefixes -### Chromium OS 7.0_pre328903_p20180425-r5 clang version 7.0.0 (/var/cache/chromeos-cache/distfiles/host/egit-src/clang.git e7408fe366bb18923fa360b069b4e4566203f34f) (/var/cache/chromeos-cache/distfiles/host/egit-src/llvm.git 95561668f063fbcb8195bde05ecede721ece4ba4) (based on LLVM 7.0.0svn) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: chromium/.cros_cache/chrome-sdk/tarballs/kevin+10750.0.0+target_toolchain/usr/bin Without this patch, -no-canonical-prefixes has no meaning. $ chromium/.cros_cache/chrome-sdk/tarballs/$BOARD+$VERSION+target_toolchain/usr/bin/clang -no-canonical-prefixes -### Chromium OS 7.0_pre328903_p20180425-r5 clang version 7.0.0 (/var/cache/chromeos-cache/distfiles/host/egit-src/clang.git e7408fe366bb18923fa360b069b4e4566203f34f) (/var/cache/chromeos-cache/distfiles/host/egit-src/llvm.git 95561668f063fbcb8195bde05ecede721ece4ba4) (based on LLVM 7.0.0svn) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: $HOME/chromium/.cros_cache/chrome-sdk/tarballs/kevin+10750.0.0+target_toolchain/usr/bin This is a part of effort for build cache sharing when using goma by removing absolute path from compile result. Instead of enforcing relative path, I keep relativeness of compiler path. I confirmed this works as following with a debug line to show ${base}.elf. (sdk daisy R70-11005.0.0) tikuta tikuta ~/chromium/src $ ln -s build/cros_cache/chrome-sdk/tarballs/daisy+11005.0.0+target_toolchain/usr/bin/clang-7 clang (sdk daisy R70-11005.0.0) tikuta tikuta ~/chromium/src $ ./clang ${base}.elf: './build/cros_cache/chrome-sdk/tarballs/daisy+11005.0.0+target_toolchain/usr/bin/clang-7.elf' clang-7: error: no input files In previous versions of this change, it ran like below: (sdk daisy R70-11005.0.0) tikuta tikuta ~/chromium/src $ ./clang ${base}.elf: '/usr/local/google/home/tikuta/chromium/src/build/cros_cache/chrome-sdk/tarballs/daisy+11005.0.0+target_toolchain/usr/bin/clang-7.elf' clang-7: error: no input files I confirmed this can build base_unittests on daisy and amd64-generic after creating a new CrOS SDK with chromiumos-sdk-tryjob. Bug: https://crbug.com/846610 Bug: https://crbug.com/876604 Signed-off-by: Takuto Ikuta chromium.org> Signed-off-by: Mike Frysinger chromium.org> Signed-off-by: Mike Frysinger gentoo.org> lddtree.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lddtree.py b/lddtree.py index 80808fc..bbf9df9 100755 --- a/lddtree.py +++ b/lddtree.py @@ -182,8 +182,12 @@ def GenerateLdsoWrapper( "argv0_arg": '--argv0 "$0"' if interp_supports_argv0(root + interp) else "", "preload_arg": f'--preload "{preload}"' if preload else "", } + + # Keep path relativeness of argv0 (in ${base}.elf). This allows tools to + # remove absolute paths from build outputs and enables directory independent + # cache sharing in distributed build systems. wrapper = """#!/bin/sh -if ! base=$(realpath "$0" 2>/dev/null); then +if ! base=$(dirname "$0")/$(readlink "$0" 2>/dev/null); then case $0 in /*) base=$0;; *) base=${PWD:-`pwd`}/$0;;