From mboxrd@z Thu Jan 1 00:00:00 1970 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 0CD17C54EE9 for ; Sun, 25 Sep 2022 15:04:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2DF0E84C41; Sun, 25 Sep 2022 17:03:46 +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="aEOeeD0x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DDF4E82A33; Sun, 25 Sep 2022 17:03:24 +0200 (CEST) Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) (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 8E5C082A33 for ; Sun, 25 Sep 2022 17:03:21 +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-x135.google.com with SMTP id a4so2404307ilj.8 for ; Sun, 25 Sep 2022 08:03:21 -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; bh=sZHYLkCtSdM1TP6RMQ+LBhNmzz3B5r5F0JThJLm/SS0=; b=aEOeeD0x4nQ+qr78DlNDbT9hKaGBVhpd/LjmYEkCK+o98A589feyPtLTDlboH2p1PD Hu7HAEZVmJ6RD+1ZjrPYVu8zrD09N1nSZbJ/KDjt0SbANbgEYj8yR9cFs/hfubiVrLCn CExMMfsHLQzoi8XZso3dXIRkSLzkuVoRhx/d8= 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; bh=sZHYLkCtSdM1TP6RMQ+LBhNmzz3B5r5F0JThJLm/SS0=; b=P6iOwECilLxv/XK3njcEx9fo33Nuxz2JHtcWSYpS4ycdVbLOvO/hkghk40Z/9lpDUO vhi4SxIsPpZzS+g1EtBeoL/EThr0V3E/PR0TDLW2KbwJQrLgMgJvBG2HrtC86bQL6bRo sucn8xiTufaVVirfOBJgW2IhjCowUxTXH6GM24FfjonoCA4qT2JcpH5Hs3NeIeoRJ1P1 0FLn0fEitLDVJW4QrF9TJgc97Xyos/sKe8yc9o0OErxEo8tiwAwixn/HqFMK9R/iE9Jo ehvPIbFRzF8FeAppZ8O+kpTYAbAGIbQacv/VhCevQQnGYvksVNm2ZHytj8eCdXwK/Kp3 E/7w== X-Gm-Message-State: ACrzQf13PtH0lFSCISPvR8yodsP6Ipqn2tMtaCbf8d5YozNACc9aKoPn XynBR9HP18liU5F4eK+S8KlCIYsTqeGUfQ== X-Google-Smtp-Source: AMsMyM4mzDmZ50QLZLHRV3Y1TVdUW5RNOe6K+qn1xxhWbadpC4fn4jyj0jmKkLK5jybjwXZ/QgCydw== X-Received: by 2002:a05:6e02:d4b:b0:2f4:9a90:503c with SMTP id h11-20020a056e020d4b00b002f49a90503cmr8047258ilj.217.1664118199699; Sun, 25 Sep 2022 08:03:19 -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 u19-20020a926013000000b002f19d9838c6sm5360578ilb.25.2022.09.25.08.03.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 08:03:19 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Alper Nebi Yasak Subject: [PATCH 10/45] binman: Allow obtaining a symbol value Date: Sun, 25 Sep 2022 09:02:13 -0600 Message-Id: <20220925150248.2524421-11-sjg@chromium.org> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220925150248.2524421-1-sjg@chromium.org> References: <20220925150248.2524421-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 from tests to check that the symbols are correct. Signed-off-by: Simon Glass --- 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. '