tools/arch/x86/tools/gen-cpu-feature-names-x86.awk | 33 +++++++++++++- tools/objtool/.gitignore | 1 +- tools/objtool/Makefile | 1 +- tools/objtool/arch/loongarch/special.c | 5 ++- tools/objtool/arch/powerpc/special.c | 5 ++- tools/objtool/arch/x86/Build | 13 ++++- tools/objtool/arch/x86/special.c | 10 ++++- tools/objtool/include/objtool/special.h | 2 +- 8 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 tools/arch/x86/tools/gen-cpu-feature-names-x86.awk
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: afff4e5820e9a0d609740a83c366f3f0335db342
Gitweb: https://git.kernel.org/tip/afff4e5820e9a0d609740a83c366f3f0335db342
Author: Alexandre Chartre <alexandre.chartre@oracle.com>
AuthorDate: Fri, 21 Nov 2025 10:53:36 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 24 Nov 2025 11:35:06 +01:00
objtool: Function to get the name of a CPU feature
Add a function to get the name of a CPU feature. The function is
architecture dependent and currently only implemented for x86. The
feature names are automatically generated from the cpufeatures.h
include file.
Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://patch.msgid.link/20251121095340.464045-27-alexandre.chartre@oracle.com
---
tools/arch/x86/tools/gen-cpu-feature-names-x86.awk | 33 +++++++++++++-
tools/objtool/.gitignore | 1 +-
tools/objtool/Makefile | 1 +-
tools/objtool/arch/loongarch/special.c | 5 ++-
tools/objtool/arch/powerpc/special.c | 5 ++-
tools/objtool/arch/x86/Build | 13 ++++-
tools/objtool/arch/x86/special.c | 10 ++++-
tools/objtool/include/objtool/special.h | 2 +-
8 files changed, 69 insertions(+), 1 deletion(-)
create mode 100644 tools/arch/x86/tools/gen-cpu-feature-names-x86.awk
diff --git a/tools/arch/x86/tools/gen-cpu-feature-names-x86.awk b/tools/arch/x86/tools/gen-cpu-feature-names-x86.awk
new file mode 100644
index 0000000..1b1c1d8
--- /dev/null
+++ b/tools/arch/x86/tools/gen-cpu-feature-names-x86.awk
@@ -0,0 +1,33 @@
+#!/bin/awk -f
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2025, Oracle and/or its affiliates.
+#
+# Usage: awk -f gen-cpu-feature-names-x86.awk cpufeatures.h > cpu-feature-names.c
+#
+
+BEGIN {
+ print "/* cpu feature name array generated from cpufeatures.h */"
+ print "/* Do not change this code. */"
+ print
+ print "static const char *cpu_feature_names[(NCAPINTS+NBUGINTS)*32] = {"
+
+ feature_expr = "(X86_FEATURE_[A-Z0-9_]+)\\s+\\(([0-9*+ ]+)\\)"
+ debug_expr = "(X86_BUG_[A-Z0-9_]+)\\s+X86_BUG\\(([0-9*+ ]+)\\)"
+}
+
+/^#define X86_FEATURE_/ {
+ if (match($0, feature_expr, m)) {
+ print "\t[" m[2] "] = \"" m[1] "\","
+ }
+}
+
+/^#define X86_BUG_/ {
+ if (match($0, debug_expr, m)) {
+ print "\t[NCAPINTS*32+(" m[2] ")] = \"" m[1] "\","
+ }
+}
+
+END {
+ print "};"
+}
diff --git a/tools/objtool/.gitignore b/tools/objtool/.gitignore
index 7593036..73d8831 100644
--- a/tools/objtool/.gitignore
+++ b/tools/objtool/.gitignore
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
+arch/x86/lib/cpu-feature-names.c
arch/x86/lib/inat-tables.c
/objtool
feature
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index df793ca..66397d7 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -125,6 +125,7 @@ $(LIBSUBCMD)-clean:
clean: $(LIBSUBCMD)-clean
$(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL)
$(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
+ $(Q)$(RM) $(OUTPUT)arch/x86/lib/cpu-feature-names.c $(OUTPUT)fixdep
$(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep
$(Q)$(RM) -- $(OUTPUT)FEATURE-DUMP.objtool
$(Q)$(RM) -r -- $(OUTPUT)feature
diff --git a/tools/objtool/arch/loongarch/special.c b/tools/objtool/arch/loongarch/special.c
index a80b75f..aba7741 100644
--- a/tools/objtool/arch/loongarch/special.c
+++ b/tools/objtool/arch/loongarch/special.c
@@ -194,3 +194,8 @@ struct reloc *arch_find_switch_table(struct objtool_file *file,
return rodata_reloc;
}
+
+const char *arch_cpu_feature_name(int feature_number)
+{
+ return NULL;
+}
diff --git a/tools/objtool/arch/powerpc/special.c b/tools/objtool/arch/powerpc/special.c
index 5161068..8f9bf61 100644
--- a/tools/objtool/arch/powerpc/special.c
+++ b/tools/objtool/arch/powerpc/special.c
@@ -18,3 +18,8 @@ struct reloc *arch_find_switch_table(struct objtool_file *file,
{
exit(-1);
}
+
+const char *arch_cpu_feature_name(int feature_number)
+{
+ return NULL;
+}
diff --git a/tools/objtool/arch/x86/Build b/tools/objtool/arch/x86/Build
index 3dedb2f..febee0b 100644
--- a/tools/objtool/arch/x86/Build
+++ b/tools/objtool/arch/x86/Build
@@ -1,5 +1,5 @@
-objtool-y += special.o
objtool-y += decode.o
+objtool-y += special.o
objtool-y += orc.o
inat_tables_script = ../arch/x86/tools/gen-insn-attr-x86.awk
@@ -12,3 +12,14 @@ $(OUTPUT)arch/x86/lib/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
$(OUTPUT)arch/x86/decode.o: $(OUTPUT)arch/x86/lib/inat-tables.c
CFLAGS_decode.o += -I$(OUTPUT)arch/x86/lib
+
+cpu_features = ../arch/x86/include/asm/cpufeatures.h
+cpu_features_script = ../arch/x86/tools/gen-cpu-feature-names-x86.awk
+
+$(OUTPUT)arch/x86/lib/cpu-feature-names.c: $(cpu_features_script) $(cpu_features)
+ $(call rule_mkdir)
+ $(Q)$(call echo-cmd,gen)$(AWK) -f $(cpu_features_script) $(cpu_features) > $@
+
+$(OUTPUT)arch/x86/special.o: $(OUTPUT)arch/x86/lib/cpu-feature-names.c
+
+CFLAGS_special.o += -I$(OUTPUT)arch/x86/lib
diff --git a/tools/objtool/arch/x86/special.c b/tools/objtool/arch/x86/special.c
index 0930076..e817a3f 100644
--- a/tools/objtool/arch/x86/special.c
+++ b/tools/objtool/arch/x86/special.c
@@ -4,6 +4,10 @@
#include <objtool/special.h>
#include <objtool/builtin.h>
#include <objtool/warn.h>
+#include <asm/cpufeatures.h>
+
+/* cpu feature name array generated from cpufeatures.h */
+#include "cpu-feature-names.c"
void arch_handle_alternative(struct special_alt *alt)
{
@@ -134,3 +138,9 @@ struct reloc *arch_find_switch_table(struct objtool_file *file,
*table_size = 0;
return rodata_reloc;
}
+
+const char *arch_cpu_feature_name(int feature_number)
+{
+ return (feature_number < ARRAY_SIZE(cpu_feature_names)) ?
+ cpu_feature_names[feature_number] : NULL;
+}
diff --git a/tools/objtool/include/objtool/special.h b/tools/objtool/include/objtool/special.h
index b224107..121c376 100644
--- a/tools/objtool/include/objtool/special.h
+++ b/tools/objtool/include/objtool/special.h
@@ -38,4 +38,6 @@ bool arch_support_alt_relocation(struct special_alt *special_alt,
struct reloc *arch_find_switch_table(struct objtool_file *file,
struct instruction *insn,
unsigned long *table_size);
+const char *arch_cpu_feature_name(int feature_number);
+
#endif /* _SPECIAL_H */
On Mon, Nov 24, 2025 at 10:44:01AM -0000, tip-bot2 for Alexandre Chartre wrote:
> The following commit has been merged into the objtool/core branch of tip:
>
> Commit-ID: afff4e5820e9a0d609740a83c366f3f0335db342
> Gitweb: https://git.kernel.org/tip/afff4e5820e9a0d609740a83c366f3f0335db342
> Author: Alexandre Chartre <alexandre.chartre@oracle.com>
> AuthorDate: Fri, 21 Nov 2025 10:53:36 +01:00
> Committer: Peter Zijlstra <peterz@infradead.org>
> CommitterDate: Mon, 24 Nov 2025 11:35:06 +01:00
>
> objtool: Function to get the name of a CPU feature
>
> Add a function to get the name of a CPU feature. The function is
> architecture dependent and currently only implemented for x86. The
> feature names are automatically generated from the cpufeatures.h
> include file.
>
> Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Link: https://patch.msgid.link/20251121095340.464045-27-alexandre.chartre@oracle.com
> ---
> tools/arch/x86/tools/gen-cpu-feature-names-x86.awk | 33 +++++++++++++-
> tools/objtool/.gitignore | 1 +-
> tools/objtool/Makefile | 1 +-
> tools/objtool/arch/loongarch/special.c | 5 ++-
> tools/objtool/arch/powerpc/special.c | 5 ++-
> tools/objtool/arch/x86/Build | 13 ++++-
> tools/objtool/arch/x86/special.c | 10 ++++-
> tools/objtool/include/objtool/special.h | 2 +-
> 8 files changed, 69 insertions(+), 1 deletion(-)
> create mode 100644 tools/arch/x86/tools/gen-cpu-feature-names-x86.awk
>
> diff --git a/tools/arch/x86/tools/gen-cpu-feature-names-x86.awk b/tools/arch/x86/tools/gen-cpu-feature-names-x86.awk
> new file mode 100644
> index 0000000..1b1c1d8
> --- /dev/null
> +++ b/tools/arch/x86/tools/gen-cpu-feature-names-x86.awk
> @@ -0,0 +1,33 @@
> +#!/bin/awk -f
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Copyright (c) 2025, Oracle and/or its affiliates.
> +#
> +# Usage: awk -f gen-cpu-feature-names-x86.awk cpufeatures.h > cpu-feature-names.c
> +#
> +
> +BEGIN {
> + print "/* cpu feature name array generated from cpufeatures.h */"
> + print "/* Do not change this code. */"
> + print
> + print "static const char *cpu_feature_names[(NCAPINTS+NBUGINTS)*32] = {"
> +
> + feature_expr = "(X86_FEATURE_[A-Z0-9_]+)\\s+\\(([0-9*+ ]+)\\)"
> + debug_expr = "(X86_BUG_[A-Z0-9_]+)\\s+X86_BUG\\(([0-9*+ ]+)\\)"
> +}
> +
> +/^#define X86_FEATURE_/ {
> + if (match($0, feature_expr, m)) {
> + print "\t[" m[2] "] = \"" m[1] "\","
> + }
> +}
> +
> +/^#define X86_BUG_/ {
> + if (match($0, debug_expr, m)) {
> + print "\t[NCAPINTS*32+(" m[2] ")] = \"" m[1] "\","
> + }
> +}
> +
> +END {
> + print "};"
> +}
Boris just reported that this doesn't work on mawk, since it uses a GNU
awk extension (3rd argument for match()).
Could you please look at writing this in strict POSIX awk?
On Mon, Nov 24, 2025 at 12:59:42PM +0100, Peter Zijlstra wrote:
> On Mon, Nov 24, 2025 at 10:44:01AM -0000, tip-bot2 for Alexandre Chartre wrote:
> > The following commit has been merged into the objtool/core branch of tip:
> >
> > Commit-ID: afff4e5820e9a0d609740a83c366f3f0335db342
> > Gitweb: https://git.kernel.org/tip/afff4e5820e9a0d609740a83c366f3f0335db342
> > Author: Alexandre Chartre <alexandre.chartre@oracle.com>
> > AuthorDate: Fri, 21 Nov 2025 10:53:36 +01:00
> > Committer: Peter Zijlstra <peterz@infradead.org>
> > CommitterDate: Mon, 24 Nov 2025 11:35:06 +01:00
> >
> > objtool: Function to get the name of a CPU feature
Also, this commit name needs a verb.
> Boris just reported that this doesn't work on mawk, since it uses a GNU
> awk extension (3rd argument for match()).
>
> Could you please look at writing this in strict POSIX awk?
The fail is:
awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 20: syntax error at or near ,
awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 23: syntax error at or near }
awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 26: syntax error at or near ,
awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 29: syntax error at or near }
make[5]: *** [arch/x86/Build:21: /root/kernel/linux/tools/objtool/arch/x86/lib/cpu-feature-names.c] Error 2
make[5]: *** Deleting file '/root/kernel/linux/tools/objtool/arch/x86/lib/cpu-feature-names.c'
make[4]: *** [/root/kernel/linux/tools/build/Makefile.build:142: arch/x86] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [Makefile:104: /root/kernel/linux/tools/objtool/objtool-in.o] Error 2
make[2]: *** [Makefile:73: objtool] Error 2
make[1]: *** [/root/kernel/linux/Makefile:1449: tools/objtool] Error 2
make: *** [Makefile:248: __sub-make] Error 2
ls -al /usr/bin/awk
lrwxrwxrwx 1 root root 21 Feb 19 2021 /usr/bin/awk -> /etc/alternatives/awk
ls -al /etc/alternatives/awk
lrwxrwxrwx 1 root root 13 Feb 19 2021 /etc/alternatives/awk -> /usr/bin/mawk
That's debian.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
On 11/24/25 13:26, Borislav Petkov wrote:
> On Mon, Nov 24, 2025 at 12:59:42PM +0100, Peter Zijlstra wrote:
>> On Mon, Nov 24, 2025 at 10:44:01AM -0000, tip-bot2 for Alexandre Chartre wrote:
>>> The following commit has been merged into the objtool/core branch of tip:
>>>
>>> Commit-ID: afff4e5820e9a0d609740a83c366f3f0335db342
>>> Gitweb: https://git.kernel.org/tip/afff4e5820e9a0d609740a83c366f3f0335db342
>>> Author: Alexandre Chartre <alexandre.chartre@oracle.com>
>>> AuthorDate: Fri, 21 Nov 2025 10:53:36 +01:00
>>> Committer: Peter Zijlstra <peterz@infradead.org>
>>> CommitterDate: Mon, 24 Nov 2025 11:35:06 +01:00
>>>
>>> objtool: Function to get the name of a CPU feature
>
> Also, this commit name needs a verb.
Ok, then:
objtool: Add function to get the name of a CPU feature
>> Boris just reported that this doesn't work on mawk, since it uses a GNU
>> awk extension (3rd argument for match()).
>>
>> Could you please look at writing this in strict POSIX awk?
>
> The fail is:
>
> awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 20: syntax error at or near ,
> awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 23: syntax error at or near }
> awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 26: syntax error at or near ,
> awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 29: syntax error at or near }
> make[5]: *** [arch/x86/Build:21: /root/kernel/linux/tools/objtool/arch/x86/lib/cpu-feature-names.c] Error 2
> make[5]: *** Deleting file '/root/kernel/linux/tools/objtool/arch/x86/lib/cpu-feature-names.c'
> make[4]: *** [/root/kernel/linux/tools/build/Makefile.build:142: arch/x86] Error 2
> make[4]: *** Waiting for unfinished jobs....
> make[3]: *** [Makefile:104: /root/kernel/linux/tools/objtool/objtool-in.o] Error 2
> make[2]: *** [Makefile:73: objtool] Error 2
> make[1]: *** [/root/kernel/linux/Makefile:1449: tools/objtool] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
>
> ls -al /usr/bin/awk
> lrwxrwxrwx 1 root root 21 Feb 19 2021 /usr/bin/awk -> /etc/alternatives/awk
> ls -al /etc/alternatives/awk
> lrwxrwxrwx 1 root root 13 Feb 19 2021 /etc/alternatives/awk -> /usr/bin/mawk
>
Here is a fix. It works with gawk and mawk:
diff --git a/tools/arch/x86/tools/gen-cpu-feature-names-x86.awk b/tools/arch/x86/tools/gen-cpu-feature-names-x86.awk
index 1b1c1d84225c2..cc4c7a3e6c2e2 100644
--- a/tools/arch/x86/tools/gen-cpu-feature-names-x86.awk
+++ b/tools/arch/x86/tools/gen-cpu-feature-names-x86.awk
@@ -12,19 +12,20 @@ BEGIN {
print
print "static const char *cpu_feature_names[(NCAPINTS+NBUGINTS)*32] = {"
- feature_expr = "(X86_FEATURE_[A-Z0-9_]+)\\s+\\(([0-9*+ ]+)\\)"
- debug_expr = "(X86_BUG_[A-Z0-9_]+)\\s+X86_BUG\\(([0-9*+ ]+)\\)"
+ value_expr = "\\([0-9*+ ]+\\)"
}
/^#define X86_FEATURE_/ {
- if (match($0, feature_expr, m)) {
- print "\t[" m[2] "] = \"" m[1] "\","
+ if (match($0, value_expr)) {
+ value = substr($0, RSTART + 1, RLENGTH - 2)
+ print "\t[" value "] = \"" $2 "\","
}
}
/^#define X86_BUG_/ {
- if (match($0, debug_expr, m)) {
- print "\t[NCAPINTS*32+(" m[2] ")] = \"" m[1] "\","
+ if (match($0, value_expr)) {
+ value = substr($0, RSTART + 1, RLENGTH - 2)
+ print "\t[NCAPINTS*32+(" value ")] = \"" $2 "\","
}
}
I am going to send the updated patch.
Rgds,
alex.
On Mon, Nov 24, 2025 at 05:43:04PM +0100, Alexandre Chartre wrote:
> Here is a fix. It works with gawk and mawk:
Yap, works, thanks!
Reported-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Borislav Petkov (AMD) <bp@alien8.de>
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
On 11/24/25 13:26, Borislav Petkov wrote: > On Mon, Nov 24, 2025 at 12:59:42PM +0100, Peter Zijlstra wrote: >> On Mon, Nov 24, 2025 at 10:44:01AM -0000, tip-bot2 for Alexandre Chartre wrote: >>> The following commit has been merged into the objtool/core branch of tip: >>> >>> Commit-ID: afff4e5820e9a0d609740a83c366f3f0335db342 >>> Gitweb: https://git.kernel.org/tip/afff4e5820e9a0d609740a83c366f3f0335db342 >>> Author: Alexandre Chartre <alexandre.chartre@oracle.com> >>> AuthorDate: Fri, 21 Nov 2025 10:53:36 +01:00 >>> Committer: Peter Zijlstra <peterz@infradead.org> >>> CommitterDate: Mon, 24 Nov 2025 11:35:06 +01:00 >>> >>> objtool: Function to get the name of a CPU feature > > Also, this commit name needs a verb. > >> Boris just reported that this doesn't work on mawk, since it uses a GNU >> awk extension (3rd argument for match()). >> >> Could you please look at writing this in strict POSIX awk? > > The fail is: > > awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 20: syntax error at or near , > awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 23: syntax error at or near } > awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 26: syntax error at or near , > awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 29: syntax error at or near } > make[5]: *** [arch/x86/Build:21: /root/kernel/linux/tools/objtool/arch/x86/lib/cpu-feature-names.c] Error 2 > make[5]: *** Deleting file '/root/kernel/linux/tools/objtool/arch/x86/lib/cpu-feature-names.c' > make[4]: *** [/root/kernel/linux/tools/build/Makefile.build:142: arch/x86] Error 2 > make[4]: *** Waiting for unfinished jobs.... > make[3]: *** [Makefile:104: /root/kernel/linux/tools/objtool/objtool-in.o] Error 2 > make[2]: *** [Makefile:73: objtool] Error 2 > make[1]: *** [/root/kernel/linux/Makefile:1449: tools/objtool] Error 2 > make: *** [Makefile:248: __sub-make] Error 2 > > ls -al /usr/bin/awk > lrwxrwxrwx 1 root root 21 Feb 19 2021 /usr/bin/awk -> /etc/alternatives/awk > ls -al /etc/alternatives/awk > lrwxrwxrwx 1 root root 13 Feb 19 2021 /etc/alternatives/awk -> /usr/bin/mawk > > That's debian. > Ok. I am working on it. alex.
On Mon, 24 Nov 2025 13:40:47 +0100 Alexandre Chartre <alexandre.chartre@oracle.com> wrote: > On 11/24/25 13:26, Borislav Petkov wrote: > > On Mon, Nov 24, 2025 at 12:59:42PM +0100, Peter Zijlstra wrote: > >> On Mon, Nov 24, 2025 at 10:44:01AM -0000, tip-bot2 for Alexandre Chartre wrote: > >>> The following commit has been merged into the objtool/core branch of tip: > >>> > >>> Commit-ID: afff4e5820e9a0d609740a83c366f3f0335db342 > >>> Gitweb: https://git.kernel.org/tip/afff4e5820e9a0d609740a83c366f3f0335db342 > >>> Author: Alexandre Chartre <alexandre.chartre@oracle.com> > >>> AuthorDate: Fri, 21 Nov 2025 10:53:36 +01:00 > >>> Committer: Peter Zijlstra <peterz@infradead.org> > >>> CommitterDate: Mon, 24 Nov 2025 11:35:06 +01:00 > >>> > >>> objtool: Function to get the name of a CPU feature > > > > Also, this commit name needs a verb. > > > >> Boris just reported that this doesn't work on mawk, since it uses a GNU > >> awk extension (3rd argument for match()). > >> > >> Could you please look at writing this in strict POSIX awk? > > > > The fail is: > > > > awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 20: syntax error at or near , > > awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 23: syntax error at or near } > > awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 26: syntax error at or near , > > awk: ../arch/x86/tools/gen-cpu-feature-names-x86.awk: line 29: syntax error at or near } > > make[5]: *** [arch/x86/Build:21: /root/kernel/linux/tools/objtool/arch/x86/lib/cpu-feature-names.c] Error 2 > > make[5]: *** Deleting file '/root/kernel/linux/tools/objtool/arch/x86/lib/cpu-feature-names.c' > > make[4]: *** [/root/kernel/linux/tools/build/Makefile.build:142: arch/x86] Error 2 > > make[4]: *** Waiting for unfinished jobs.... > > make[3]: *** [Makefile:104: /root/kernel/linux/tools/objtool/objtool-in.o] Error 2 > > make[2]: *** [Makefile:73: objtool] Error 2 > > make[1]: *** [/root/kernel/linux/Makefile:1449: tools/objtool] Error 2 > > make: *** [Makefile:248: __sub-make] Error 2 > > > > ls -al /usr/bin/awk > > lrwxrwxrwx 1 root root 21 Feb 19 2021 /usr/bin/awk -> /etc/alternatives/awk > > ls -al /etc/alternatives/awk > > lrwxrwxrwx 1 root root 13 Feb 19 2021 /etc/alternatives/awk -> /usr/bin/mawk > > > > That's debian. > > > > Ok. I am working on it. Can't you just use sed ? There is no read need for the header or final } Since you need the header file included for the array bounds you might as well use the names for the array index. So something like (worked before I retyped it): sed -n -E '/^#define (X86_(FEATURE|BUG)_([^ ]*)).*/s// [ \1 ] = "\1",/p' (That is [^<space><tab>]* in the middle) The final .* matches the rest of the line, you could add some 'pattern' to further verify the match. It should be possible to just put that into the Makefile generating the include file in the object directory. Getting the comments would be more 'interesting', the " would need escaping as well. David
© 2016 - 2025 Red Hat, Inc.