Including files through command line options

Nick Clifton nickc@redhat.com
Sat May 14 20:46:00 GMT 2005


Hi Ravi,

> Based on a command line option, I want to make GAS include certain
> assembly source files (let's assume that I know where the file is for
> now).
> 
> I've tried setting a flag in md_parse_option, reading that flag in
> md_begin and then based on that flag called read_a_source_file on the
> file which I wanted to include.
> 
> Could anyone advise me if this is the acceptable way of achieving my
> objective or if there is a cleaner way of doing this.

It is an acceptable way of achieving your goal.  Presumably you are only 
modifying files specific to the target you are working on, so there is 
no chance that if there was a bug in your code it would affect other 
targets.

As for cleaner ways of achieving your objective I would definitely 
recommend that you consider using the "gcc" program instead.  Gcc is 
quite capable of taking assembler source files which include C 
preprocessor commands, including the #include directive, processing it 
and then passing it on to GAS.  ie GCC and C preprocessor can already do 
exactly what you want, so why bother reinventing the wheel ?

Cheers
   Nick




More information about the Binutils mailing list