From 28565796df769e0a8d5ab1f8424cb262e40edc2e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 20 Oct 2022 18:22:44 -0600 Subject: [PATCH] binman: Allow obtaining a symbol value Provide a function to obtain the integer value of an ELF symbol. This will be used 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 6d440ddf21..fec2116880 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. '