diff options
author | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-05-30 20:20:59 +0300 |
---|---|---|
committer | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-06-07 20:03:17 +0300 |
commit | 6342a20efbd8b70d169c325b2c27a8a8f96388d5 (patch) | |
tree | cd0a2d698c8914194d1524ae09a4219017cf0309 /tools/objtool/orc_gen.c | |
parent | ff4082730c2aaff3706232266e09d1ae4b350521 (diff) | |
download | linux-6342a20efbd8b70d169c325b2c27a8a8f96388d5.tar.xz |
objtool: Add elf_create_section_pair()
When creating an annotation section, allocate the reloc section data at
the beginning. This simplifies the data model a bit and also saves
memory due to the removal of malloc() in elf_rebuild_reloc_section().
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 53.49G
- After: peak heap memory consumption: 49.02G
Link: https://lore.kernel.org/r/048e908f3ede9b66c15e44672b6dda992b1dae3e.1685464332.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'tools/objtool/orc_gen.c')
-rw-r--r-- | tools/objtool/orc_gen.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/objtool/orc_gen.c b/tools/objtool/orc_gen.c index d5f750be7d7d..bae343908867 100644 --- a/tools/objtool/orc_gen.c +++ b/tools/objtool/orc_gen.c @@ -118,8 +118,8 @@ static int write_orc_entry(struct elf *elf, struct section *orc_sec, orc->bp_offset = bswap_if_needed(elf, orc->bp_offset); /* populate reloc for ip */ - if (elf_add_reloc_to_insn(elf, ip_sec, idx * sizeof(int), R_X86_64_PC32, - insn_sec, insn_off)) + if (!elf_init_reloc_text_sym(elf, ip_sec, idx * sizeof(int), idx, + insn_sec, insn_off)) return -1; return 0; @@ -242,7 +242,7 @@ int orc_create(struct objtool_file *file) if (!orc_sec) return -1; - sec = elf_create_section(file->elf, ".orc_unwind_ip", sizeof(int), nr); + sec = elf_create_section_pair(file->elf, ".orc_unwind_ip", sizeof(int), nr, nr); if (!sec) return -1; |