[U-Boot] [PATCH 01/29] binman: Don't depend on dict order in ELF testOutsideFile()
Simon Glass
sjg at chromium.org
Tue Jul 17 19:25:24 UTC 2018
At present this test assumes that the symbols are returned in address
order. However, objdump can list symbols in any order and dictionaries do
not guarantee any particular order when iterating through item.
Update elf.GetSymbols() to return an OrderedDict, sorted by address, to
avoid any problems.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
tools/binman/elf.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index 0ae3b611ba..8c23040d8c 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -57,7 +57,9 @@ def GetSymbols(fname, patterns):
name = parts[2]
syms[name] = Symbol(section, int(value, 16), int(size,16),
flags[1] == 'w')
- return syms
+
+ # Sort dict by address
+ return OrderedDict(sorted(syms.iteritems(), key=lambda x: x[1].address))
def GetSymbolAddress(fname, sym_name):
"""Get a value of a symbol from an ELF file
--
2.18.0.203.gfac676dfb9-goog
More information about the U-Boot
mailing list