llvm-project/clang
Weining Lu 15b65bcd65 [Clang][LoongArch] Add initial LoongArch target and driver support
With the initial support added, clang can compile `helloworld` C
to executable file for loongarch64. For example:

```
$ cat hello.c
int main() {
  printf("Hello, world!\n");
  return 0;
}
$ clang --target=loongarch64-unknown-linux-gnu --gcc-toolchain=xxx --sysroot=xxx hello.c
```

The output a.out can run within qemu or native machine. For example:

```
$ file ./a.out
./a.out: ELF 64-bit LSB pie executable, LoongArch, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-loongarch-lp64d.so.1, for GNU/Linux 5.19.0, with debug_info, not stripped
$ ./a.out
Hello, world!
```

Currently gcc toolchain and sysroot can be found here:
https://github.com/loongson/build-tools/releases/download/2022.08.11/loongarch64-clfs-5.1-cross-tools-gcc-glibc.tar.xz

Reference: https://github.com/loongson/LoongArch-Documentation
The last commit hash (main branch) is:
99016636af64d02dee05e39974d4c1e55875c45b

Note loongarch32 is not fully tested because there is no reference
gcc toolchain yet.

Differential Revision: https://reviews.llvm.org/D130255
2022-08-23 13:47:22 +08:00
..
bindings Fixed a number of typos 2022-08-01 13:13:18 -04:00
cmake Revert "[cmake] Use `CMAKE_INSTALL_LIBDIR` too" 2022-08-18 22:46:32 -04:00
docs [docs] Adjust the example command line in DebuggingCoroutines.rst 2022-08-22 22:15:47 +08:00
examples
include [clang][deps] Allow switching between lazily/eagerly loaded PCMs 2022-08-22 18:22:27 -07:00
lib [Clang][LoongArch] Add initial LoongArch target and driver support 2022-08-23 13:47:22 +08:00
runtime Revert "[cmake] Use `CMAKE_INSTALL_LIBDIR` too" 2022-08-18 22:46:32 -04:00
test [Clang][LoongArch] Add initial LoongArch target and driver support 2022-08-23 13:47:22 +08:00
tools [clang][deps] Allow switching between lazily/eagerly loaded PCMs 2022-08-22 18:22:27 -07:00
unittests [clang-format] Remove an extraneous test in TokenAnnotatorTest.cpp 2022-08-22 21:18:37 -07:00
utils [OpenMP][NFC] Use OMPInteropInfo in the OMPDeclareVariantAttr attribute 2022-08-22 10:41:16 -07:00
www Add N2562 to the C status page 2022-08-22 09:46:12 -04:00
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt [CMake] Support passing arguments to build tool (bootstrap). 2022-08-23 05:45:25 +01:00
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:             http://clang.llvm.org/
Building and using Clang:         http://clang.llvm.org/get_started.html
Clang Static Analyzer:            http://clang-analyzer.llvm.org/
Information on the LLVM project:  http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang forums:
  https://discourse.llvm.org/c/clang/

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/