diff options
| author | Wentong Tian <tianwentong2000@gmail.com> | 2026-01-22 17:44:04 +0300 |
|---|---|---|
| committer | Josh Poimboeuf <jpoimboe@kernel.org> | 2026-03-06 19:08:19 +0300 |
| commit | c19c854b307424c745dd6de73eea8db099c79408 (patch) | |
| tree | 961e62a38896a8e7c7ee7812d13555946468ff95 /tools/objtool/elf.c | |
| parent | 11439c4635edd669ae435eec308f4ab8a0804808 (diff) | |
| download | linux-c19c854b307424c745dd6de73eea8db099c79408.tar.xz | |
objtool: Use section/symbol type helpers
Commit 25eac74b6bdb ("objtool: Add section/symbol type helpers")
introduced several helper macros to improve code readability.
Update the remaining open-coded checks in check.c, disas.c, elf.c,
and klp-diff.c to use these new helpers.
Signed-off-by: Wentong Tian <tianwentong2000@gmail.com>
Link: https://patch.msgid.link/20260122144404.40602-1-tianwentong2000@gmail.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'tools/objtool/elf.c')
| -rw-r--r-- | tools/objtool/elf.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 2c02c7b49265..a634b227d627 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -614,7 +614,7 @@ static int read_symbols(struct elf *elf) if (elf_add_symbol(elf, sym)) return -1; - if (sym->type == STT_FILE) + if (is_file_sym(sym)) file = sym; else if (sym->bind == STB_LOCAL) sym->file = file; @@ -1335,7 +1335,7 @@ unsigned int elf_add_string(struct elf *elf, struct section *strtab, const char return -1; } - offset = ALIGN(strtab->sh.sh_size, strtab->sh.sh_addralign); + offset = ALIGN(sec_size(strtab), strtab->sh.sh_addralign); if (!elf_add_data(elf, strtab, str, strlen(str) + 1)) return -1; @@ -1377,7 +1377,7 @@ void *elf_add_data(struct elf *elf, struct section *sec, const void *data, size_ sec->data->d_size = size; sec->data->d_align = 1; - offset = ALIGN(sec->sh.sh_size, sec->sh.sh_addralign); + offset = ALIGN(sec_size(sec), sec->sh.sh_addralign); sec->sh.sh_size = offset + size; mark_sec_changed(elf, sec, true); |
