diff options
author | Kai Nacke <kai@redstar.de> | 2022-02-05 07:33:08 -0500 |
---|---|---|
committer | Kai Nacke <kai@redstar.de> | 2022-11-13 11:07:13 -0500 |
commit | a2cfd0386acbd1ced78c448208e9c7e5aa0fdf56 (patch) | |
tree | 61781452ddf94f8e8b70e3f079fe5f0c3dfe9fbf | |
parent | 3f2345498313211755205136f3d60cc1d31c27f9 (diff) | |
download | llvm-a2cfd0386acbd1ced78c448208e9c7e5aa0fdf56.zip llvm-a2cfd0386acbd1ced78c448208e9c7e5aa0fdf56.tar.gz llvm-a2cfd0386acbd1ced78c448208e9c7e5aa0fdf56.tar.bz2 |
Update README.markdown
Add a working example to illustrate status of development.
-rw-r--r-- | README.markdown | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown index 179900f..1ce3706 100644 --- a/README.markdown +++ b/README.markdown @@ -40,6 +40,41 @@ LLVM 12.x. This repository mirrors the LLVM `main` and `release/*` branches. I keep my files on top of `main`, which means that I often rebase. Sorry! +## Status + +It is already possible to cross-compile small applications. For example, save the +following C source on your development machine as `hello.c`: + +``` +int printf(const char * __restrict, ...); + +int gcd_sub(int a, int b) { + while (a != b) { + if (a > b) + a -= b; + else + b -= a; + } + return a; +} + +int main(int argc, char *argv[]) { + int gcd = gcd_sub(123, 99); + printf("gcd(123, 99) = %d\n", gcd); + return 0; +} +``` + +Compile the file with clang using `clang -target m88k-openbsd -c hello.c` +and copy the resulting object file `hello.o` to your OpenBSD m88k system. + +On the m88k system, you can link the program and run it: + +``` +gcc hello.o && ./a.out +gcd(123, 99) = 3 +``` + ## Support If you like this work, then there are several ways you can support me: |