From: Simon Glass Date: Tue, 17 Jul 2018 19:25:24 +0000 (-0600) Subject: binman: Don't depend on dict order in ELF testOutsideFile() X-Git-Tag: v2025.01-rc5-pxa1908~3827^2~27 X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=46d61a2f2aeefcd622c9678716429e68a3a98811;p=u-boot.git binman: Don't depend on dict order in ELF testOutsideFile() 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 --- 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