Description
Using clang
as linker with any custom target (spec in json) that contains linker-script (field link-script
) produces invocation like
# clang or cc, or gcc
"clang" "--script" "/path/to/link-script/exported/from/my-target-json"
But clang
doesn't support --script
and returns error clang: error: unsupported option '--script'
.
Instead of that, according documentation, we just need to pass it with -T
,
e.g.: -T/path/to/link-script.ld
.
How to reproduce:
-
Prepare spec json file for your custom target. It could be anything, just one thing matter - add
link-script
field. Something like this:{ "llvm-target": "Your-HOST-target", "link-script": "ENTRY(main)", "linker": "clang" }
-
Compile anything targeting to your custom target, e.g.:
--target=./your-target.json
Expected result:
Clang should be invoked with -T<link-script>
instead of --script <link-script>
.
I can reproduce with target-spec with explicitly set linker as clang
, gcc
, arm-none-eabi-gcc
and cc
.
Meta
rustc --version --verbose
:
rustc 1.80.0-nightly (72fdf913c 2024-06-05)
binary: rustc
commit-hash: 72fdf913c53dd0e75313ba83e4aa80df3f6e2871
commit-date: 2024-06-05
host: aarch64-apple-darwin
release: 1.80.0-nightly
LLVM version: 18.1.6