-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Clang linker script support - incorrect argument #127183
Copy link
Copy link
Open
Labels
A-codegenArea: Code generationArea: Code generationA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Using
clangas linker with any custom target (spec in json) that contains linker-script (fieldlink-script) produces invocation likeBut
clangdoesn't support--scriptand returns errorclang: 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-scriptfield. 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.jsonExpected 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-gccandcc.Meta
rustc --version --verbose: