This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Library to assemble from memory


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


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