How to change the default linker

I'm on aarch64 Linux, and I'm finding that is giving a cryptic error message whereas regular ld at least gave a better-worded, understandable message.

FWIW that message from is:

internal error in format_file_lineno, at ../../gold/

How can I change the default linker?

1 Like

The problem you're seeing is that Swift is emitting DWARF 5 data, which the older version of that you're running doesn't understand.

I don't think it's possible to change the default, sadly, without rebuilding the driver. You should be able to add -Xswiftc -use-ld=<other linker> to the SwiftPM command line (or -use-ld=<other linker> to swiftc itself) though.

Alternatively, installing a newer build of that has DWARF 5 support should resolve this problem.

1 Like