@@ -168,7 +168,23 @@ ldflags = ["-nostdlib", "-static", "-Wl,--no-dynamic-linker",
168168# is loaded. This format has no such headers, and the operation it names is one
169169# openkal does not offer in any case.
170170sources = [" !musl/src/ldso/dl_iterate_phdr.c" ]
171- ldflags = [" -nostdlib" , " -lSystem" , " -Wl,-e,_okm_start" , " -Wl,-dead_strip" ]
171+ #
172+ # --ld-path names this system's own linker rather than the one the toolchain
173+ # brings. The reason is one construct and fifteen uses of it. A second name for
174+ # a definition is made here with the assembler's own directive; where the
175+ # definition is in the same translation unit that produces an ordinary symbol,
176+ # and where it is not --- fifteen names in musl, every one of them a function
177+ # declared in a header and defined elsewhere --- it produces an indirect symbol,
178+ # which is what that directive is for. The toolchain's linker refuses an
179+ # indirect symbol, in as many words: "TODO: support aliasing to symbols of kind
180+ # 1". This system's own linker is the one the format was designed alongside and
181+ # resolves them.
182+ #
183+ # The measurement: 1154 of musl's translation units compiled for this system
184+ # produce fifteen indirect symbols between them, and they are listed in
185+ # musl/PATCHES.md.
186+ ldflags = [" -nostdlib" , " -lSystem" , " --ld-path=/usr/bin/ld" ,
187+ " -Wl,-e,_okm_start" , " -Wl,-dead_strip" ]
172188
173189# The generated headers, per architecture and per data model.
174190#
0 commit comments