linux/arch/x86/tools
Jonathan Nieder 23637568ad x86: Fix kprobes build with non-gawk awk
The instruction attribute table generator fails when run by mawk
or original-awk:

 $ mawk -f arch/x86/tools/gen-insn-attr-x86.awk \
	arch/x86/lib/x86-opcode-map.txt > /dev/null
 Semantic error at 240: Second IMM error
 $ echo $?
 1

Line 240 contains "c8: ENTER Iw,Ib", which indicates that this
instruction has two immediate operands, the second of which is
one byte.  The script loops through the immediate operands using
a for loop.

Unfortunately, there is no guarantee in awk that a for (variable
in array) loop will return the indices in increasing order.
Internally, both original-awk and mawk iterate over a hash table
for this purpose, and both implementations happen to produce the
index 2 before 1.  The supposed second immediate operand is more
than one byte wide, producing the error.

So loop over the indices in increasing order instead.  As a
side-effect, with mawk this means the silly two-entry hash table
never has to be built.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by Masami Hiramatsu <mhiramat@redhat.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20091213220437.GA27718@progeny.tock>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-12-15 20:35:49 +01:00
..
Makefile x86: insn decoder test checks objdump version 2009-11-20 23:01:04 -08:00
chkobjdump.awk x86: insn decoder test checks objdump version 2009-11-20 23:01:04 -08:00
distill.awk x86: Show symbol name if insn decoder test failed 2009-11-17 07:16:50 +01:00
gen-insn-attr-x86.awk x86: Fix kprobes build with non-gawk awk 2009-12-15 20:35:49 +01:00
test_get_len.c x86: Instruction decoder test should generate build warning 2009-11-19 21:40:13 +01:00