Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E65E2C4332F for ; Thu, 13 Oct 2022 12:31:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0439C84F30; Thu, 13 Oct 2022 14:30:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="IqZ4JGfQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 61BC584F46; Thu, 13 Oct 2022 14:30:25 +0200 (CEST) Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AE7A584F26 for ; Thu, 13 Oct 2022 14:30:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x133.google.com with SMTP id l3so451049ilg.13 for ; Thu, 13 Oct 2022 05:30:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7uUbHyXLIwvJa1XB4uX2amibG8ePznzBX6UXDGX05r8=; b=IqZ4JGfQ3QqdgE5fm2VWebnpa4iRbmB4hnrvCn+PtYBwRAm3E8AV8ZPwRrHn4BL40x huVizHAsH6/aW7WaRJ6L1D6/3ghVbFaiNaUfj3Dy4Fe3wzYjQfJUFHTIIjlD9iA5jHaL lr0qcNyErpkISk48TQZgAMguEIJPvYV3ogIvg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7uUbHyXLIwvJa1XB4uX2amibG8ePznzBX6UXDGX05r8=; b=TVJTTCFaox9xRAQfYl8KmzAkjGW89ZJXjSfv1DcAXe8v+s5xi/rjbfzh57vWI4glWb XGLOL71PALTXM5W43D4rWea11GGZMxHZs2miHIh4N66GaTDBgsvF+y8xAycJMVWVww0q bx6tR2BCgFrU97u7hP+wzM7BNe0Nz28j7YCvYvuxgAlnGud0+ulJZeqvg9j28Og9cMPf kNTCAs1jRcRTVq0z3Rv6Ze3XXIUHAZSYybGMk9JnDevIvu12PaizvUwQP4H4hiiv1jts GNBuFec91UbqViOFI0TyMaFVdXnChQl69zRw3A24oZbxXQ2jGl7GEAcvACs3cPP/VFpn HdOw== X-Gm-Message-State: ACrzQf133qSNu1nVTHFuNvGAN/llbsZ3mgVZoDvqC71aMc+Ob3BLknW2 AaweokaYQ/aQd7pO3QdHJAxBaZsRHhXeNg== X-Google-Smtp-Source: AMsMyM6IzzMMHuq4tJSTqdEa/7qdejAABhKtxmKa0+euAAtJXwzroQXu8DjBvkHF7HW/gGTQQkaV0g== X-Received: by 2002:a05:6e02:1749:b0:2fa:5de2:4cc9 with SMTP id y9-20020a056e02174900b002fa5de24cc9mr16806767ill.214.1665664214907; Thu, 13 Oct 2022 05:30:14 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id a9-20020a027a09000000b003635ab4a7b7sm7321626jac.3.2022.10.13.05.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 05:30:14 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Alper Nebi Yasak Subject: [PATCH v2 08/45] binman: Allow obtaining a symbol value Date: Thu, 13 Oct 2022 06:28:50 -0600 Message-Id: <20221013122927.636867-9-sjg@chromium.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20221013122927.636867-1-sjg@chromium.org> References: <20221013122927.636867-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Provide a function to obtain the integer value of an ELF symbol. This will be used Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/elf.py | 53 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/tools/binman/elf.py b/tools/binman/elf.py index 6d440ddf21d..fec2116880b 100644 --- a/tools/binman/elf.py +++ b/tools/binman/elf.py @@ -188,6 +188,28 @@ def GetSymbolAddress(fname, sym_name): return None return sym.address +def GetPackString(sym, msg): + """Get the struct.pack/unpack string to use with a given symbol + + Args: + sym (Symbol): Symbol to check. Only the size member is checked + @msg (str): String which indicates the entry being processed, used for + errors + + Returns: + str: struct string to use, .e.g. '