pub fn defines(
text: &Text,
data: &Data,
aliases: &[Alias],
target: &TargetInfo,
) -> Result<Vec<String>, Error>Expand description
Every name a linker can find in the object write() would write from the same input.
What asks for this is the archive writer. A static link resolves through the symbol index, so an index entry has to name a symbol the member really defines: an entry for a name that is not in the member is an archive the linker searches, pulls the member out of, and then still reports the name undefined. So the list comes from the writer rather than from the caller, because the writer is the only thing that knows what it wrote.
The names are as the C program spelled them, with nothing in front of them, which is what both the formats this writes have on this machine. Mach-O puts an underscore there and so does COFF on a 32-bit machine, and when either of those is written this is the function that has to say so, which is why it asks about the target it otherwise would not have to.
Order is the functions, then the variables, then the aliases, each in the order the module held
them, which is the order write() adds the symbols in. A static is left out: it is a name the
link has already finished with by the time an archive is searched, and an index entry for one
would offer the linker a definition it is not allowed to use.
ยงErrors
Error::Format for a machine or a platform this does not write, which is the same refusal
write() gives and is here for the same reason: a list of undecorated names for a format whose
symbols carry an underscore is worse than no list at all.