[PATCH] D46822: [RISCV] Add driver for riscv32-unknown-elf baremetal target
Simon Cook via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 2 13:52:37 PDT 2018
simoncook added a comment.
It seems the ability to link objects has been broken by this change. As an example from our nightly tests:
Executing on host: riscv32-unknown-elf-clang /data/jenkins/workspace/riscv32-llvm-gcc/gcc-tests/gcc/testsuite/gcc.c-torture/execute/20080502-1.c -march=rv32gc -mabi=ilp32 -O1 -w -lm -o ./20080502-1.exe (timeout = 600)
spawn -ignore SIGHUP riscv32-unknown-elf-clang /data/jenkins/workspace/riscv32-llvm-gcc/gcc-tests/gcc/testsuite/gcc.c-torture/execute/20080502-1.c -march=rv32gc -mabi=ilp32 -O1 -w -lm -o ./20080502-1.exe
/data/jenkins/workspace/riscv32-llvm-gcc/install/bin/riscv32-unknown-elf-ld: cannot find crt0.o: No such file or directory
clang-8: error: ld command failed with exit code 1 (use -v to see invocation)
compiler exited with status 1
FAIL: gcc.c-torture/execute/20080502-1.c -O1 (test for excess errors)
Running with `-v` shows the link command as:
"/data/jenkins/workspace/riscv32-llvm-gcc/install/bin/riscv32-unknown-elf-ld" crt0.o /data/jenkins/workspace/riscv32-llvm-gcc/install/bin/../lib/gcc/riscv32-unknown-elf/8.1.0/crtbegin.o -L/lib -L/data/jenkins/workspace/riscv32-llvm-gcc/install/bin/../lib/gcc/riscv32-unknown-elf/8.1.0 /tmp/20080502-1-2b0022.o -lm --start-group -lc -lgloss --end-group -lgcc /data/jenkins/workspace/riscv32-llvm-gcc/install/bin/../lib/gcc/riscv32-unknown-elf/8.1.0/crtend.o -o ./20080502-1.exe
What's noticeable is `crt0.o` is specified just as a file, and we're trying to link in my host `/lib/` (`-L/lib`)? If I manually specify a sysroot (via `--sysroot=$INSTALLDIR/riscv32-unknown-elf`), then my link succeeds, adding the path to `crt0.o`, and the correct `/lib`:
"/data/jenkins/workspace/riscv32-llvm-gcc/install/bin/riscv32-unknown-elf-ld" --sysroot=/data/jenkins/workspace/riscv32-llvm-gcc/install/riscv32-unknown-elf /data/jenkins/workspace/riscv32-llvm-gcc/install/riscv32-unknown-elf/lib/crt0.o /data/jenkins/workspace/riscv32-llvm-gcc/install/bin/../lib/gcc/riscv32-unknown-elf/8.1.0/crtbegin.o -L/data/jenkins/workspace/riscv32-llvm-gcc/install/riscv32-unknown-elf/lib -L/data/jenkins/workspace/riscv32-llvm-gcc/install/bin/../lib/gcc/riscv32-unknown-elf/8.1.0 /tmp/20080502-1-d53be0.o -lm --start-group -lc -lgloss --end-group -lgcc /data/jenkins/workspace/riscv32-llvm-gcc/install/bin/../lib/gcc/riscv32-unknown-elf/8.1.0/crtend.o -o ./20080502-1.exe
I think there's some missing calculate the correct sysroot directory logic missing, unless linking `clang` to `riscv32-unknown-elf-clang` is no longer sufficient for everything to work now?
Repository:
rC Clang
https://reviews.llvm.org/D46822
More information about the cfe-commits
mailing list