pub fn argv(
target: TargetTuple,
sysroot: &Sysroot,
options: &Invocation<'_>,
) -> Result<Vec<String>, Unsupported>Expand description
The whole linker command line for this target, not counting the linker itself.
Section 11.3’s eight items, in the order a linker wants them:
-m, the output format, because a linker built for more than one machine guesses from its first input otherwise and a link of no objects has nothing to guess from.--sysroot, and every-Lrooted inside it.-dynamic-linker, the one string on the line that describes the target’s filesystem rather than ours.- The start files, by absolute path, in the order the two nested pairs need.
- The default libraries, which are ours rather than the host’s.
librucc_builtins.afor the target, whichLinkLineputs after the libc.- No host paths at all.
- The format’s own extras, which on ELF is the hardening and reproducibility set below and on PE is the subsystem, the address space layout flags and the header timestamp.
Two formats reach a line here and the difference between them is the flags rather than the shape.
Both are written in the GNU style, which is what ld, ld.lld and ld.lld in its MinGW mode all
read, so the inputs, the -L directories and the passthrough are assembled once for both rather
than twice.
§Errors
Unsupported::Format for a target whose object format is neither ELF nor PE,
Unsupported::MsvcAbi for a Windows target in Microsoft’s ABI,
Unsupported::Machine for a PE target with no machine type, and
Unsupported::StaticStub for a static link against a libc that is a stub.