Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp874120lqp; Thu, 23 May 2024 02:36:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU4D5oRkPoYEWWBdqiRjJGw9OE+DiOH6eKqewNJqG4OTiSn6HxQ8npahpN+fgnzovR+9E+mYCAs+twiV6V2aRquIGngzprD+3rzE3r4qA== X-Google-Smtp-Source: AGHT+IHzhRAzx9LE88xT4MxDA1dDS27jzJJkihEgn1BNQb1R0Gg9us162MvbxxqoCSlJDRh1jP+L X-Received: by 2002:a17:902:dac7:b0:1f3:61c:30a2 with SMTP id d9443c01a7336-1f31c96530bmr52581795ad.2.1716457007862; Thu, 23 May 2024 02:36:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716457007; cv=pass; d=google.com; s=arc-20160816; b=WSDDjQJn72NHHIk8PUTD93w3Az/QH54M7mUaVf0VtJ3DBC8l/dO5h+4piAvABDzULl 8aMz/pLlV+WFc0LzAjMsZKRtSwrlCvkpye6UdWt8WAMD7KQY7dnntjSYTqp89MUA8iCf KtZATyBuau/KFkitwbvsI1aWtq4/p3UwFoD+jD113d8k+2lj1WpZfuftbDldMcrXDcv6 dT/HJNsqh3jqdREb8qCRfMP2JJOrFyzYkQv+oJftK42rZjVew5iWMJ+5lni1eDb3gwSH QJ/lXj2wmDtJ0UzQPiqYG3ROC3FPQVbhg5oA8SkCZIl3htUUMQbPMiW+JGtYtgCYOfZH sqOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=IUGCKCyYLNuvFwAIb5pwUmt9t6N4lg8DApcDooJP1dk=; fh=xjhcxinXCgAwIIuB5/nj8UYigY1GBrnAtcZ2ubvffQs=; b=I5S2EraNeuaWStwahPI/Bg3PjHJEVbnf+dxPFY0AHKHKb2O5dCMz4ybuRuEDDNv0Cs GcxbDXmG2rLA3Mab/ksDI9B+nuUOTuubMpw4Jx3Lby1PgiwxjF5RSA5mX7N2n1UoZXlE RK9n1JFTB7ClTggo0JjpnXoY4ixlLnhgatMEwAp2Ok3vbTBnbsDiDbZkX0WXVbWWj9tw SJ3Tjx5UgNudNh3NCnnGllH4ZYrnFpFARZ0Y6VBXPsfWeex53Pb/6MbT+wB6XBL+AeCN C5ep8dmGkvHJiJVSjgvZ9AxlbrSHTeYLRnuivN9F4neKNOQOPYl1+yAb8bvaOvVyaYCW tOCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MyMk/sgC"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-187271-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187271-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c1395d8si508245ad.472.2024.05.23.02.36.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 02:36:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187271-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MyMk/sgC"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-187271-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187271-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 6471EB22591 for ; Thu, 23 May 2024 09:32:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9BBB13D28D; Thu, 23 May 2024 09:32:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MyMk/sgC" 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 D2FF1446AE; Thu, 23 May 2024 09:32:02 +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=1716456723; cv=none; b=fuI7Ng5I5T3iRlHYE20eXuC2WVrO84SJUFK2il8OGMjMK69p0D1aIMrO5z/8T/BnyFJon5X9ySE/e/H4e3knB0tHB9byXReXB29V5cVOZmkZ3Y+WUr36YZRZ1hSbqe/hOWeapdTqR2TN8MnU5NM6eQ52K0oCO8mWn6lhosQvm1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716456723; c=relaxed/simple; bh=cX95jCA9O9tZPPJJ58l7jYy+M8WwvnaiJK+eob7aWZU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=isz0nXBtIxQqRLtB8GCUar5U+Q+3iSiG7QZB5U8cxeb0P9qVPYd673JA8RUOGHBs7gxEWBRnuPNfR/XqICGkAv2oYENawPlvlnCwHcMvkeeQrFLOPyntWTphKVRJkwzNV2fR7MYl5EsH8VrY3otEtpJVFF36dKyX+VO7tzD1J88= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MyMk/sgC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65C1AC32789; Thu, 23 May 2024 09:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716456722; bh=cX95jCA9O9tZPPJJ58l7jYy+M8WwvnaiJK+eob7aWZU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=MyMk/sgCm4Q27fBluf6XB5lx0hpYaSEIPIpXLanxP5xeatHdBIy2u26ExI5w1HW6Q utLVTkmDRCuAAudcNK3H28LxRpTI1Ri/C7htoqGBahyHoBWr5rjHnrME4rcmK7d7UF 4CRf8+YKUqsixfD/3bvUxtiu1VvQsqxIbXygbNkSWO4NkpX4c+QPB1nCeFXiOS0vxC xuUdznkt6Ucbb3MWHR6H2wv0i4RvWux768VtrOJHZgxoWT2J36BdFZyC36M7NKUCdt fEnk+CIq2NDLJmvhBq8V62012iaIp4PMssjvhWreTbZt8Xsf7G2LSVmoK0Y8VkXx74 BTx5EpywBkuVA== Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2e724bc466fso57252431fa.3; Thu, 23 May 2024 02:32:02 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCXfLjblEv+gN2/eBWQjcglhfs7RKhksCbPrFBxmcYTg+bNfnHB04RJEZvvPfZIZE3UWWOwxqAmhq+M92VWGsFdE4vCyKZAhaiwls10/sIu/+q2NNcRbBpCiqsvHe8p/EoLsybX47Pky/kXBHFqk+f8+siAsnPUug4Auw4REmA== X-Gm-Message-State: AOJu0Yyg1Rt54kZL+dNzlG/LC+8faMQF3J1b79B8hidgqkJBHDKwu37R mpqbdXNNGxw8/O+7B0it9d/u4BnsxzFxDyzQ9odlp+NKwIqMNNG/6RLih1Mknjz8cwLF0xam9iR wQh5eMbVbiFniklGiCYS9ncQwHzQ= X-Received: by 2002:a05:651c:216:b0:2e1:f338:d228 with SMTP id 38308e7fff4ca-2e9494cf3d6mr39701131fa.20.1716456720722; Thu, 23 May 2024 02:32:00 -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: <20240522114755.318238-3-masahiroy@kernel.org> From: Ard Biesheuvel Date: Thu, 23 May 2024 11:31:49 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] kbuild: remove PROVIDE() for kallsyms symbols To: Masahiro Yamada 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" On Wed, 22 May 2024 at 13:48, Masahiro Yamada wrote: > > 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. 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 be > linked to vmlinux. Since it is really small, the added compile-time cost > 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? That seems reasonable to me. For the series, Acked-by: Ard Biesheuvel