diff options
author | Peter Zijlstra <peterz@infradead.org> | 2020-06-12 15:43:00 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2020-06-18 17:36:33 +0200 |
commit | fdabdd0b05e0bdf232340d5da86563ed142a99a7 (patch) | |
tree | 32bb99ed96e96fbff9e8c62e035b7fa58d18a401 /tools/objtool/elf.h | |
parent | 2b10be23ac0f8e107fd575397361ddbaebc2944b (diff) | |
download | linux-fdabdd0b05e0bdf232340d5da86563ed142a99a7.tar.bz2 |
objtool: Provide elf_write_{insn,reloc}()
This provides infrastructure to rewrite instructions; this is
immediately useful for helping out with KCOV-vs-noinstr, but will
also come in handy for a bunch of variable sized jump-label patches
that are still on ice.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Diffstat (limited to 'tools/objtool/elf.h')
-rw-r--r-- | tools/objtool/elf.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h index aa9c64da379f..7324e772583e 100644 --- a/tools/objtool/elf.h +++ b/tools/objtool/elf.h @@ -64,9 +64,10 @@ struct rela { GElf_Rela rela; struct section *sec; struct symbol *sym; - unsigned int type; unsigned long offset; + unsigned int type; int addend; + int idx; bool jump_table_start; }; @@ -119,6 +120,10 @@ struct elf *elf_open_read(const char *name, int flags); struct section *elf_create_section(struct elf *elf, const char *name, size_t entsize, int nr); struct section *elf_create_rela_section(struct elf *elf, struct section *base); void elf_add_rela(struct elf *elf, struct rela *rela); +int elf_write_insn(struct elf *elf, struct section *sec, + unsigned long offset, unsigned int len, + const char *insn); +int elf_write_rela(struct elf *elf, struct rela *rela); int elf_write(struct elf *elf); void elf_close(struct elf *elf); |