[PATCH] D39963: [RISCV][RFC] Add initial RISC-V target and driver support

Alex Bradbury via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 16 12:16:49 PST 2017


asb marked 4 inline comments as done.
asb added inline comments.


================
Comment at: lib/Driver/ToolChains/RISCV.cpp:86
+    CmdArgs.push_back("-lc");
+    CmdArgs.push_back("-lgloss");
+    CmdArgs.push_back("--end-group");
----------------
asb wrote:
> apazos wrote:
> > mgrang wrote:
> > > How about if our sysroot is linux (as opposed to elf)? There won't be any libgloss.a, right? Also there won't be a crt0.o (instead there will be crt1.o).
> > Supporting linux target is desirable early on because most of us will be using Qemu for running tests.
> Linux targets are not currently supported, as they require the ilp32d or lp64d (hard double precision) ABI. The only fiddly part is actually in the Clang frontend, handling structs composed of two reals or one integer + one real. This is obviously high up on the todo list.
It seems I was mistaken - soft float linux targets with glibc are working fine, meaning there's no need to wait for hardfloat ABI lowering.

Note that Linux targets are handled in lib/Driver/ToolChains/Linux.cpp


================
Comment at: lib/Driver/ToolChains/RISCV.h:42
+      : GnuTool("RISCV::Linker",
+                TC.getTriple().isArch64Bit() ? "riscv64-ld" : "riscv32-ld",
+                TC) {}
----------------
mgrang wrote:
> johnrusso wrote:
> > I wonder if we should construct the linker name based on the default triple value?  "riscv64-unknown-elf-ld" or "riscv32-unknown-elf-ld" as this is likely what is in the user's PATH if they have installed the gnu tools.  The linker name could be modified in ConstructJob if the triple is different from the default.
> I agree with @johnrusso . I always have errors: "riscv32-ld not found" and as a workaround I end up creating symlink pointing to the actual <triple>-ld.
Now updated so the bin dir from the given GCC install (passed by --gcc-toolchain) is added to the PATH, and the default search logic will look for an ld named after after the target triple.


https://reviews.llvm.org/D39963





More information about the cfe-commits mailing list