[Devel] [PATCH hci-8.2 12/17] ms/objtool: Move mark_rodata() to elf.c

no-reply at sashiko.virtuozzo.com no-reply at sashiko.virtuozzo.com
Tue Nov 24 08:13:45 MSK 2026


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] objtool: rodata name-matching comment left in check.c, none in
  elf.c
--

commit 5aa51a6bbc60594018d39f706683432ad65d44a3
Author: Josh Poimboeuf <jpoimboe at kernel.org>

ms/objtool: Move mark_rodata() to elf.c

The patch moves the per-section rodata marking from check.c into elf.c, so sec->rodata is set while the ELF file is read. It adds an is_rodata_sec() helper, and the check.c mark_rodata() now only sets file->rodata.

> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index dc24ceed3c7d9..f9539dae294f9 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -2524,7 +2524,6 @@ static int classify_symbols(struct objtool_file *file)
>  static void mark_rodata(struct objtool_file *file)
>  {
>  	struct section *sec;
> -	bool found = false;
>  
>  	/*
>  	 * Search for the following rodata sections, each of which can
> @@ -2537,15 +2536,11 @@ static void mark_rodata(struct objtool_file *file)
>  	 * .rodata.str1.* sections are ignored; they don't contain jump tables.
>  	 */
>  	for_each_sec(file->elf, sec) {
> -		if ((!strncmp(sec->name, ".rodata", 7) &&
> -		     !strstr(sec->name, ".str1.")) ||
> -		    !strncmp(sec->name, ".data.rel.ro", 12)) {
> -			sec->rodata = true;
> -			found = true;
> +		if (is_rodata_sec(sec)) {
> +			file->rodata = true;
> +			return;
>  		}
>  	}
> -
>  	}

[Severity: Low]
This isn't a bug, but the block comment listing the rodata section name patterns and the .str1. exclusion now sits in a function that no longer matches any names. Should it move to the new mark_rodata() in elf.c, which holds the matching logic and has no comment? Having two static functions named mark_rodata(), in different files and doing different jobs, is also a bit confusing. Renaming the check.c one might help, for example to something that says it only records whether the file has any rodata section.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply at sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261124050655.1853940-1-eva.kurchatova@virtuozzo.com?part=12



More information about the Devel mailing list