summaryrefslogtreecommitdiff
path: root/tools/binman
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-07-17 13:25:24 -0600
committerSimon Glass <sjg@chromium.org>2018-08-01 16:27:28 -0600
commit46d61a2f2aeefcd622c9678716429e68a3a98811 (patch)
tree64b8e5bfe6f7ea30cb1a5f27118a17f3cd780a59 /tools/binman
parent61523dde17d1539b8ea361e25909acfdfc465155 (diff)
downloadu-boot-46d61a2f2aeefcd622c9678716429e68a3a98811.tar.gz
u-boot-46d61a2f2aeefcd622c9678716429e68a3a98811.tar.bz2
u-boot-46d61a2f2aeefcd622c9678716429e68a3a98811.zip
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 <sjg@chromium.org>
Diffstat (limited to 'tools/binman')
-rw-r--r--tools/binman/elf.py4
1 files changed, 3 insertions, 1 deletions
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