Bug 1803698
| Summary: | Clang option -fuse-ld=lld is ignored with RISC-V targets | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Georg Sauthoff <fedora> |
| Component: | clang | Assignee: | serge_sans_paille <sguelton> |
| Status: | CLOSED DEFERRED | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 31 | CC: | airlied, sbergman, sguelton, siddharth.kde, tstellar |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-02-27 13:23:28 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Error confirmed upstream, patch proposed in https://reviews.llvm.org/D74704 Fixed upstream through https://reviews.llvm.org/D74704 / dd230142d8a00f5f30c3930a2407000e845dcfbf. This got reverted, then applied again and now works fine. This is not exactly a bugfix, so I think we'll wait until llvm 11 and *not* backport that patch. It will leave time for the feature to stabilize. |
Description of problem: When compiling for RISC-V, clang unconditionally invokes /usr/bin/ld, i.e. even when -fuse-ld=lld or -fuse-ld=/usr/bin/ld.lld is specified. Version-Release number of selected component (if applicable): clang-9.0.0-1.fc31.x86_64 How reproducible: always Steps to Reproduce: 1. echo 'int _start() {while(1);}' > foo.c 2. clang --target=riscv64 -fuse-ld=lld -nostdlib -v foo.c -o foo 3. echo $? Actual results: [..] clang-9: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument] [..] /usr/bin/ld: /tmp/foo-8bcfba.o: Relocations in generic ELF (EM: 243) /usr/bin/ld: /tmp/foo-8bcfba.o: error adding symbols: file in wrong format clang-9: error: ld command failed with exit code 1 (use -v to see invocation) 1 Expected results: [..] [.. no such warning ..] [..] "/usr/bin/ld.lld" [..] 0 Additional info: It works as expected when targeting x86-64: $ clang -fuse-ld=lld -nostdlib -v foo.c -o foo [..] "/usr/bin/ld.lld" [..] $ echo $? 0 Workaround: Link directly, e.g.: $ clang --target=riscv64 -c foo.c -o foo.o $ ld.lld foo.o -o foo $ echo $? 0 file foo foo.o foo: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), statically linked, not stripped foo.o: ELF 64-bit LSB relocatable, UCB RISC-V, version 1 (SYSV), not stripped