public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] x86: Change -malign-branch= to accept a comma separated list
@ 2020-01-17  4:48 Fangrui Song via binutils
  2020-01-17  5:02 ` H.J. Lu
  0 siblings, 1 reply; 5+ messages in thread
From: Fangrui Song via binutils @ 2020-01-17  4:48 UTC (permalink / raw)
  To: binutils; +Cc: Lu, Hongjiu, Kan, Shengchen

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]

It is a convention to use a comma separated list.

-fsanitize=address,undefined
-fsanitize=null,alignment
-fpatchable-function-entry=3,1
-finstrument-functions-exclude-function-list=a,b
-mrecip=all,!sqrt
-mfpmath=sse,387

[-- Attachment #2: align-branch-comma.patch --]
[-- Type: text/x-diff, Size: 10992 bytes --]

From 17dab65dcf53e7282011fa824d9534d8a3f8dab6 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i@maskray.me>
Date: Thu, 16 Jan 2020 20:26:05 -0800
Subject: [PATCH] x86: Change -malign-branch to accept a comma separated list
To: binutils@sourceware.org

---
 gas/ChangeLog                                 | 20 +++++++++++++++++++
 gas/config/tc-i386.c                          |  4 ++--
 gas/po/gas.pot                                |  2 +-
 gas/testsuite/gas/i386/align-branch-1b.d      |  2 +-
 gas/testsuite/gas/i386/align-branch-1d.d      |  2 +-
 gas/testsuite/gas/i386/align-branch-1f.d      |  2 +-
 gas/testsuite/gas/i386/align-branch-2a.d      |  2 +-
 gas/testsuite/gas/i386/align-branch-2c.d      |  2 +-
 gas/testsuite/gas/i386/align-branch-3.d       |  2 +-
 gas/testsuite/gas/i386/align-branch-4a.d      |  2 +-
 gas/testsuite/gas/i386/align-branch-5.d       |  2 +-
 .../gas/i386/x86-64-align-branch-1b.d         |  2 +-
 .../gas/i386/x86-64-align-branch-1d.d         |  2 +-
 .../gas/i386/x86-64-align-branch-1f.d         |  2 +-
 .../gas/i386/x86-64-align-branch-2a.d         |  2 +-
 .../gas/i386/x86-64-align-branch-2c.d         |  2 +-
 .../gas/i386/x86-64-align-branch-3.d          |  2 +-
 .../gas/i386/x86-64-align-branch-4a.d         |  2 +-
 .../gas/i386/x86-64-align-branch-5.d          |  2 +-
 19 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index f2b49b7a89..25b180b132 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,23 @@
+2020-01-16  Fangrui Song  <maskray@google.com>
+
+	* config/tc-i386.c (md_parse_option): Change plus to comma.
+	* testsuite/gas/i386/align-branch-1b.d: Change plus to comma.
+	* testsuite/gas/i386/align-branch-1d.d: Likewise.
+	* testsuite/gas/i386/align-branch-1f.d: Likewise.
+	* testsuite/gas/i386/align-branch-2a.d: Likewise.
+	* testsuite/gas/i386/align-branch-2c.d: Likewise.
+	* testsuite/gas/i386/align-branch-3.d: Likewise.
+	* testsuite/gas/i386/align-branch-4a.d: Likewise.
+	* testsuite/gas/i386/align-branch-5.d: Likewise.
+	* testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise.
+	* testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise.
+	* testsuite/gas/i386/x86-64-align-branch-1f.d: Likewise.
+	* testsuite/gas/i386/x86-64-align-branch-2a.d: Likewise.
+	* testsuite/gas/i386/x86-64-align-branch-2c.d: Likewise.
+	* testsuite/gas/i386/x86-64-align-branch-3.d: Likewise.
+	* testsuite/gas/i386/x86-64-align-branch-4a.d: Likewise.
+	* testsuite/gas/i386/x86-64-align-branch-5.d: Likewise.
+
 2020-01-16  Andre Vieira  <andre.simoesdiasvieira@arm.com>
 
 	PR 25376
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 3f7f4222bf..56d2385be2 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -12509,7 +12509,7 @@ md_parse_option (int c, const char *arg)
       type = saved;
       do
 	{
-	  next = strchr (type, '+');
+	  next = strchr (type, ',');
 	  if (next)
 	    *next++ = '\0';
 	  if (strcasecmp (type, "jcc") == 0)
@@ -12795,7 +12795,7 @@ md_show_usage (FILE *stream)
   -malign-branch-boundary=NUM (default: 0)\n\
                           align branches within NUM byte boundary\n"));
   fprintf (stream, _("\
-  -malign-branch=TYPE[+TYPE...] (default: jcc+fused+jmp)\n\
+  -malign-branch=TYPE[,TYPE...] (default: jcc,fused,jmp)\n\
                           TYPE is combination of jcc, fused, jmp, call, ret,\n\
                            indirect\n\
                           specify types of branches to align\n"));
diff --git a/gas/po/gas.pot b/gas/po/gas.pot
index 21dc23cd1d..1996385678 100644
--- a/gas/po/gas.pot
+++ b/gas/po/gas.pot
@@ -8813,7 +8813,7 @@ msgstr ""
 #: config/tc-i386.c:12803
 #, c-format
 msgid ""
-"  -malign-branch=TYPE[+TYPE...] (default: jcc+fused+jmp)\n"
+"  -malign-branch=TYPE[,TYPE...] (default: jcc,fused,jmp)\n"
 "                          TYPE is combination of jcc, fused, jmp, call, "
 "ret,\n"
 "                           indirect\n"
diff --git a/gas/testsuite/gas/i386/align-branch-1b.d b/gas/testsuite/gas/i386/align-branch-1b.d
index 1a993b5bef..b4e9e7fd86 100644
--- a/gas/testsuite/gas/i386/align-branch-1b.d
+++ b/gas/testsuite/gas/i386/align-branch-1b.d
@@ -1,5 +1,5 @@
 #source: align-branch-1.s
-#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#as: -malign-branch-boundary=32 -malign-branch=fused,jcc,jmp
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/align-branch-1d.d b/gas/testsuite/gas/i386/align-branch-1d.d
index 7ea8d8f44b..d24ec8c385 100644
--- a/gas/testsuite/gas/i386/align-branch-1d.d
+++ b/gas/testsuite/gas/i386/align-branch-1d.d
@@ -1,5 +1,5 @@
 #source: align-branch-1.s
-#as: -malign-branch-boundary=32 -malign-branch=fused+jcc
+#as: -malign-branch-boundary=32 -malign-branch=fused,jcc
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/align-branch-1f.d b/gas/testsuite/gas/i386/align-branch-1f.d
index 07d75f6090..9263455262 100644
--- a/gas/testsuite/gas/i386/align-branch-1f.d
+++ b/gas/testsuite/gas/i386/align-branch-1f.d
@@ -1,5 +1,5 @@
 #source: align-branch-1.s
-#as: -malign-branch-boundary=32 -malign-branch=jcc+jmp
+#as: -malign-branch-boundary=32 -malign-branch=jcc,jmp
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/align-branch-2a.d b/gas/testsuite/gas/i386/align-branch-2a.d
index cba0560d9c..20a46f736e 100644
--- a/gas/testsuite/gas/i386/align-branch-2a.d
+++ b/gas/testsuite/gas/i386/align-branch-2a.d
@@ -1,5 +1,5 @@
 #source: align-branch-2.s
-#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#as: -malign-branch-boundary=32 -malign-branch=fused,jcc,jmp
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/align-branch-2c.d b/gas/testsuite/gas/i386/align-branch-2c.d
index 2fc6339975..37ba078bc7 100644
--- a/gas/testsuite/gas/i386/align-branch-2c.d
+++ b/gas/testsuite/gas/i386/align-branch-2c.d
@@ -1,5 +1,5 @@
 #source: align-branch-2.s
-#as: -malign-branch-boundary=32 -malign-branch=indirect+call
+#as: -malign-branch-boundary=32 -malign-branch=indirect,call
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/align-branch-3.d b/gas/testsuite/gas/i386/align-branch-3.d
index da31b6f503..2062e8b255 100644
--- a/gas/testsuite/gas/i386/align-branch-3.d
+++ b/gas/testsuite/gas/i386/align-branch-3.d
@@ -1,4 +1,4 @@
-#as: -malign-branch-boundary=32 -malign-branch=indirect+call
+#as: -malign-branch-boundary=32 -malign-branch=indirect,call
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/align-branch-4a.d b/gas/testsuite/gas/i386/align-branch-4a.d
index 2b1e0b1f45..9fc340668e 100644
--- a/gas/testsuite/gas/i386/align-branch-4a.d
+++ b/gas/testsuite/gas/i386/align-branch-4a.d
@@ -1,5 +1,5 @@
 #source: align-branch-4.s
-#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#as: -malign-branch-boundary=32 -malign-branch=fused,jcc,jmp
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/align-branch-5.d b/gas/testsuite/gas/i386/align-branch-5.d
index ca96c3c711..28b3bcf784 100644
--- a/gas/testsuite/gas/i386/align-branch-5.d
+++ b/gas/testsuite/gas/i386/align-branch-5.d
@@ -1,4 +1,4 @@
-#as: -malign-branch-boundary=32 -malign-branch=jcc+fused+jmp
+#as: -malign-branch-boundary=32 -malign-branch=jcc,fused,jmp
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1b.d b/gas/testsuite/gas/i386/x86-64-align-branch-1b.d
index 375a31a8b2..3467920819 100644
--- a/gas/testsuite/gas/i386/x86-64-align-branch-1b.d
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1b.d
@@ -1,5 +1,5 @@
 #source: x86-64-align-branch-1.s
-#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#as: -malign-branch-boundary=32 -malign-branch=fused,jcc,jmp
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1d.d b/gas/testsuite/gas/i386/x86-64-align-branch-1d.d
index c72b017627..5573699dda 100644
--- a/gas/testsuite/gas/i386/x86-64-align-branch-1d.d
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1d.d
@@ -1,5 +1,5 @@
 #source: x86-64-align-branch-1.s
-#as: -malign-branch-boundary=32 -malign-branch=fused+jcc
+#as: -malign-branch-boundary=32 -malign-branch=fused,jcc
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-1f.d b/gas/testsuite/gas/i386/x86-64-align-branch-1f.d
index aed8169873..72e37da27d 100644
--- a/gas/testsuite/gas/i386/x86-64-align-branch-1f.d
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-1f.d
@@ -1,5 +1,5 @@
 #source: x86-64-align-branch-1.s
-#as: -malign-branch-boundary=32 -malign-branch=jcc+jmp
+#as: -malign-branch-boundary=32 -malign-branch=jcc,jmp
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-2a.d b/gas/testsuite/gas/i386/x86-64-align-branch-2a.d
index aaf759d42e..0a98d7c8a5 100644
--- a/gas/testsuite/gas/i386/x86-64-align-branch-2a.d
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-2a.d
@@ -1,5 +1,5 @@
 #source: x86-64-align-branch-2.s
-#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#as: -malign-branch-boundary=32 -malign-branch=fused,jcc,jmp
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-2c.d b/gas/testsuite/gas/i386/x86-64-align-branch-2c.d
index fb87c49cd5..7b02cb5327 100644
--- a/gas/testsuite/gas/i386/x86-64-align-branch-2c.d
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-2c.d
@@ -1,5 +1,5 @@
 #source: x86-64-align-branch-2.s
-#as: -malign-branch-boundary=32 -malign-branch=indirect+call
+#as: -malign-branch-boundary=32 -malign-branch=indirect,call
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-3.d b/gas/testsuite/gas/i386/x86-64-align-branch-3.d
index 18767a7045..9b4028188a 100644
--- a/gas/testsuite/gas/i386/x86-64-align-branch-3.d
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-3.d
@@ -1,4 +1,4 @@
-#as: -malign-branch-boundary=32 -malign-branch=indirect+call
+#as: -malign-branch-boundary=32 -malign-branch=indirect,call
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-4a.d b/gas/testsuite/gas/i386/x86-64-align-branch-4a.d
index 47318e832a..dfbbca26e8 100644
--- a/gas/testsuite/gas/i386/x86-64-align-branch-4a.d
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-4a.d
@@ -1,5 +1,5 @@
 #source: x86-64-align-branch-4.s
-#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp
+#as: -malign-branch-boundary=32 -malign-branch=fused,jcc,jmp
 #objdump: -dw
 
 .*: +file format .*
diff --git a/gas/testsuite/gas/i386/x86-64-align-branch-5.d b/gas/testsuite/gas/i386/x86-64-align-branch-5.d
index 9770a4a07f..f5cef59610 100644
--- a/gas/testsuite/gas/i386/x86-64-align-branch-5.d
+++ b/gas/testsuite/gas/i386/x86-64-align-branch-5.d
@@ -1,5 +1,5 @@
 #source: align-branch-5.s
-#as: -malign-branch-boundary=32 -malign-branch=jcc+fused+jmp
+#as: -malign-branch-boundary=32 -malign-branch=jcc,fused,jmp
 #objdump: -dw
 
 .*: +file format .*
-- 
2.25.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: Change -malign-branch= to accept a comma separated list
  2020-01-17  4:48 [PATCH] x86: Change -malign-branch= to accept a comma separated list Fangrui Song via binutils
@ 2020-01-17  5:02 ` H.J. Lu
  2020-01-17  5:31   ` Fangrui Song via binutils
  2020-01-17  9:05   ` Jan Beulich
  0 siblings, 2 replies; 5+ messages in thread
