diff options
author | Simon Glass <sjg@chromium.org> | 2024-08-26 13:11:40 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2024-09-26 12:40:30 +0200 |
commit | bce055338eabdac46d34c781753e05486898325a (patch) | |
tree | 81b24b4f51e790dee7d6556ba3be6ede215e96d3 /tools/binman/entry.py | |
parent | 01a609930b996499b36418108125ee53ab7094b5 (diff) |
binman: Provide a way to set the symbol base address
The base address of the ELF containing symbols is normally added to
any symbols written, so that the value points to the correct address in
memory when everything is loaded. When the binary resides on disk, a
different offset may be needed, typically 0. Provide a way to specify
this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/entry.py')
-rw-r--r-- | tools/binman/entry.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 7d4d4692776..8ad9fe89e0c 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -108,6 +108,9 @@ class Entry(object): not need to be done again. This is only used with 'binman replace', to stop sections from being rebuilt if their entries have not been replaced + symbols_base (int): Use this value as the assumed load address of the + target entry, when calculating the symbol value. If None, this is + 0 for blobs and the image-start address for ELF files """ fake_dir = None @@ -159,6 +162,7 @@ class Entry(object): self.preserve = False self.build_done = False self.no_write_symbols = False + self.symbols_base = None @staticmethod def FindEntryClass(etype, expanded): @@ -324,6 +328,7 @@ class Entry(object): self.preserve = fdt_util.GetBool(self._node, 'preserve') self.no_write_symbols = fdt_util.GetBool(self._node, 'no-write-symbols') + self.symbols_base = fdt_util.GetInt(self._node, 'symbols-base') def GetDefaultFilename(self): return None @@ -713,7 +718,8 @@ class Entry(object): # Check if we are writing symbols into an ELF file is_elf = self.GetDefaultFilename() == self.elf_fname elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage(), - is_elf, self.elf_base_sym) + is_elf, self.elf_base_sym, + self.symbols_base) def CheckEntries(self): """Check that the entry offsets are correct |