binman: Add a function to read ELF symbols

In some cases we need to read symbols from U-Boot. At present we have a
a few cases which does this via 'nm' and 'grep'.

It is better to use objdump since that tells us the size of the symbols
and also whether it is weak or not.

Add a new module which reads ELF information from files. Update existing
uses of 'nm' to use this module.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2017-11-13 18:54:54 -07:00
parent cf71338ee7
commit b50e5611a6
8 changed files with 128 additions and 11 deletions

View File

@@ -835,6 +835,13 @@ class TestFunctional(unittest.TestCase):
data = self._DoReadFile('47_spl_bss_pad.dts')
self.assertEqual(U_BOOT_SPL_DATA + (chr(0) * 10) + U_BOOT_DATA, data)
with open(self.TestFile('u_boot_ucode_ptr')) as fd:
TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read())
with self.assertRaises(ValueError) as e:
data = self._DoReadFile('47_spl_bss_pad.dts')
self.assertIn('Expected __bss_size symbol in spl/u-boot-spl',
str(e.exception))
def testPackStart16Spl(self):
"""Test that an image with an x86 start16 region can be created"""
data = self._DoReadFile('48_x86-start16-spl.dts')