Discussion:
Changing GAS for ARM to accept semicolon as a comment character ?
Nick Clifton
2002-04-12 10:53:56 UTC
Permalink
Hi Guys,

GAS for the ARM currently supports ';' as a line separator character
and '@' as a line comment character. Would anyone object to my
changing this so that ';' was also a line comment character and
dropping the support for multiple instructions on a single line ?
(Or else choosing a different character for a line separator).

The reason is for compatibility with ARM's assembler which uses ';'
as the comment character. (It would be nice to drop '@' as a
comment character since this is used in ELF .section directives, but
I suspect that there is far too much ARM assembly code out there for
this to be feasible).

Cheers
Nick


_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
http://www.arm.linux.org.uk/armlinux/mailinglists.php
Please visit the above addresses for information on this list.
Richard Earnshaw
2002-04-12 11:05:41 UTC
Permalink
Post by Nick Clifton
Hi Guys,
GAS for the ARM currently supports ';' as a line separator character
changing this so that ';' was also a line comment character and
dropping the support for multiple instructions on a single line ?
(Or else choosing a different character for a line separator).
The reason is for compatibility with ARM's assembler which uses ';'
comment character since this is used in ELF .section directives, but
I suspect that there is far too much ARM assembly code out there for
this to be feasible).
Cheers
Nick
This would silently break any file that relied on it. In particular, I
believe ';' is the only supported statement separator, so I think removing
it would make #define macros in assembly files that need to generate more
than one statement impossible.

It would certainly break NetBSD's support code.

R


_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
http://www.arm.linux.org.uk/armlinux/mailinglists.php
Please visit the above addresses for information on this list.
Nick Clifton
2002-04-12 11:10:05 UTC
Permalink
Hi Richard,
Post by Richard Earnshaw
This would silently break any file that relied on it. In
particular, I believe ';' is the only supported statement separator,
so I think removing it would make #define macros in assembly files
that need to generate more than one statement impossible.
Right - which was why I was asking - to see if there was any code that
actually used it.
Post by Richard Earnshaw
It would certainly break NetBSD's support code.
Darn - oh well. I don't suppose NetBSD would like to switch to a 'one
instruction per line' approach for their assembler source code ?

Cheers
Nick



_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
http://www.arm.linux.org.uk/armlinux/mailinglists.php
Please visit the above addresses for information on this list.
Richard Earnshaw
2002-04-12 11:13:34 UTC
Permalink
Post by Nick Clifton
Darn - oh well. I don't suppose NetBSD would like to switch to a 'one
instruction per line' approach for their assembler source code ?
There's no way to write the following #define without using a statement
separator:

#define _ENTRY(x) \
.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x:

R.


_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
http://www.arm.linux.org.uk/armlinux/mailinglists.php
Please visit the above addresses for information on this list.
Richard Earnshaw
2002-04-12 11:18:33 UTC
Permalink
Post by Richard Earnshaw
Post by Nick Clifton
Darn - oh well. I don't suppose NetBSD would like to switch to a 'one
instruction per line' approach for their assembler source code ?
There's no way to write the following #define without using a statement
#define _ENTRY(x) \
R.
Oh, and ARM/Linux uses the same technique.

R.


_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
http://www.arm.linux.org.uk/armlinux/mailinglists.php
Please visit the above addresses for information on this list.
Nick Clifton
2002-04-12 11:40:18 UTC
Permalink
Hi Richard,
Post by Richard Earnshaw
There's no way to write the following #define without using a statement
#define _ENTRY(x) \
Right, I understand.

Oh well, it was just a suggestion. :-)

Cheers
Nick



_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
http://www.arm.linux.org.uk/armlinux/mailinglists.php
Please visit the above addresses for information on this list.
Philip Blundell
2002-04-12 11:28:48 UTC
Permalink
Post by Nick Clifton
GAS for the ARM currently supports ';' as a line separator character
changing this so that ';' was also a line comment character and
dropping the support for multiple instructions on a single line ?
(Or else choosing a different character for a line separator).
The reason is for compatibility with ARM's assembler which uses ';'
comment character since this is used in ELF .section directives, but
I suspect that there is far too much ARM assembly code out there for
this to be feasible).
I don't think this would be acceptable.

There is definitely some existing code out there that relies on ";"
being a separator character. But there is no easy way to locate all
this code, and it will quietly start producing wrong answers if ";" is
changed to be a comment character like "@". On the other hand, making
it a line comment character in the same way that "#" currently is might
not be a problem.

Compatibility with the ARM behaviour doesn't seem all that valuable
anyway, given that there are plenty of other syntax differences between
the two assemblers. If you want to be able to assemble ARM source
files, your best option is probably to create a special compatibility
mode (ie something a bit like --mri but perhaps less extensive).

p.


_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
http://www.arm.linux.org.uk/armlinux/mailinglists.php
Please visit the above addresses for information on this list.
Russell King - ARM Linux
2002-04-12 16:55:39 UTC
Permalink
Post by Nick Clifton
GAS for the ARM currently supports ';' as a line separator character
changing this so that ';' was also a line comment character and
dropping the support for multiple instructions on a single line ?
(Or else choosing a different character for a line separator).
That would break the ability to do stuff like:

#define BLAH(x,y) mov r0, x; mov t1, y; bl foo

which is used widely within kernel and (iirc) glibc sources. (You can't
embed newlines in the middle of preprocessor gunk.) In fact, ';' was added
specifically so we could build the kernel with the GNU toolchain.

_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
http://www.arm.linux.org.uk/armlinux/mailinglists.php
Please visit the above addresses for information on this list.
Nick Clifton
2002-04-12 17:22:04 UTC
Permalink
Hi Guys,

Just to let everyone know that I have now withdrawn this idea now. I
had not considered the use of ; in #define macros, but now that that
has been pointed out to me, it is obvious that it cannot (easily) be
changed.

Cheers
Nick


_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
http://www.arm.linux.org.uk/armlinux/mailinglists.php
Please visit the above addresses for information on this list.
Jason R Thorpe
2002-04-12 16:54:25 UTC
Permalink
Post by Nick Clifton
GAS for the ARM currently supports ';' as a line separator character
changing this so that ';' was also a line comment character and
dropping the support for multiple instructions on a single line ?
(Or else choosing a different character for a line separator).
It is quite common to have pre-processed assembly code which has multi-line
macros with semi-colons in it, e.g.:

#define DO_SOMETHING \
insn1 ; \
insn2 ; \
insn3 ; \
insn4
--
-- Jason R. Thorpe <***@wasabisystems.com>

_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
http://www.arm.linux.org.uk/armlinux/mailinglists.php
Please visit the above addresses for information on this list.
Geoff Keating
2002-04-12 18:03:53 UTC
Permalink
Date: 12 Apr 2002 11:53:56 +0100
GAS for the ARM currently supports ';' as a line separator character
changing this so that ';' was also a line comment character and
dropping the support for multiple instructions on a single line ?
(Or else choosing a different character for a line separator).
Support for multiple instructions on the same line is often used from
asm() statements in gcc.
--
- Geoffrey Keating <***@geoffk.org> <***@redhat.com>

_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
http://www.arm.linux.org.uk/armlinux/mailinglists.php
Please visit the above addresses for information on this list.
Loading...