Loading tools/objtool/check.c +3 −1 Original line number Diff line number Diff line Loading @@ -2740,7 +2740,7 @@ int check(const char *_objname, bool orc) objname = _objname; file.elf = elf_open_read(objname, orc ? O_RDWR : O_RDONLY); file.elf = elf_open_read(objname, O_RDWR); if (!file.elf) return 1; Loading Loading @@ -2801,7 +2801,9 @@ int check(const char *_objname, bool orc) ret = create_orc_sections(&file); if (ret < 0) goto out; } if (file.elf->changed) { ret = elf_write(file.elf); if (ret < 0) goto out; Loading tools/objtool/elf.c +11 −2 Original line number Diff line number Diff line Loading @@ -713,6 +713,8 @@ struct section *elf_create_section(struct elf *elf, const char *name, elf_hash_add(elf->section_hash, &sec->hash, sec->idx); elf_hash_add(elf->section_name_hash, &sec->name_hash, str_hash(sec->name)); elf->changed = true; return sec; } Loading Loading @@ -746,7 +748,7 @@ struct section *elf_create_rela_section(struct elf *elf, struct section *base) return sec; } int elf_rebuild_rela_section(struct section *sec) int elf_rebuild_rela_section(struct elf *elf, struct section *sec) { struct rela *rela; int nr, idx = 0, size; Loading @@ -763,6 +765,9 @@ int elf_rebuild_rela_section(struct section *sec) return -1; } sec->changed = true; elf->changed = true; sec->data->d_buf = relas; sec->data->d_size = size; Loading @@ -779,7 +784,7 @@ int elf_rebuild_rela_section(struct section *sec) return 0; } int elf_write(const struct elf *elf) int elf_write(struct elf *elf) { struct section *sec; Elf_Scn *s; Loading @@ -796,6 +801,8 @@ int elf_write(const struct elf *elf) WARN_ELF("gelf_update_shdr"); return -1; } sec->changed = false; } } Loading @@ -808,6 +815,8 @@ int elf_write(const struct elf *elf) return -1; } elf->changed = false; return 0; } Loading tools/objtool/elf.h +3 −2 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ struct elf { Elf *elf; GElf_Ehdr ehdr; int fd; bool changed; char *name; struct list_head sections; DECLARE_HASHTABLE(symbol_hash, ELF_HASH_BITS); Loading Loading @@ -118,7 +119,7 @@ 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(const struct elf *elf); int elf_write(struct elf *elf); void elf_close(struct elf *elf); struct section *find_section_by_name(const struct elf *elf, const char *name); Loading @@ -130,7 +131,7 @@ struct rela *find_rela_by_dest(const struct elf *elf, struct section *sec, unsig struct rela *find_rela_by_dest_range(const struct elf *elf, struct section *sec, unsigned long offset, unsigned int len); struct symbol *find_func_containing(struct section *sec, unsigned long offset); int elf_rebuild_rela_section(struct section *sec); int elf_rebuild_rela_section(struct elf *elf, struct section *sec); #define for_each_sec(file, sec) \ list_for_each_entry(sec, &file->elf->sections, list) Loading tools/objtool/orc_gen.c +1 −1 Original line number Diff line number Diff line Loading @@ -222,7 +222,7 @@ int create_orc_sections(struct objtool_file *file) } } if (elf_rebuild_rela_section(ip_relasec)) if (elf_rebuild_rela_section(file->elf, ip_relasec)) return -1; return 0; Loading Loading
tools/objtool/check.c +3 −1 Original line number Diff line number Diff line Loading @@ -2740,7 +2740,7 @@ int check(const char *_objname, bool orc) objname = _objname; file.elf = elf_open_read(objname, orc ? O_RDWR : O_RDONLY); file.elf = elf_open_read(objname, O_RDWR); if (!file.elf) return 1; Loading Loading @@ -2801,7 +2801,9 @@ int check(const char *_objname, bool orc) ret = create_orc_sections(&file); if (ret < 0) goto out; } if (file.elf->changed) { ret = elf_write(file.elf); if (ret < 0) goto out; Loading
tools/objtool/elf.c +11 −2 Original line number Diff line number Diff line Loading @@ -713,6 +713,8 @@ struct section *elf_create_section(struct elf *elf, const char *name, elf_hash_add(elf->section_hash, &sec->hash, sec->idx); elf_hash_add(elf->section_name_hash, &sec->name_hash, str_hash(sec->name)); elf->changed = true; return sec; } Loading Loading @@ -746,7 +748,7 @@ struct section *elf_create_rela_section(struct elf *elf, struct section *base) return sec; } int elf_rebuild_rela_section(struct section *sec) int elf_rebuild_rela_section(struct elf *elf, struct section *sec) { struct rela *rela; int nr, idx = 0, size; Loading @@ -763,6 +765,9 @@ int elf_rebuild_rela_section(struct section *sec) return -1; } sec->changed = true; elf->changed = true; sec->data->d_buf = relas; sec->data->d_size = size; Loading @@ -779,7 +784,7 @@ int elf_rebuild_rela_section(struct section *sec) return 0; } int elf_write(const struct elf *elf) int elf_write(struct elf *elf) { struct section *sec; Elf_Scn *s; Loading @@ -796,6 +801,8 @@ int elf_write(const struct elf *elf) WARN_ELF("gelf_update_shdr"); return -1; } sec->changed = false; } } Loading @@ -808,6 +815,8 @@ int elf_write(const struct elf *elf) return -1; } elf->changed = false; return 0; } Loading
tools/objtool/elf.h +3 −2 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ struct elf { Elf *elf; GElf_Ehdr ehdr; int fd; bool changed; char *name; struct list_head sections; DECLARE_HASHTABLE(symbol_hash, ELF_HASH_BITS); Loading Loading @@ -118,7 +119,7 @@ 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(const struct elf *elf); int elf_write(struct elf *elf); void elf_close(struct elf *elf); struct section *find_section_by_name(const struct elf *elf, const char *name); Loading @@ -130,7 +131,7 @@ struct rela *find_rela_by_dest(const struct elf *elf, struct section *sec, unsig struct rela *find_rela_by_dest_range(const struct elf *elf, struct section *sec, unsigned long offset, unsigned int len); struct symbol *find_func_containing(struct section *sec, unsigned long offset); int elf_rebuild_rela_section(struct section *sec); int elf_rebuild_rela_section(struct elf *elf, struct section *sec); #define for_each_sec(file, sec) \ list_for_each_entry(sec, &file->elf->sections, list) Loading
tools/objtool/orc_gen.c +1 −1 Original line number Diff line number Diff line Loading @@ -222,7 +222,7 @@ int create_orc_sections(struct objtool_file *file) } } if (elf_rebuild_rela_section(ip_relasec)) if (elf_rebuild_rela_section(file->elf, ip_relasec)) return -1; return 0; Loading