All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Andrew Isaacson <adi@vmware.com>, Ingo Molnar <mingo@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org, Rob Landley <rob@landley.net>
Subject: Re: CONFIG_KPROBES=y build requires gawk
Date: Wed, 16 Dec 2009 21:11:09 -0800	[thread overview]
Message-ID: <aday6l25gnm.fsf@roland-alpha.cisco.com> (raw)
In-Reply-To: <4B29BA13.7020502@redhat.com> (Masami Hiramatsu's message of "Wed, 16 Dec 2009 23:56:51 -0500")


 > As Al Viro said, if we run awk with LC_ALL=C, then the characters will be
 > sorted as ASCII. So, your patch is OK if you can add LC_ALL=C just before
 > $(AWK). (I'm not so sure whether Makefile can accept it...)

OK, updated patch:

===

x86: Don't use POSIX character classes in gen-insn-attr-x86.awk

Not all awk implementations (including the default awk in Ubuntu 9.10)
support POSIX character classes.  Since x86-opcode-map.txt is plain
ASCII, we can just use explicit ranges for lower case, alphabetic, and
alphanumeric characters instead.  We set LC_ALL=C when invoking awk so
that ASCII ranges are never misinterpreted.

I verified that the Debian version of mawk, which doesn't have POSIX
character set suport, generates the byte-for-byte the same inat-tables.c
after this patch as gawk did on an unpatched kernel.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
---
 arch/x86/lib/Makefile                |    2 +-
 arch/x86/tools/gen-insn-attr-x86.awk |   10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 45b20e4..0c46d60 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -5,7 +5,7 @@
 inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk
 inat_tables_maps = $(srctree)/arch/x86/lib/x86-opcode-map.txt
 quiet_cmd_inat_tables = GEN     $@
-      cmd_inat_tables = $(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@
+      cmd_inat_tables = LC_ALL=C $(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@
 
 $(obj)/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
 	$(call cmd,inat_tables)
diff --git a/arch/x86/tools/gen-insn-attr-x86.awk b/arch/x86/tools/gen-insn-attr-x86.awk
index 7a68506..eaf11f5 100644
--- a/arch/x86/tools/gen-insn-attr-x86.awk
+++ b/arch/x86/tools/gen-insn-attr-x86.awk
@@ -6,8 +6,6 @@
 
 # Awk implementation sanity check
 function check_awk_implement() {
-	if (!match("abc", "[[:lower:]]+"))
-		return "Your awk doesn't support charactor-class."
 	if (sprintf("%x", 0) != "0")
 		return "Your awk has a printf-format problem."
 	return ""
@@ -44,12 +42,12 @@ BEGIN {
 	delete gtable
 	delete atable
 
-	opnd_expr = "^[[:alpha:]/]"
+	opnd_expr = "^[A-Za-z/]"
 	ext_expr = "^\\("
 	sep_expr = "^\\|$"
-	group_expr = "^Grp[[:alnum:]]+"
+	group_expr = "^Grp[0-9A-Za-z]+"
 
-	imm_expr = "^[IJAO][[:lower:]]"
+	imm_expr = "^[IJAO][a-z]"
 	imm_flag["Ib"] = "INAT_MAKE_IMM(INAT_IMM_BYTE)"
 	imm_flag["Jb"] = "INAT_MAKE_IMM(INAT_IMM_BYTE)"
 	imm_flag["Iw"] = "INAT_MAKE_IMM(INAT_IMM_WORD)"
@@ -62,7 +60,7 @@ BEGIN {
 	imm_flag["Ob"] = "INAT_MOFFSET"
 	imm_flag["Ov"] = "INAT_MOFFSET"
 
-	modrm_expr = "^([CDEGMNPQRSUVW/][[:lower:]]+|NTA|T[012])"
+	modrm_expr = "^([CDEGMNPQRSUVW/][a-z]+|NTA|T[012])"
 	force64_expr = "\\([df]64\\)"
 	rex_expr = "^REX(\\.[XRWB]+)*"
 	fpu_expr = "^ESC" # TODO

  reply	other threads:[~2009-12-17  5:11 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-16 23:56 CONFIG_KPROBES=y build requires gawk Andrew Isaacson
2009-12-17  1:19 ` Al Viro
2009-12-17  3:43   ` Masami Hiramatsu
2009-12-17  4:30     ` Al Viro
2009-12-17  5:16       ` Masami Hiramatsu
2009-12-17  1:39 ` Roland Dreier
2009-12-17  2:43   ` H. Peter Anvin
2009-12-17  3:02     ` Al Viro
2009-12-17  4:09     ` Roland Dreier
2009-12-17  5:07       ` H. Peter Anvin
2009-12-17  5:21         ` Masami Hiramatsu
2009-12-17  5:22           ` H. Peter Anvin
2009-12-17  4:09     ` Rob Landley
2009-12-17  3:33   ` Masami Hiramatsu
2009-12-17  3:45     ` H. Peter Anvin
2009-12-17  4:12       ` Rob Landley
2009-12-17  4:15     ` Roland Dreier
2009-12-17  4:56       ` Masami Hiramatsu
2009-12-17  5:11         ` Roland Dreier [this message]
2009-12-17  5:21           ` H. Peter Anvin
2009-12-17  5:43             ` Rob Landley
2009-12-17  5:49             ` Masami Hiramatsu
2009-12-17  5:49               ` H. Peter Anvin
2009-12-17  6:06                 ` Masami Hiramatsu
2009-12-17  6:08                   ` H. Peter Anvin
2009-12-17  6:20                     ` Masami Hiramatsu
2009-12-17  6:26                       ` H. Peter Anvin
2009-12-17  6:51                         ` Roland Dreier
2009-12-17 13:18                         ` Masami Hiramatsu
2009-12-17  5:45           ` Sam Ravnborg
2009-12-17  5:56             ` H. Peter Anvin
2009-12-17  6:17               ` Roland Dreier
2009-12-17  6:23                 ` H. Peter Anvin
2009-12-17  7:54               ` Sam Ravnborg
2009-12-17  8:09               ` Sam Ravnborg
2009-12-17 11:34                 ` Michal Marek
2009-12-17 16:18                   ` [tip:x86/urgent] Makefile: set LC_CTYPE, LC_COLLATE, LC_NUMERIC to C tip-bot for H. Peter Anvin
2009-12-17 22:09                     ` Sam Ravnborg
2009-12-17 22:28                       ` H. Peter Anvin
2009-12-17 23:34                         ` Masami Hiramatsu
2009-12-17 23:37                           ` H. Peter Anvin
2009-12-17 23:41                             ` H. Peter Anvin
2009-12-17 23:41                             ` Masami Hiramatsu
2009-12-17 23:45                               ` H. Peter Anvin
2009-12-17 23:49                                 ` Masami Hiramatsu
2009-12-17 23:58                                   ` [tip:x86/urgent] Makefile: Unexport LC_ALL instead of clearing it tip-bot for H. Peter Anvin
2009-12-17 23:40                           ` [tip:x86/urgent] Makefile: set LC_CTYPE, LC_COLLATE, LC_NUMERIC to C Roland Dreier
2009-12-17 23:44                             ` Masami Hiramatsu
2009-12-17 23:46                               ` H. Peter Anvin
2009-12-17 23:54                                 ` Masami Hiramatsu
2009-12-17 14:50                 ` CONFIG_KPROBES=y build requires gawk H. Peter Anvin
2009-12-17 10:42               ` Michal Marek
2009-12-17 13:21   ` Masami Hiramatsu
2009-12-17 16:18   ` [tip:x86/urgent] x86: Don't use POSIX character classes in gen-insn-attr-x86.awk tip-bot for Roland Dreier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aday6l25gnm.fsf@roland-alpha.cisco.com \
    --to=rdreier@cisco.com \
    --cc=adi@vmware.com \
    --cc=hpa@zytor.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=mingo@redhat.com \
    --cc=rob@landley.net \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.