kotlin icon indicating copy to clipboard operation
kotlin copied to clipboard

[K/N] fixed GCC linker order

Open vickyleu opened this issue 7 months ago • 0 comments

When building with Kotlin Native, all static libraries from klib files are extracted, but there is a lack of ordering/sorting for these static libraries. This can cause dependent static libraries to be linked in an unordered manner. Since the ld linker processes libraries sequentially from left to right during linking, the current modification introduces Konan properties that allow:

Ordered sorting of static libraries via -Xoverride-konan-properties=linkerStaticSortingRegexFlags="...",

Alternatively, performing multiple linking passes to resolve dependencies.

 // type1: "order@regex&order@regex&..."
 // type2: "--whole-archive"
 // type3: "--use-group"
 -Xoverride-konan-properties=linkerStaticSortingRegexFlags=--use-group;

vickyleu avatar Mar 30 '25 11:03 vickyleu