MachO and ELF linkers have features to rename symbols to another name.
e.g. for ld64
-alias symbol_name alternate_symbol_name
Create an alias named alternate_symbol_name for the symbol symbol_name. By default the alias symbol has global visibility. This option was previous the -idef:indir option.
This feature is required in SwiftPM to link executable target with test target. Currently it's disabled for WASI because wasm-ld doesn't support it now. swiftlang/swift-package-manager#3804