diff options
| author | Josh Poimboeuf <jpoimboe@kernel.org> | 2025-09-17 19:03:49 +0300 |
|---|---|---|
| committer | Josh Poimboeuf <jpoimboe@kernel.org> | 2025-10-15 00:46:48 +0300 |
| commit | 431dbabf2d9dd27cd597a9d1d4611e7ae64bf8bd (patch) | |
| tree | 4bad054ecc07e9d19879f2313cff8181eb5506d7 /tools/objtool/include | |
| parent | 243e96385368fc5e31da4e9927a201a27a2ae936 (diff) | |
| download | linux-431dbabf2d9dd27cd597a9d1d4611e7ae64bf8bd.tar.xz | |
objtool: Add elf_create_data()
In preparation for the objtool klp diff subcommand, refactor
elf_add_string() by adding a new elf_add_data() helper which allows the
adding of arbitrary data to a section.
Make both interfaces global so they can be used by the upcoming klp diff
code.
Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'tools/objtool/include')
| -rw-r--r-- | tools/objtool/include/objtool/elf.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h index badb10926d1e..0d9aeefb6d12 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -135,6 +135,10 @@ struct symbol *elf_create_section_symbol(struct elf *elf, struct section *sec); struct symbol *elf_create_prefix_symbol(struct elf *elf, struct symbol *orig, size_t size); +void *elf_add_data(struct elf *elf, struct section *sec, const void *data, + size_t size); + +unsigned int elf_add_string(struct elf *elf, struct section *strtab, const char *str); struct reloc *elf_init_reloc_text_sym(struct elf *elf, struct section *sec, unsigned long offset, @@ -148,9 +152,9 @@ struct reloc *elf_init_reloc_data_sym(struct elf *elf, struct section *sec, struct symbol *sym, s64 addend); -int elf_write_insn(struct elf *elf, struct section *sec, - unsigned long offset, unsigned int len, - const char *insn); +int elf_write_insn(struct elf *elf, struct section *sec, unsigned long offset, + unsigned int len, const char *insn); + int elf_write(struct elf *elf); void elf_close(struct elf *elf); |
