]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
binman: Correct symbol calculation with non-zero image base
authorSimon Glass <sjg@chromium.org>
Mon, 21 Oct 2019 03:31:34 +0000 (21:31 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Sat, 2 Nov 2019 10:00:51 +0000 (18:00 +0800)
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>
tools/binman/elf.py
tools/binman/test/u_boot_binman_syms.lds

index 7bc7cf61b5d83721cbd73e093fd40d6619889520..0c1a5b44b669a39e46c8cf1f575ac5b89ad0daea 100644 (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)
index 926df873cb70b2aeeb55ab17b89ae2e84db93d74..825fc3f649f78f35c8dfb5530621f128e02a717a 100644 (file)
@@ -9,7 +9,7 @@ ENTRY(_start)
 
 SECTIONS
 {
-       . = 0x00000000;
+       . = 0x00000010;
        _start = .;
 
        . = ALIGN(4);