aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-10-20 21:31:34 -0600
committerBin Meng <bmeng.cn@gmail.com>2019-11-02 18:00:51 +0800
commit15c981cc8adc26501e3a19ca7fb35705870ef597 (patch)
tree5d39925a3562f18535c3bd6e6674b93fcc3fd05e /tools
parent895ae8726dea182c8512fc6154bd0f9a6a06657b (diff)
downloadu-boot-15c981cc8adc26501e3a19ca7fb35705870ef597.zip
u-boot-15c981cc8adc26501e3a19ca7fb35705870ef597.tar.gz
u-boot-15c981cc8adc26501e3a19ca7fb35705870ef597.tar.bz2
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/binman/elf.py4
-rw-r--r--tools/binman/test/u_boot_binman_syms.lds2
2 files changed, 2 insertions, 4 deletions
diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index 7bc7cf6..0c1a5b4 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -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)
diff --git a/tools/binman/test/u_boot_binman_syms.lds b/tools/binman/test/u_boot_binman_syms.lds
index 926df87..825fc3f 100644
--- a/tools/binman/test/u_boot_binman_syms.lds
+++ b/tools/binman/test/u_boot_binman_syms.lds
@@ -9,7 +9,7 @@ ENTRY(_start)
SECTIONS
{
- . = 0x00000000;
+ . = 0x00000010;
_start = .;
. = ALIGN(4);