rustc_target: Refactor internal linker flavors by petrochenkov · Pull Request #101988 · rust-lang/rust (original) (raw)
I believe that this change has broken the parsing of pre-link-args
in custom json targets:
PS C:\Users\yuriks\projects\mkos> rustc +nightly-2022-10-07 -Z unstable-options --target ..\rust-bootloader\x86_64-bootloader.json --print target-spec-json
{
"arch": "x86_64",
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"disable-redzone": true,
"features": "-mmx,-sse,+soft-float",
"linker": "rust-lld",
"linker-flavor": "ld.lld",
"llvm-target": "x86_64-unknown-none-gnu",
"panic-strategy": "abort",
"pre-link-args": {
"ld.lld": [
"--script=linker.ld",
"--gc-sections",
"--some-invalid-argument"
]
},
"relocation-model": "static",
"target-pointer-width": "64"
}
PS C:\Users\yuriks\projects\mkos> rustc +nightly-2022-10-08 -Z unstable-options --target ..\rust-bootloader\x86_64-bootloader.json --print target-spec-json
{
"arch": "x86_64",
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"disable-redzone": true,
"features": "-mmx,-sse,+soft-float",
"linker": "rust-lld",
"linker-flavor": "ld.lld",
"llvm-target": "x86_64-unknown-none-gnu",
"panic-strategy": "abort",
"relocation-model": "static",
"target-pointer-width": "64"
}
I am unable to bisect the breakage down to a specific commit, but this is the only that changed relevant parts of the compiler between the two nightlies, and it seems that this change in particular would cause this breakage:
LinkerFlavor::Gnu(_, Lld::Yes) |
---|
| LinkerFlavor::Darwin(_, Lld::Yes) |
| LinkerFlavor::Msvc(Lld::Yes) => {} |
cf0fa76#diff-aa810a3be0834da891b171a8b04b09d0d3bbb76ac27c757cd232235099e062d2R1742
Is this intentional? If so, what's the new way of passing custom linker arguments via the target?