Skip to contentSkip to conversation

objdump: Fix disassembly if CROSS_COMPILE not set

PATCH In review David Laight 2 participants 3 messages Feb 15, 2025 – Feb 20, 2025 objtool

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 objdump: Fix disassembly if CROSS_COMPILE not set

If CROSS_COMPILE isn't set and -v specified the code tries to run

	system("(null)objdump ....")

which really doesn't work very well.
Fix by changing NULL to "".

Fixes ca653464dd097 ("objtool: Add verbose option for disassembling affected functions")
---
 tools/objtool/check.c | 2 ++
 1 file changed, 2 insertions(+)
tools/objtool/check.c +2 -0
index 753dbc4f8198..c1b771e772fd 100644
@@ -4506,6 +4506,8 @@ static int disas_funcs(const char *funcs)
 	char *cmd;
 
 	cross_compile = getenv("CROSS_COMPILE");
+	if (!cross_compile)
+		cross_compile = "";
 
 	objdump_str = "%sobjdump -wdr %s | gawk -M -v _funcs='%s' '"
 			"BEGIN { split(_funcs, funcs); }"
Signature · 1 line
2.39.5
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · David Laight

If CROSS_COMPILE isn't set and -v specified the code tries to run

	system("(null)objdump ....")

which really doesn't work very well.
Fix by changing NULL to "".

Fixes ca653464dd097 ("objtool: Add verbose option for disassembling affected functions")
---
 tools/objtool/check.c | 2 ++
 1 file changed, 2 insertions(+)
tools/objtool/check.c +0 -0
index 753dbc4f8198..c1b771e772fd 100644

tools/objtool/check.c static int disas_funcs(const char *funcs) · line 4510

Quoted 5 lines
tools/objtool/check.c +2 -0
@@ -4506,6 +4506,8 @@ static int disas_funcs(const char *funcs)
 	char *cmd;
 
 	cross_compile = getenv("CROSS_COMPILE");
+	if (!cross_compile)
+		cross_compile = "";

Makes sense, I'm not sure how this works for me already? Regardless:

Peter, can you take this one?

Signature · 1 line
Josh
maintainer
#2 lore raw
Quoted 25 lines · Josh Poimboeuf
Quoted 16 lines · David Laight

If CROSS_COMPILE isn't set and -v specified the code tries to run

	system("(null)objdump ....")

which really doesn't work very well.
Fix by changing NULL to "".

Fixes ca653464dd097 ("objtool: Add verbose option for disassembling affected functions")
---
 tools/objtool/check.c | 2 ++
 1 file changed, 2 insertions(+)
tools/objtool/check.c +0 -0
index 753dbc4f8198..c1b771e772fd 100644

tools/objtool/check.c static int disas_funcs(const char *funcs) · line 4510

Quoted 5 lines
tools/objtool/check.c +2 -0
@@ -4506,6 +4506,8 @@ static int disas_funcs(const char *funcs)
 	char *cmd;
 
 	cross_compile = getenv("CROSS_COMPILE");
+	if (!cross_compile)
+		cross_compile = "";

Makes sense, I'm not sure how this works for me already? Regardless:

Quoted 3 lines

Peter, can you take this one?

With s/objdump/objtool/ in subject :-)

Signature · 1 line
Josh