Messages in this thread Patch in this message | | | Date | Sat, 21 Mar 2020 17:11:51 +0100 | From | Peter Zijlstra <> | Subject | Re: [PATCH v2 17/19] objtool: Optimize !vmlinux.o again |
| |
On Sat, Mar 21, 2020 at 04:14:21PM +0100, Peter Zijlstra wrote: > On Fri, Mar 20, 2020 at 05:20:47PM +0100, Miroslav Benes wrote: > > > I think there is one more missing in create_orc_entry(). > > I'm thikning you're quite right about that.... lemme see what to do > about that.
--- --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -472,6 +472,14 @@ static int read_symbols(struct elf *elf) return -1; }
+void elf_add_rela(struct elf *elf, struct rela *rela) +{ + struct section *sec = rela->sec; + + list_add_tail(&rela->list, &sec->rela_list); + elf_hash_add(elf->rela_hash, &rela->hash, rela_hash(rela)); +} + static int read_relas(struct elf *elf) { struct section *sec; @@ -519,8 +527,7 @@ static int read_relas(struct elf *elf) return -1; }
- list_add_tail(&rela->list, &sec->rela_list); - elf_hash_add(elf->rela_hash, &rela->hash, rela_hash(rela)); + elf_add_rela(elf, rela); nr_rela++; } max_rela = max(max_rela, nr_rela); --- a/tools/objtool/elf.h +++ b/tools/objtool/elf.h @@ -127,6 +127,7 @@ struct section *elf_create_rela_section( int elf_rebuild_rela_section(struct section *sec); int elf_write(struct elf *elf); void elf_close(struct elf *elf); +void elf_add_rela(struct elf *elf, struct rela *rela);
#define for_each_sec(file, sec) \ list_for_each_entry(sec, &file->elf->sections, list) --- a/tools/objtool/orc_gen.c +++ b/tools/objtool/orc_gen.c @@ -111,8 +111,7 @@ static int create_orc_entry(struct elf * rela->offset = idx * sizeof(int); rela->sec = ip_relasec;
- list_add_tail(&rela->list, &ip_relasec->rela_list); - hash_add(elf->rela_hash, &rela->hash, rela_hash(rela)); + elf_add_rela(elf, rela);
return 0; }
| |