diff options
author | Simon Glass <sjg@chromium.org> | 2019-11-06 17:22:44 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-11-11 14:20:35 -0500 |
commit | 7c150136398916ac546b5a902d09208cc793cabe (patch) | |
tree | 98854625b04a561a29aede0fdde231efabe417c5 /tools/binman/elf.py | |
parent | 086e391bc46d3dda5c44053532bb51dc3827ee94 (diff) |
binman: tegra: Adjust symbol calculation depending on end-at-4gb
A recent change adjusted the symbol calculation to work on x86 but broke
it for Tegra. In fact this is because they have different needs.
On x86 devices the code is linked to a ROM address and the end-at-4gb
property is used for the image. In this case there is no need to add the
base address of the image, since the base address is already built into
the offset and image-pos properties.
On other devices we must add the base address since the offsets start at
zero.
In addition the base address is currently added to the 'offset' and 'size'
values. It should in fact only be added to 'image-pos', since 'offset' is
relative to its parent and 'size' is not actually an address. This code
should have been adjusted when support for 'image-pos' and 'size' was
added, but it was not.
To correct these problems:
- move the code that handles adding the base address to section.py, which
can check the end-at-4gb property and which property
(offset/size/image-pos) is being read
- add the base address only when needed (only for image-pos and not if the
image uses end-at-4gb)
- add a note to the documentation
- add a separate test to cover x86 behaviour
Fixes: 15c981cc (binman: Correct symbol calculation with non-zero image base)
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'tools/binman/elf.py')
-rw-r--r-- | tools/binman/elf.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/binman/elf.py b/tools/binman/elf.py index 0c1a5b44b6..de1ce73f2a 100644 --- a/tools/binman/elf.py +++ b/tools/binman/elf.py @@ -134,7 +134,7 @@ def LookupAndWriteSymbols(elf_fname, entry, section): (msg, sym.size)) # Look up the symbol in our entry tables. - value = section.LookupSymbol(name, sym.weak, msg) + value = section.LookupSymbol(name, sym.weak, msg, base.address) if value is None: value = -1 pack_string = pack_string.lower() |