[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/25750] GNU as has inconsistent behavior when expanding .ma
From: |
i at maskray dot me |
Subject: |
[Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments |
Date: |
Mon, 13 Apr 2020 00:19:43 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=25750
--- Comment #11 from Fangrui Song <i at maskray dot me> ---
(In reply to Nick Clifton from comment #9)
> (In reply to Jian Cai from comment #8)
> Hi Jian,
>
> > .macro foo insn1 insn2
> > \insn1
> > \insn2
> > .endm
> >
> > foo .section .sec1, .section .sec2
>
> It occurs to me that we might be able to achieve something like this,
> if we extend the macro argument syntax to include a definition of the
> argument separator. For example:
>
> .macro foo insn1:sep, insn2:vararg
> \insn1
> \insn2
> .endm
>
> This would tell the macro processor that insn1 takes all characters up to
> (but excluding) the next comma character and that insn2 takes the rest of
> the line (starting at the first non-whitespace character after the comma).
>
> The new syntax "<arg>:sep<char>" tells the macro processor that argument
> <arg> is separated from the next argument by the <char> character, and only
> by the <char> character, so that any other character (apart from line ending
> characters) forms part of <arg>.
>
> This syntax does not exist *yet*. I am going to have a look at implementing
> it, but if it is too difficult I will give up.
>
> What do you think - would this change provide the functionality that you
> desire ?
>
> Cheers
> Nick
Hi Nick, for Jian's request, we can probably just quote the arguments
.macro foo insn1 insn2
\insn1
\insn2
.endm
- foo .section .sec1, .section .sec2
+ foo ".section .sec1", ".section .sec2"
We need to document it, though.
> Comment 10
> There is one feature not documented in
> https://sourceware.org/binutils/docs/as/Macro.html For a string literal
> argument, gas will remove the quotes when evaluation the argument.
I am a bit concerned that the :sep qualifier will not be accurate, either.
do_scrub_chars() can squeeze a run of spaces or delete some spaces arbitrarily.
The :sep argument will not be a sole separator as spaces/commas can be
separators as well.
% x86_64-linux-gnu-as a.s && objdump -s
0000 612c6220 28632064 292c65 a,b (c d),e
% aarch64-linux-gnu-as a.s && objdump -s
...
0000 612c6228 63206429 2c65 a,b(c d),e
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, nickc at redhat dot com, 2020/04/01
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, caij2003 at gmail dot com, 2020/04/01
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, nickc at redhat dot com, 2020/04/02
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, caij2003 at gmail dot com, 2020/04/02
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, nickc at redhat dot com, 2020/04/03
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, caij2003 at gmail dot com, 2020/04/06
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, nickc at redhat dot com, 2020/04/07
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, caij2003 at gmail dot com, 2020/04/08
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, nickc at redhat dot com, 2020/04/09
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, i at maskray dot me, 2020/04/12
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments,
i at maskray dot me <=
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, i at maskray dot me, 2020/04/12
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, i at maskray dot me, 2020/04/14
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, nickc at redhat dot com, 2020/04/14
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, caij2003 at gmail dot com, 2020/04/14
- [Bug binutils/25750] GNU as has inconsistent behavior when expanding .macro that takes as input directives with arguments, caij2003 at gmail dot com, 2020/04/14