[PATCH 08/13] objtool: Upgrade "Linked object detected" warning to error

Josh Poimboeuf posted 13 patches 9 months, 1 week ago
[PATCH 08/13] objtool: Upgrade "Linked object detected" warning to error
Posted by Josh Poimboeuf 9 months, 1 week ago
Force the user to fix their cmdline if they forget the '--link' option.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 tools/objtool/builtin-check.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 36d81a455b01..79843512a51b 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -198,8 +198,8 @@ int objtool_run(int argc, const char **argv)
 		return 1;
 
 	if (!opts.link && has_multiple_files(file->elf)) {
-		ERROR("Linked object detected, forcing --link");
-		opts.link = true;
+		ERROR("Linked object requires --link");
+		goto err;
 	}
 
 	ret = check(file);
-- 
2.48.1
Re: [PATCH 08/13] objtool: Upgrade "Linked object detected" warning to error
Posted by Miroslav Benes 9 months ago
Hi,

On Fri, 14 Mar 2025, Josh Poimboeuf wrote:

> Force the user to fix their cmdline if they forget the '--link' option.
> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> ---
>  tools/objtool/builtin-check.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
> index 36d81a455b01..79843512a51b 100644
> --- a/tools/objtool/builtin-check.c
> +++ b/tools/objtool/builtin-check.c
> @@ -198,8 +198,8 @@ int objtool_run(int argc, const char **argv)
>  		return 1;
>  
>  	if (!opts.link && has_multiple_files(file->elf)) {
> -		ERROR("Linked object detected, forcing --link");
> -		opts.link = true;
> +		ERROR("Linked object requires --link");
> +		goto err;

there is no 'err' label in objtool_run() at this point. It is introduced 
by the next patch.

Miroslav
Re: [PATCH 08/13] objtool: Upgrade "Linked object detected" warning to error
Posted by Brendan Jackman 9 months ago
On Fri, Mar 14, 2025 at 12:29:06PM -0700, Josh Poimboeuf wrote:
> Force the user to fix their cmdline if they forget the '--link' option.
> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

Reviewed-by: Brendan Jackman <jackmanb@google.com>