From: H.J. Lu @ 2020-01-17  5:02 UTC (permalink / raw)
  To: Fangrui Song; +Cc: Binutils, Lu, Hongjiu, Kan, Shengchen

On Thu, Jan 16, 2020 at 8:49 PM Fangrui Song via binutils
<binutils@sourceware.org> wrote:
>
> It is a convention to use a comma separated list.
>
> -fsanitize=address,undefined
> -fsanitize=null,alignment
> -fpatchable-function-entry=3,1
> -finstrument-functions-exclude-function-list=a,b
> -mrecip=all,!sqrt
> -mfpmath=sse,387

  -malign-branch=TYPE[+TYPE...] (default: jcc+fused+jmp)

is done on purpose since you can't pass comma in assembler options
from GCC driver to assembler with -Wa,....

-- 
H.J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: Change -malign-branch= to accept a comma separated list
  2020-01-17  5:02 ` H.J. Lu
@ 2020-01-17  5:31   ` Fangrui Song via binutils
  2020-01-17  9:05   ` Jan Beulich
  1 sibling, 0 replies; 5+ messages in thread
From: Fangrui Song via binutils @ 2020-01-17  5:31 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils, Kan, Shengchen

On 2020-01-16, H.J. Lu wrote:
>On Thu, Jan 16, 2020 at 8:49 PM Fangrui Song via binutils
><binutils@sourceware.org> wrote:
>>
>> It is a convention to use a comma separated list.
>>
>> -fsanitize=address,undefined
>> -fsanitize=null,alignment
>> -fpatchable-function-entry=3,1
>> -finstrument-functions-exclude-function-list=a,b
>> -mrecip=all,!sqrt
>> -mfpmath=sse,387
>
>  -malign-branch=TYPE[+TYPE...] (default: jcc+fused+jmp)
>
>is done on purpose since you can't pass comma in assembler options
>from GCC driver to assembler with -Wa,....

Thanks for explaining the motivation.

We can make -malign-branch= both an assembler option and a compiler
driver option (https://gcc.gnu.org/ml/gcc/2020-01/msg00315.html)

Then we can let gcc pass -malign-branch=jcc,jmp to gas.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: Change -malign-branch= to accept a comma separated list
  2020-01-17  5:02 ` H.J. Lu
  2020-01-17  5:31   ` Fangrui Song via binutils
@ 2020-01-17  9:05   ` Jan Beulich
  2020-01-17 16:24     ` H.J. Lu
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2020-01-17  9:05 UTC (permalink / raw)
  To: H.J. Lu, Fangrui Song; +Cc: Hongjiu Lu, Shengchen Kan, Binutils

On 17.01.2020 06:02,  H.J. Lu  wrote:
> On Thu, Jan 16, 2020 at 8:49 PM Fangrui Song via binutils
> <binutils@sourceware.org> wrote:
>>
>> It is a convention to use a comma separated list.
>>
>> -fsanitize=address,undefined
>> -fsanitize=null,alignment
>> -fpatchable-function-entry=3,1
>> -finstrument-functions-exclude-function-list=a,b
>> -mrecip=all,!sqrt
>> -mfpmath=sse,387
> 
>   -malign-branch=TYPE[+TYPE...] (default: jcc+fused+jmp)
> 
> is done on purpose since you can't pass comma in assembler options
> from GCC driver to assembler with -Wa,....

How about permitting both + and , ?

Jan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: Change -malign-branch= to accept a comma separated list
  2020-01-17  9:05   ` Jan Beulich
