public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Macro problems in arm-elf-as
@ 1999-06-15  4:26 Dan Hovang
  1999-06-15  9:45 ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Hovang @ 1999-06-15  4:26 UTC (permalink / raw)
  To: Ecos Discuss

Hi,

It seems like the arm-elf-as macro routines are broken. Following
code works in cygwin32 as aswell as in binutils-2.9.1 compiled under
RedHat Linux 6.0, but not in arm-elf-as as in ecosSWtools-arm-990321.

	.macro test, t1, t2
	.int \t1
label\@:
	.int \t2
	.endm

	test 1, 2
	test 3, 4
	test 5, 6

bash-2.02$ arm-elf-as test.S -o test
test.S: Assembler messages:
test.S:8: Error: bad instruction `label\'
test.S:9: Error: bad instruction `label\'
test.S:10: Error: bad instruction `label\'

I've browsed some sources in the ecosSWtools and compared them against
binutils (read.c and macro.c) but I've not been able to locate the
problem. Any ideas, anyone?

--
Dan Hovang (dh@ctech.ideon.se)
CTechnologies, Ideon Research Park
Scheelev 15, 223 70 Lund, Sweden

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

* Re: [ECOS] Macro problems in arm-elf-as
  1999-06-15  4:26 [ECOS] Macro problems in arm-elf-as Dan Hovang
@ 1999-06-15  9:45 ` Ian Lance Taylor
  1999-06-15 14:40   ` The Utz Family
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 1999-06-15  9:45 UTC (permalink / raw)
  To: dh; +Cc: ecos-discuss

   Date: Tue, 15 Jun 1999 13:25:38 +0200
   From: Dan Hovang <dh@ctechnologies.se>

   It seems like the arm-elf-as macro routines are broken. Following
   code works in cygwin32 as aswell as in binutils-2.9.1 compiled under
   RedHat Linux 6.0, but not in arm-elf-as as in ecosSWtools-arm-990321.

	   .macro test, t1, t2
	   .int \t1
   label\@:
	   .int \t2
	   .endm

	   test 1, 2
	   test 3, 4
	   test 5, 6

   bash-2.02$ arm-elf-as test.S -o test
   test.S: Assembler messages:
   test.S:8: Error: bad instruction `label\'
   test.S:9: Error: bad instruction `label\'
   test.S:10: Error: bad instruction `label\'

   I've browsed some sources in the ecosSWtools and compared them against
   binutils (read.c and macro.c) but I've not been able to locate the
   problem. Any ideas, anyone?

The problem is that `@' is the comment character for ARM assembly
code.  That takes precedence over the special meaning of `\@' in a
macro.  The third line in your test case is being seen as just
`label\'.  The `@' and everything following it are being treated as a
comment.

I unfortunately don't have any clever suggestions.

Ian

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

* Re: [ECOS] Macro problems in arm-elf-as
  1999-06-15  9:45 ` Ian Lance Taylor
@ 1999-06-15 14:40   ` The Utz Family
  1999-06-15 15:18     ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: The Utz Family @ 1999-06-15 14:40 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: dh, ecos-discuss

ouch! :-(

how is this really *supposed* to work then?

completely OTOH.... 

could somebody work arounds this by preprocessing? comments get stripped
prior to compilation, so if somebody were to preprocess this independent
of as and the feed it to as after processing ( assuming that there is a
flag that tells as that it will be receiving predigested input ).....

i am really out on a limb here because i dont understand fully the process
that as uses to get from memnonics and pseudo-ops to something that
actually gets used to emit code.


my other tremendously lame suggestion is to go in and hack the code to 
turn off comment processing in the parser and not use any comments ( thats
pure heresy to me, but it doesnt mean that you couln't have the comments
in the checked in copy for now, and then just strip them with a perl
script or something...... ) 

On 15 Jun 1999, Ian Lance Taylor wrote:

>    Date: Tue, 15 Jun 1999 13:25:38 +0200
>    From: Dan Hovang <dh@ctechnologies.se>
> 
>    It seems like the arm-elf-as macro routines are broken. Following
>    code works in cygwin32 as aswell as in binutils-2.9.1 compiled under
>    RedHat Linux 6.0, but not in arm-elf-as as in ecosSWtools-arm-990321.
> 
> 	   .macro test, t1, t2
> 	   .int \t1
>    label\@:
> 	   .int \t2
> 	   .endm
> 
> 	   test 1, 2
> 	   test 3, 4
> 	   test 5, 6
> 
>    bash-2.02$ arm-elf-as test.S -o test
>    test.S: Assembler messages:
>    test.S:8: Error: bad instruction `label\'
>    test.S:9: Error: bad instruction `label\'
>    test.S:10: Error: bad instruction `label\'
> 
>    I've browsed some sources in the ecosSWtools and compared them against
>    binutils (read.c and macro.c) but I've not been able to locate the
>    problem. Any ideas, anyone?
> 
> The problem is that `@' is the comment character for ARM assembly
> code.  That takes precedence over the special meaning of `\@' in a
> macro.  The third line in your test case is being seen as just
> `label\'.  The `@' and everything following it are being treated as a
> comment.
> 
> I unfortunately don't have any clever suggestions.
> 
> Ian
> 

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

* Re: [ECOS] Macro problems in arm-elf-as
  1999-06-15 14:40   ` The Utz Family
@ 1999-06-15 15:18     ` Ian Lance Taylor
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 1999-06-15 15:18 UTC (permalink / raw)
  To: utz; +Cc: dh, ecos-discuss

   Date: Tue, 15 Jun 1999 14:40:45 -0700 (PDT)
   From: The Utz Family <utz@serv.net>

   could somebody work arounds this by preprocessing? comments get stripped
   prior to compilation, so if somebody were to preprocess this independent
   of as and the feed it to as after processing ( assuming that there is a
   flag that tells as that it will be receiving predigested input ).....

Yes, there is such a flag: -f.  However, that flag normally requires
that the assembler input follow a fairly precise format (.e.g, no
multiple consecutive spaces), and is generally only intended to be
used when assembling compiler output.

   my other tremendously lame suggestion is to go in and hack the code to 
   turn off comment processing in the parser and not use any comments ( thats
   pure heresy to me, but it doesnt mean that you couln't have the comments
   in the checked in copy for now, and then just strip them with a perl
   script or something...... ) 

You'll still have line comments: if the first character on the line is
`#', the ARM assembler will ignore the line.  The `@' character is
different because it works anywhere that it appears.  You can easily
disable the special handling of `@' by changing comment_chars in
gas/config/tc-arm.c.  But your code won't work with an unhacked
assembler.

Ian

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

end of thread, other threads:[~1999-06-15 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-15  4:26 [ECOS] Macro problems in arm-elf-as Dan Hovang
1999-06-15  9:45 ` Ian Lance Taylor
1999-06-15 14:40   ` The Utz Family
1999-06-15 15:18     ` Ian Lance Taylor

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).