[PATCH v2 32/62] objtool: Suppress section skipping warnings with --dryrun
From: Josh Poimboeuf
Date: Fri May 09 2025 - 16:24:04 EST
It's common to use --dryrun on binaries that have already been
processed. Don't print the section skipping warnings in that case.
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
tools/objtool/check.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 3b9443b98fd5..66cbeebd16ea 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -637,7 +637,9 @@ static int create_static_call_sections(struct objtool_file *file)
sec = find_section_by_name(file->elf, ".static_call_sites");
if (sec) {
- WARN("file already has .static_call_sites section, skipping");
+ if (!opts.dryrun)
+ WARN("file already has .static_call_sites section, skipping");
+
return 0;
}
@@ -719,7 +721,9 @@ static int create_retpoline_sites_sections(struct objtool_file *file)
sec = find_section_by_name(file->elf, ".retpoline_sites");
if (sec) {
- WARN("file already has .retpoline_sites, skipping");
+ if (!opts.dryrun)
+ WARN("file already has .retpoline_sites, skipping");
+
return 0;
}
@@ -757,7 +761,9 @@ static int create_return_sites_sections(struct objtool_file *file)
sec = find_section_by_name(file->elf, ".return_sites");
if (sec) {
- WARN("file already has .return_sites, skipping");
+ if (!opts.dryrun)
+ WARN("file already has .return_sites, skipping");
+
return 0;
}
@@ -795,7 +801,9 @@ static int create_ibt_endbr_seal_sections(struct objtool_file *file)
sec = find_section_by_name(file->elf, ".ibt_endbr_seal");
if (sec) {
- WARN("file already has .ibt_endbr_seal, skipping");
+ if (!opts.dryrun)
+ WARN("file already has .ibt_endbr_seal, skipping");
+
return 0;
}
@@ -852,7 +860,9 @@ static int create_cfi_sections(struct objtool_file *file)
sec = find_section_by_name(file->elf, ".cfi_sites");
if (sec) {
- WARN("file already has .cfi_sites section, skipping");
+ if (!opts.dryrun)
+ WARN("file already has .cfi_sites section, skipping");
+
return 0;
}
@@ -900,7 +910,9 @@ static int create_mcount_loc_sections(struct objtool_file *file)
sec = find_section_by_name(file->elf, "__mcount_loc");
if (sec) {
- WARN("file already has __mcount_loc section, skipping");
+ if (!opts.dryrun)
+ WARN("file already has __mcount_loc section, skipping");
+
return 0;
}
@@ -944,7 +956,9 @@ static int create_direct_call_sections(struct objtool_file *file)
sec = find_section_by_name(file->elf, ".call_sites");
if (sec) {
- WARN("file already has .call_sites section, skipping");
+ if (!opts.dryrun)
+ WARN("file already has .call_sites section, skipping");
+
return 0;
}
--
2.49.0