Is it possible to swap the linker (GCC Gold) that Kotlin Native (with Kotlin 1.5.0 onwards) uses for a newer version (also GCC Gold), and if so where is the linker located on a Linux host? Is gold the linker that Kotlin Native uses ( https://stackoverflow.com/questions/3476093/replacing-ld-with-gold-any-experience )?
I'm wondering if the new linker used by Kotlin 1.5.0 makes linking significantly faster than Kotlin 1.4.31; are there any benchmarks available? From experience linking takes up about two thirds of the build time (painfully SLOW!) for a Kotlin Native program.
e
ephemient
07/12/2021, 1:17 AM
K/N used lld (llvm linker)
ephemient
07/12/2021, 1:17 AM
1.5.20 switched to gold on non-mac platforms
m
msink
07/12/2021, 2:51 AM
AFAIK K/N "linking" task is actually mostly compiling from Kotlin IR to LLVM IR and then to actual .o objects, so changing linker will not change much.
n
napperley
07/12/2021, 4:04 AM
The switch to gold (only generates ELF binaries) occurred with Kotlin 1.5.0 on all the Linux targets.
m
msink
07/12/2021, 4:49 AM
And on 1.6.0 planned to switch to default for LLVM ld.lld on all targets, AFAIK.
But again - what is called "linking" in traditional compilers like C - in Kotlin is just small (last) part of task called "linking". Maybe Kotlin "linking" task should be named somewhat else.
🤔 2
n
napperley
07/12/2021, 9:46 PM
It would be ridiculous to wait for Kotlin 1.6 to sort out the linking mess. There should be a hot pluggable Linking system available with Kotlin Native that doesn't require "Monkey Patching" the Kotlin, and Kotlin Native code bases. At one point one of the Kotlin team members mentioned "Monkey Patching" as a possible solution for fixing some linking issues, however the solution isn't practical/feasible.