Skip to main content

write

Function write 

Source
pub fn write(
    text: &Text,
    data: &Data,
    aliases: &[Alias],
    target: &TargetInfo,
    output: Output,
    info: &Info,
) -> Result<Vec<u8>, Error>
Expand description

One text section and the variables beside it, as a relocatable object in the target’s format.

info is the debug sections, already encoded, and is empty in a build that asked for none. What it holds is bytes and relocations for the same reason Text::unwind is bytes: the format’s answer is the producer’s to give and what is left here is where the sections go.

§Errors

Error::Format for a machine or a platform this does not write, and Error::Refused for anything the writer underneath objected to, which would be a bug here. An alias whose target this file does not define is refused the same way, since the front end is what reports that as a program’s mistake and one reaching here means it did not. So is anything the target’s format has no way to write, which for COFF is a thread-local variable, a reference through a table the platform does not have, a record of where a patcher’s room is and a section the startup code is expected to gather. See Error.