This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: macro on assembler


   Date: Wed, 07 Oct 1998 12:28:55 +0200
   From: Juergen Suessmaier <juergen@ffab.tide.ti.com>

   > It is about macro function in 'asm.h' and 'crt0.s' in newlib
   > package from cygnus. I want to make use of this startup code,
   > but as I assemble it using GAS, it message me an error in all
   > macro function IMM, SYM --> parse error, no function.
   > I suspect that the macros in asm.h using a wrong directives,
   > so that it wouldn't process as macro ...
   > I found in 'asm.h' and 'crt0.s' some C preprocessor directives, 
   > like #define, #include, #if ....
   > Hmm ... sounds to me that such kind of directives don't exist in GAS.
   > Can somebody explain me what's wrong???

   GAS doesn't know anything about macros, conditional assembly etc., as
   it was developed only to assemble the stuff that comes out of a
   compiler.

Not true.  GAS supports .if/.ifdef.

   If you want to use macros and the like, you'll need to preprocess
   the file with 'gasp' (the GNU assembler preprocessor) and pipe the
   output of gasp into gas:

   gasp <options> <sourcefile> | as <options>

As for the example in question, remember that if you name an assembler
file with a .S [capital S], when passed to gcc gcc will invoke the
C preprocessor before invoking the assembler.
And you can achieve the same effect on a .s file [lowercase .s] with
`gcc -x assembler-with-cpp foo.s'.
________________________________________________
To get help for the crossgcc list, send mail to
crossgcc-request@cygnus.com with the text 'help'
(without the quotes) in the body of the message.