summaryrefslogtreecommitdiff
path: root/tools/objtool/include
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@kernel.org>2025-09-17 09:03:51 -0700
committerJosh Poimboeuf <jpoimboe@kernel.org>2025-10-14 14:46:49 -0700
commit03c19a99ee69f4680d7da11c164ac655b4946b99 (patch)
tree7a54a93e28cde28a5a42a48df8d45b4a3d029c6d /tools/objtool/include
parent2c05ca02621837af7cd8fab6ae7421b9cd5dff6e (diff)
objtool: Add elf_create_file()
Add interface to enable the creation of a new ELF file. 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.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h
index 999fd9369cf5..9f135c262659 100644
--- a/tools/objtool/include/objtool/elf.h
+++ b/tools/objtool/include/objtool/elf.h
@@ -94,7 +94,7 @@ struct elf {
GElf_Ehdr ehdr;
int fd;
bool changed;
- const char *name;
+ const char *name, *tmp_name;
unsigned int num_files;
struct list_head sections;
unsigned long num_relocs;
@@ -116,6 +116,7 @@ struct elf {
};
struct elf *elf_open_read(const char *name, int flags);
+struct elf *elf_create_file(GElf_Ehdr *ehdr, const char *name);
struct section *elf_create_section(struct elf *elf, const char *name,
size_t size, size_t entsize,
@@ -165,7 +166,7 @@ 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);
+int elf_close(struct elf *elf);
struct section *find_section_by_name(const struct elf *elf, const char *name);
struct symbol *find_func_by_offset(struct section *sec, unsigned long offset);