binman: Correct symbol calculation with non-zero image base

At present binman adds the image base address to the symbol value before
it writes it to the binary. This is not correct since the symbol value
itself (e.g. image position) has no relationship to the image base.

Fix this and update the tests to cover this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass 2019-10-20 21:31:34 -06:00 committed by Bin Meng
parent 895ae8726d
commit 15c981cc8a
2 changed files with 2 additions and 4 deletions

View File

@ -135,9 +135,7 @@ def LookupAndWriteSymbols(elf_fname, entry, section):
# Look up the symbol in our entry tables.
value = section.LookupSymbol(name, sym.weak, msg)
if value is not None:
value += base.address
else:
if value is None:
value = -1
pack_string = pack_string.lower()
value_bytes = struct.pack(pack_string, value)

View File

@ -9,7 +9,7 @@ ENTRY(_start)
SECTIONS
{
. = 0x00000000;
. = 0x00000010;
_start = .;
. = ALIGN(4);