History

objtool: Add elf_create_file()

Add interface to enable the creation of a new ELF file.

Josh Poimboeuf committed 1 year ago

Commit 03c19a91 parent 2c05ca03 files · +147 −4Browse files

Showing the changes to tools/objtool/include/objtool (1 of 3 files). Show all

Unified · Split

tools/objtool/include/objtool/elf.h+3−2
@@ -94,7 +94,7 @@ struct elf { · 93 unmodified lines
94 GElf_Ehdr ehdr;94 GElf_Ehdr ehdr;
95 int fd;95 int fd;
96 bool changed;96 bool changed;
97 const char *name;97 const char *name, *tmp_name;
98 unsigned int num_files;98 unsigned int num_files;
99 struct list_head sections;99 struct list_head sections;
100 unsigned long num_relocs;100 unsigned long num_relocs;
@@ -116,6 +116,7 @@ struct elf { · 15 unmodified lines
116};116};
117 117
118struct elf *elf_open_read(const char *name, int flags);118struct elf *elf_open_read(const char *name, int flags);
119struct elf *elf_create_file(GElf_Ehdr *ehdr, const char *name);
119 120
120struct section *elf_create_section(struct elf *elf, const char *name,121struct section *elf_create_section(struct elf *elf, const char *name,
121 size_t size, size_t entsize,122 size_t size, size_t entsize,
@@ -165,7 +166,7 @@ int elf_write_insn(struct elf *elf, struct section *sec, unsigned long offset, · 43 unmodified lines
165 unsigned int len, const char *insn);166 unsigned int len, const char *insn);
166 167
167int elf_write(struct elf *elf);168int elf_write(struct elf *elf);
168void elf_close(struct elf *elf);169int elf_close(struct elf *elf);
169 170
170struct section *find_section_by_name(const struct elf *elf, const char *name);171struct section *find_section_by_name(const struct elf *elf, const char *name);
171struct symbol *find_func_by_offset(struct section *sec, unsigned long offset);172struct symbol *find_func_by_offset(struct section *sec, unsigned long offset);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t