Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp609592lqt; Thu, 6 Jun 2024 12:45:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVoYU5aj6gyfPU2NlU6jqkWmeu4W/YRZ9gpz1kKYhxWk/oHY9Voc+19NOmXlNyaS2U2NusZRJQRkRVbnuYDVQLJ6BbIgBDzEgUwTJFXpQ== X-Google-Smtp-Source: AGHT+IHy2bYz7AXvMyOhbsTTYG3QV79HUonDlRKJSbBisbsKYWRHB2EC9W81E5QcPwsV138tVZVS X-Received: by 2002:a05:620a:2012:b0:792:b995:3a3d with SMTP id af79cd13be357-7953c4480c5mr36142485a.45.1717703133164; Thu, 06 Jun 2024 12:45:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717703133; cv=pass; d=google.com; s=arc-20160816; b=q4oik2WVgnSOlQvOq04gcO7cWDs2HIrh3+AslJ+R8xVPisDwdx33kOIiKfnrqWHvvj j2VwqAq5PHfJDbYVqHXF3DrTmupEUZK64qyAxqsoIZjtQQH2jFNKF9dLuEuw2OVr0p44 flSXGNcjplMc/b0xyDNRF8lOmsEtm/ccbB1hBtQlkE/JCRBAG0S9cpLm6xZMTyfRNgeu rAHc4h57dNBhL5NUu7B7JR9HjiymIJvxf2EBi3EgBVHaWOCr+2gtUTYMErP1V0nn4nqD zCNxsxptEVksQInJDVHe0LulHPz/Wgg5AJpCsrdfJ+NHh5btF4PAMoyHcEjL7LaGlP5n FKzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=G/AqedslKrWa+s5gg3EmZQtIfBuBJwo7LFbJENNBdaQ=; fh=1H1z9aAjrk0wwJJunQ8+UGw/Y6Iv9rTVBDC0sKXmJF4=; b=e8a1xJ8wL+ckMCTJMSzO82JimAJht/DDRCfSBIc/eSFGZw7i4sJpw7idD6Cif+C54E Zi2zZwU222bc8grnj9AkxKuXbUcYAbvAI9wPSETxHBP7w5cUWyCTE5dHxnrkwDIGTFjt 6uaxeU1kn/hIJoVobiNoZmBs4abjxAERbDET1Dh9j8mYPABA+Q/n4Ukqn7ky7VMeqySV 4726KSO8p60EpaisJDYJIwWOZEInpJ3YtkhNbrmXUYIu7uoJ++TwQiX6K60KD+6HqV8k 4pJV6Bspjdg+tXg1a+w1+sm3hmZs3Zgl4M8Nl9twQw8FJyx5SX1JkBwsdO5TufJEIcAy ERog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a735HSmi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204952-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204952-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-7953338aecbsi201848885a.697.2024.06.06.12.45.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 12:45:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204952-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a735HSmi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204952-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204952-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DB6751C267A9 for ; Thu, 6 Jun 2024 19:45:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 340D06E611; Thu, 6 Jun 2024 19:45:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a735HSmi" 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 6012D3BBCC for ; Thu, 6 Jun 2024 19:45:27 +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=1717703127; cv=none; b=siKe7KqrnNrGHJxPHqCSKaNxdBWoKRoCYGQPUFCwIiwRJVn0OmuAQryIwYwNvM+VzgkMsrQyEnBmU4luEO11+ytDsSGlzFkz+odWrJeyyDZjaanNj01/SThDd4uMIGNPgqY41Ul5lI8YL2/Eljqe+QcaAtj/KWqVfiALnqPnprM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717703127; c=relaxed/simple; bh=U8mfA5xA+fMcGi1rZTOg42lZRg/R+N+3UrY82wiZ9HU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kFbf1gRm5it5GB7h27JQL0BNRuWW2PNEer5kOYa7sO53abGfCLmTs5fOqka43pbTti3rYV/oyRIcqghbnoFRFKSpEcX1apxgjYoVPACkwlLrx3Aef3oWwjSqcGg7A9FfS4OBMMq4c74XB0ajJyrtzgfoKLjHW5x9mRso0cp89ps= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a735HSmi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7853C2BD10; Thu, 6 Jun 2024 19:45:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717703126; bh=U8mfA5xA+fMcGi1rZTOg42lZRg/R+N+3UrY82wiZ9HU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a735HSmizNNfAG+BGmyIGYKEB413vbi/u18+ryWD8ufj48Ss47wWfFaXsUfgU5Jun QK6uXHzIT/Rvr4mvA6UZCzMobnuqbk6MndYh010Q8gR/HsJXAKD1NYq2O2APJEwW2d ywppjix2iJkh8qc8zENNKaSjHdSprHUJf12988/QWF97Z24aYWYBs26AJtI2zHZFnz e1XLh+97GWaEbX5o5CMS0Ip9OdvUJ0NB0uHz/IhDWAClM6tUMn5EeSiHiIMHkk/eyn KjcKF3Oj1MhVdRGgmmDndGcZges6GwlzIYsyYQNEuiZheYRGmgda9AIG6s3sbEyCKE lpFCTJZW2nrCg== Date: Thu, 6 Jun 2024 12:45:25 -0700 From: Josh Poimboeuf To: Linus Torvalds Cc: Peter Zijlstra , Linux Kernel Mailing List Subject: Re: objtool query: section start/end symbols? Message-ID: <20240606194525.cdnnidxurejsjtx4@treble> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Thu, Jun 06, 2024 at 11:42:40AM -0700, Linus Torvalds wrote: > So this is related to my currently very ugly hack at > > https://lore.kernel.org/all/CAHk-=whFSz=usMPHHGAQBnJRVAFfuH4gFHtgyLe0YET75zYRzA@mail.gmail.com/ > > where I'm trying to do "runtime constants". That patch actually works, > but it's flawed in many ways, and one of the ways it is flawed is that > I really want to put the "this is the use for symbol X" in a section > of its own for each X. > > Now, creating the sections is trivial, that's not the problem. I'd > just make the asm do > > ".pushsection .static_const." #sym ",\"a\"\n\t" \ > ... > ".popsection" > > and the linker script will just do > > KEEP(*(.static_const.*)) > > and I'm done. Nice individual sections for each of the runtime constant symbols. > > However, for the fixup part, I then really want the section start and > end addresses, so that I can iterate over those uses for a particular > named symbol. That should be trivial. But ideally the interface would be less magical and wouldn't need objtool to sprinkle any pixie dust. Could it be implemented similar to static keys by making the static const variable an opaque structure instead of just a "normal" variable? DEFINE_STATIC_CONST(dentry_hashtable); That could create something similar to 'struct static_key' which correlates the const variable with all its use sites. -- Josh