Skip to main content

Module link

Module link 

Source
Expand description

The start files and the link line for a musl link.

Design: spec/cross-compile/08-sysroots.md section 8.2 and spec/cross-compile/11-linking.md.

§Why musl is first

spec/cross-compile/09-libc-stubs.md section 9.3 is the argument. musl exercises the header tree, the search paths, the start files, the compiler runtime and the link line, and it does that without symbol versioning and without stub generation, which are the two hardest pieces of the glibc path. If a musl cross link works end to end then the pipeline is right and what is left for M9.5 is the glibc specific parts rather than the shape of the thing.

§Why the line has three parts and not one

crtn.o goes after the libraries and crti.o goes before them, because between them they open and close the .init and .fini sections and anything contributing to those has to land in the middle. A link line that is one list gets this wrong in a way that produces a binary which links, runs, and does not run its static constructors, so the three parts are three fields here rather than a comment on an ordering somebody has to preserve.

Structs§

LinkLine
The inputs to a link, in the three groups a linker needs them in.

Enums§

LinkMode
How the program is linked, which decides the first start file and the flags.

Functions§

musl_loader
The absolute path musl’s loader is installed at on the target.