summaryrefslogtreecommitdiff
path: root/tools/binman/elf_test.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-08-24 16:22:56 +0300
committerSimon Glass <sjg@chromium.org>2019-10-15 17:40:02 +0300
commit1542c8b5fce0f81ace585ac87218bfd79eb077f3 (patch)
treed901b0c64e8792f0892575df5edb8a2e4889e669 /tools/binman/elf_test.py
parentbccd91da9bdac8bf947a299ab9a7b821d2702696 (diff)
downloadu-boot-1542c8b5fce0f81ace585ac87218bfd79eb077f3.tar.xz
binman: Use the Makefile for u_boot_binman_syms
Remove this file from git and instead build it using the Makefile. With this change a few things need to be adjusted: 1. The 'notes' section no-longer appears at the start of the ELF file (before the code), so update testSymbols to adjust the offsets. 2. The dynamic linker is disabled to avoid errors like: "Not enough room for program headers, try linking with -N" 3. The interpreter note is moved to the end of the image, so that the binman symbols appear first. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/elf_test.py')
-rw-r--r--tools/binman/elf_test.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index c7f51bb86a..ff036cb655 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -70,7 +70,8 @@ def BuildElfTestFiles(target_dir):
del os.environ['MAKEFLAGS']
tools.Run('make', '-C', target_dir, '-f',
os.path.join(testdir, 'Makefile'), 'SRC=%s/' % testdir,
- 'bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr')
+ 'bss_data', 'u_boot_ucode_ptr', 'u_boot_no_ucode_ptr',
+ 'u_boot_binman_syms', 'u_boot_binman_syms.bin')
class TestElf(unittest.TestCase):
@@ -118,7 +119,7 @@ class TestElf(unittest.TestCase):
"""Test a symbol which extends outside the entry area is detected"""
entry = FakeEntry(10)
section = FakeSection()
- elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms')
+ elf_fname = self.ElfTestFile('u_boot_binman_syms')
with self.assertRaises(ValueError) as e:
syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
self.assertIn('entry_path has offset 4 (size 8) but the contents size '
@@ -158,7 +159,7 @@ class TestElf(unittest.TestCase):
"""
entry = FakeEntry(20)
section = FakeSection(sym_value=None)
- elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms')
+ elf_fname = self.ElfTestFile('u_boot_binman_syms')
syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
self.assertEqual(tools.GetBytes(255, 16) + tools.GetBytes(ord('a'), 4),
entry.data)
@@ -169,7 +170,7 @@ class TestElf(unittest.TestCase):
tout.Init(tout.DEBUG)
entry = FakeEntry(20)
section = FakeSection()
- elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms')
+ elf_fname = self.ElfTestFile('u_boot_binman_syms')
with test_util.capture_sys_output() as (stdout, stderr):
syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
self.assertTrue(len(stdout.getvalue()) > 0)