This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Library to assemble from memory
- From: Ian Lance Taylor <ian at airs dot com>
- To: Daniel Diaz <Daniel dot Diaz at univ-paris1 dot fr>
- Cc: binutils at sources dot redhat dot com
- Date: 29 Apr 2002 10:51:36 -0700
- Subject: Re: Library to assemble from memory
- References: <3CCD854B.AF5646F8@univ-paris1.fr>
Daniel Diaz <Daniel.Diaz@univ-paris1.fr> writes:
> int gas_assemble(int as_desc, char *asm_data);
> this assembles on the output file the content of asm_data according
> to the current
> assembler identified by as_desc.
> The return value is an error code.
Note that while gas is technically a one-pass assembler, in that it
only reads the input file once (which is why it can read from a pipe),
it is internally structured as a two-pass assembler. gas holds the
entire object file in memory until the entire input file has been
read, and only then does it do final processing and write anything out
to the disk.
With that caveat, this interface seems simple enough. You can already
control preprocessing using #APP and #NO_APP (these are doubtless
undocumented).
Making the current sources support this would require turning
read_a_source_file inside out, and probably turning it into a state
machine. I doubt anything else would have to change.
Ian