@ 2020-01-17 16:24     ` H.J. Lu
  0 siblings, 0 replies; 5+ messages in thread
From: H.J. Lu @ 2020-01-17 16:24 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Fangrui Song, Shengchen Kan, Binutils

On Fri, Jan 17, 2020 at 1:05 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 17.01.2020 06:02,  H.J. Lu  wrote:
> > On Thu, Jan 16, 2020 at 8:49 PM Fangrui Song via binutils
> > <binutils@sourceware.org> wrote:
> >>
> >> It is a convention to use a comma separated list.
> >>
> >> -fsanitize=address,undefined
> >> -fsanitize=null,alignment
> >> -fpatchable-function-entry=3,1
> >> -finstrument-functions-exclude-function-list=a,b
> >> -mrecip=all,!sqrt
> >> -mfpmath=sse,387
> >
> >   -malign-branch=TYPE[+TYPE...] (default: jcc+fused+jmp)
> >
> > is done on purpose since you can't pass comma in assembler options
> > from GCC driver to assembler with -Wa,....
>
> How about permitting both + and , ?
>

I don't think it is necessary.

-- 
H.J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-17 16:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17  4:48 [PATCH] x86: Change -malign-branch= to accept a comma separated list Fangrui Song via binutils
2020-01-17  5:02 ` H.J. Lu
2020-01-17  5:31   ` Fangrui Song via binutils
2020-01-17  9:05   ` Jan Beulich
2020-01-17 16:24     ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).