Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1197036lqb; Sat, 25 May 2024 09:43:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXXYqC43fe0R+SqH27s50iuPo1kKW6VbAndE0NEPSHUab41s/RkRvH2fQQaDyF+gggeGgjzf+uzLWVqGA4gqAUoJye+ZeTEIrAPQiqWYw== X-Google-Smtp-Source: AGHT+IEGALkM8QMoivhnGdDe33sObHslmFMO/+wFXI69pAlLWWOx6FeIppwx8JnwxcgYR5qO5QqI X-Received: by 2002:a05:6a21:788c:b0:1af:ad23:3d7b with SMTP id adf61e73a8af0-1b212df06b1mr7791707637.44.1716655433084; Sat, 25 May 2024 09:43:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716655433; cv=pass; d=google.com; s=arc-20160816; b=yUl9aTYRwoe0oBWt0RbrC6di0638nCvbzcqsPtArgt59773kZ7aEbseM8jjyt/8qK4 o8n5Y8Pi88tHgwj1HqB00+N/g1KOe6fRbGRmz50pcEMXH1DOBjP0Sb0hzQhiaVjpCIvY 4Ah8PpS+S0uAF3KwWAhevtFMC+YUKoUPygnT0vzlwOt0OQlox5aLm4BaG3j+c+wS+4zI 9twnOdxE0MgJW7b8JOK18AFIXN007rxgRVxSyu0ncuCAmbWTxHAkKkkLiT90BwYFllsD zBSXFEY5QMKRyxZ+KRpF9dLUpM+HsbaWEQ9vfltaP6szfSYN5ibxPzHTp5McngoeMDeE hlOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=hNWsEEy4f55dYaU9yuHND+F+UZr4eQldbSfu90K/7CY=; fh=GOjSl+am2wTJ7f2IBMGEeeK7XCIOHSWEBXdcj/Fs5tQ=; b=IbJz4zKLZiDzNke5ngIlGc/a6j19lYjxoORpIerVzFX8r83YZdMsAUSV2vjHBdQG/a fzROVbBAQsunpP80rsVs3Cq3NI7l0BSMtWwnpT5dOHpHu6r23ZPv11fAlMF4tbxumUQB TgqzdRGUr3D0IppoPQauDDW0P0VJQ4cGWqHkMi4Iz+hvk9epIC+1ILvtuYcaxfq3lB0I LH9Pwx3CGV37T3U/m3ywJNem+pLAPExzvYqsapmQ8R3zEcNwHfGgkEAauql5MZbknKwX mlUPvVQcrZh+IlcHwx/n0qiVfTVQevZT8lQ/z8W2b+SWQxybnwK4bJ6W4hVFcdtE1t3L 3eFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VQqtpjF9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-189449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189449-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6822bbcb885si3070925a12.902.2024.05.25.09.43.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 09:43:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VQqtpjF9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-189449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189449-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 90FD8281C28 for ; Sat, 25 May 2024 16:43:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BEDC86272; Sat, 25 May 2024 16:43:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VQqtpjF9" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8F37487A5; Sat, 25 May 2024 16:43:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716655423; cv=none; b=c118QrdgyCSlZZlJnLdBDX7fiRLEquiUEm0LeVsb8LrSHs4GYduz2hgHKsSFbn2RQ4ohtnB2VllrxL/9y1F07Pde3aF0Y5DaH7wifqneblD195a6jm4UKibZFKhWeyD1P7yry5/quMm7dDtNj7RQprj5k4m4cX/TQR3153UuuxE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716655423; c=relaxed/simple; bh=BYvRVlfnOcEYCohSU9+i09Mb94lZWB25nxoPHqEd0Lo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=I2O1ILAelfdsVYL3Js5DIXexgzRzDwGE/mpoWZVOb7KBJTFoHPn317XKWDT96ho7mNz8auqD2zAsMi764+sOcc+jGSumgxTpMrtJhp00EQrgQbuQ2xWguyHLakIHqPOT2zBgs/LpVZA0a81vlDU9ULp8hkScxGSueihonK8XmmQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VQqtpjF9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48C50C32782; Sat, 25 May 2024 16:43:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716655423; bh=BYvRVlfnOcEYCohSU9+i09Mb94lZWB25nxoPHqEd0Lo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=VQqtpjF9ci4TPs43sML4DRO6vWzmik2gcCGgE+GkYfnYvRG/M+vOkmXt+6stMhwLt VTNDWHqvhai/cNU8SVheBNeFZLQZQKKQ6eUsnjdXbGEnDgOqpCxX27+SmipVMXryKz EH7epCNj8esHUS2vIuo94Dz7LJrk8QKQ5SKjer8RnLDZzbQPxbP7ex0PSCGLVvtXLp oLK7Lj3G0rPSrcBo1UWKqNTSX8DDrMliwuD7cPivwdenX4u8vQQ2M0jHZgho9/3DQS HuoTNoL4W941MxLn9HjS8SlINoIOsulBKr3rF7DqEGHAbIYzKIWUtkEN/zV78liRi4 pDb65u3yAlOdw== Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2e6f2534e41so85398291fa.0; Sat, 25 May 2024 09:43:43 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVb4q7tbW0A0+UPZEO/cPjyY0sk69EgM1tDnUrOFDe1J/Mcb9txjLX31CD6Vk8W+eWjfSDIq9LpXk343dFQxonpQgcKbG4N25Koz6YhyuDBGb9VoQTVziunPn/W9rkF5IRAHirDAJriWV/uF+FfaFO0nWzUGl8OnwUSHcFnhg== X-Gm-Message-State: AOJu0YwvLOm7idn3Ql73J0Wx2yNwn77pj/o3D72YlT/IldUD4H2avBBN x1D0f5WJrqCvXMreW6VfUYHX4dWvSBCpR00EzzxVgDjQzF+PTIQpT3QiUuF0v8etm0G9uhe7+ye QP6n1jpQhErmYwU4nH0Jo31F8wsA= X-Received: by 2002:ac2:4e10:0:b0:51b:e0f0:e4f8 with SMTP id 2adb3069b0e04-52964bb0ea4mr4203773e87.31.1716655422028; Sat, 25 May 2024 09:43:42 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240522114755.318238-1-masahiroy@kernel.org> <20240522114755.318238-3-masahiroy@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Sun, 26 May 2024 01:43:05 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] kbuild: remove PROVIDE() for kallsyms symbols To: Ard Biesheuvel Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Arnd Bergmann , Nathan Chancellor , Nicolas Schier , linux-arch@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 23, 2024 at 6:32=E2=80=AFPM Ard Biesheuvel wr= ote: > > On Wed, 22 May 2024 at 13:48, Masahiro Yamada wrot= e: > > > > This reimplements commit 951bcae6c5a0 ("kallsyms: Avoid weak references > > for kallsyms symbols"). > > > > I am not a big fan of PROVIDE() because it always satisfies the linker > > even in situations that should result in a link error. In other words, > > it can potentially shift a compile-time error into a run-time error. > > > > I don't disagree. However, I did realize that, in this particular > case, we could at least make the preliminary symbol definitions > conditional on CONFIG_KALLSYMS rather than always providing them. Fair enough. I am fine with dropping this statement. > > This approach is also fine with me, though. > > > > Duplicating kallsyms_* in vmlinux.lds.h also reduces maintainability. > > > > As an alternative solution, this commit prepends one more kallsyms step= . > > > > KSYMS .tmp_vmlinux.kallsyms0.S # added > > AS .tmp_vmlinux.kallsyms0.o # added > > LD .tmp_vmlinux.btf > > BTF .btf.vmlinux.bin.o > > LD .tmp_vmlinux.kallsyms1 > > NM .tmp_vmlinux.kallsyms1.syms > > KSYMS .tmp_vmlinux.kallsyms1.S > > AS .tmp_vmlinux.kallsyms1.o > > LD .tmp_vmlinux.kallsyms2 > > NM .tmp_vmlinux.kallsyms2.syms > > KSYMS .tmp_vmlinux.kallsyms2.S > > AS .tmp_vmlinux.kallsyms2.o > > LD vmlinux > > > > Step 0 takes /dev/null as input, and generates .tmp_vmlinux.kallsyms0.o= , > > which has a valid kallsyms format with the empty symbol list, and can b= e > > linked to vmlinux. Since it is really small, the added compile-time cos= t > > is negligible. > > > > OK, so the number of linker invocations is the same, right? The > difference is that the kallsyms symbol references are satisfied by a > dummy object? Correct. In 3/3, I even reduce the number of link steps when both CONFIG_DEBUG_INFO_BTF and CONFIG_KALLSYMS are enabled. > > That seems reasonable to me. > > For the series, > > Acked-by: Ard Biesheuvel > --=20 Best Regards Masahiro Yamada