[PATCH] D130255: [Clang][LoongArch] Add initial LoongArch target and driver support

Lu Weining via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 25 02:22:18 PDT 2022


SixWeining added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:2226
 
+  static const char *const LoongArch64LibDirs[] = {"/lib64", "/lib"};
+  static const char *const LoongArch64Triples[] = {
----------------
MaskRay wrote:
> I don't know which of /lib64, /lib has been used. For purity, I'd hope that we just have /lib, no multilib style /lib64
I also don't know the actual usage of /lib64 but I just tried and it works fine if I remove /lib64.


================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:2478
+  // TODO: Handle loongarch32.
+  case llvm::Triple::loongarch64:
+    LibDirs.append(begin(LoongArch64LibDirs), end(LoongArch64LibDirs));
----------------
MaskRay wrote:
> Just add loongarch32 in this patch. It is trivial
But I don't know how to handle loongarch32 because there isn't a loongarch32 gcc toolchain available yet.


================
Comment at: clang/test/Driver/loongarch64-toolchain.c:20
+// C-LA64-LINUX-MULTI-LP64D: "-dynamic-linker" "/lib64/ld-linux-loongarch-lp64d.so.1"
+// C-LA64-LINUX-MULTI-LP64D: "{{.*}}/Inputs/multilib_loongarch_linux_sdk/lib/gcc/loongarch64-unknown-linux-gnu/12.1.0/crtbegin.o"
+// C-LA64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_loongarch_linux_sdk/lib/gcc/loongarch64-unknown-linux-gnu/12.1.0"
----------------
MaskRay wrote:
> Not using NEXT is somewhat brittle.
> 
> Perhaps add `loongarch-toolchain.c` instead. `riscv*-toolchain.c` are not good examples to follow. You may check out linux-cross.cpp
Thanks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130255/new/

https://reviews.llvm.org/D130255



More information about the cfe-commits mailing list