Getting asm macros expanded

Ph. Marek
Wed Mar 18 09:15:00 GMT 2009

Dave Korn <dave.korn.cygwin <at>> writes:
> Philipp Marek wrote:
> > [replying to the list]
> > 
> > Hello David,
> > 
> >> Are you trying to take assembly files generated from compilers or 
> >> straight from .s files. Could your needs be met by modifying your 
> >> makefiles to preprocess your sources into .a files?
> > Well, I've renamed /usr/bin/as to something else, and put my own script in
> > there, so that my script is transparently called for *any* compilation.
> > 
> > This works mostly; but eg. on the linux kernel (arch/x86/kernel/entry_64.S)
> > I can't get the macros to expand to pure assembler before I get them.
>   Does the '-am' flag not work in some way, or is it just that you want pure
> assembler output rather than listing files?
Well, obviously it's easier if I only have to parse a single format (and
"normal" [handwritten] assembler is needed); but if there's no other way than to
parse some other text, that's what I'll have to do.

I'd be glad to avoid additional overhead, too; currently gcc calls my script
(instead of "as"), and the output of my script is then given to "as".
If my script has to call "as" to pre-process the input it means double the
assembly overhead (although that's small, AFAIK).

And another point: "as -alm" does *always* produce an object file, doesn't it? I
can redirect it via "-o /dev/null", but the work is done nonetheless ...

Well, thank you for your answer!



More information about the Binutils mailing list