aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-01-06 21:35:15 -0700
committerSimon Glass <sjg@chromium.org>2021-01-30 14:25:41 -0700
commit870a9ead569ce8ee1f9fc03d178b56e012465582 (patch)
tree68b18615bdfce0c7c573401b90ed481b33f259bc /tools/binman/ftest.py
parent1ecf3b8f274f2fc66317d73532c82639f661f3ef (diff)
binman: Support finding symbols in sub-sections
At present binman only supports resolving symbols in the same section as the binary that uses it. This is quite limited because we often need to group entries into different sections. Enhance the algorithm to search the entire image for symbols. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index e753a342c8..5016060ea6 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -4139,6 +4139,21 @@ class TestFunctional(unittest.TestCase):
}
self.assertEqual(expected, props)
+ def testSymbolsSubsection(self):
+ """Test binman can assign symbols from a subsection"""
+ elf_fname = self.ElfTestFile('u_boot_binman_syms')
+ syms = elf.GetSymbols(elf_fname, ['binman', 'image'])
+ addr = elf.GetSymbolAddress(elf_fname, '__image_copy_start')
+ self.assertEqual(syms['_binman_u_boot_spl_prop_offset'].address, addr)
+
+ self._SetupSplElf('u_boot_binman_syms')
+ data = self._DoReadFile('187_symbols_sub.dts')
+ sym_values = struct.pack('<LQLL', 0x00, 0x1c, 0x28, 0x04)
+ expected = (sym_values + U_BOOT_SPL_DATA[20:] +
+ tools.GetBytes(0xff, 1) + U_BOOT_DATA + sym_values +
+ U_BOOT_SPL_DATA[20:])
+ self.assertEqual(expected, data)
+
if __name__ == "__main__":
unittest.main()