diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-24 19:52:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-24 19:52:41 +0000 |
commit | 4a822714510711f7ca16a57b6db7002685f0c366 (patch) | |
tree | 590aefcc99d0c6007a66fba1ad9054272556b228 /tools/lli | |
parent | c74a72020490a9e66375084d27f9dc1094c3aa40 (diff) | |
download | llvm-4a822714510711f7ca16a57b6db7002685f0c366.tar.gz llvm-4a822714510711f7ca16a57b6db7002685f0c366.tar.bz2 llvm-4a822714510711f7ca16a57b6db7002685f0c366.tar.xz |
Add support for building a runtime library for LLI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@983 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lli')
-rw-r--r-- | tools/lli/Makefile | 12 | ||||
-rw-r--r-- | tools/lli/RuntimeLib.lc | 25 |
2 files changed, 37 insertions, 0 deletions
diff --git a/tools/lli/Makefile b/tools/lli/Makefile index bc5578c0a2..b1b936d3bf 100644 --- a/tools/lli/Makefile +++ b/tools/lli/Makefile @@ -5,3 +5,15 @@ TOOLLINKOPTS = -ldl include $(LEVEL)/Makefile.common +all :: $(LEVEL)/tools/Debug/RuntimeLib.bc + +Debug/RuntimeLib.c: RuntimeLib.lc + cp -f $< $@ + +Debug/RuntimeLib.o: Debug/RuntimeLib.c + /home/vadve/lattner/cvs/gcc_install/bin/gcc $< -c -o $@ + +$(LEVEL)/tools/Debug/RuntimeLib.bc: Debug/RuntimeLib.o + opt -dce $< -o $@ -f -q + + diff --git a/tools/lli/RuntimeLib.lc b/tools/lli/RuntimeLib.lc new file mode 100644 index 0000000000..38b28bfab1 --- /dev/null +++ b/tools/lli/RuntimeLib.lc @@ -0,0 +1,25 @@ +//===-- RuntimeLib.lc - LLVM Standard C Runtime Library -----------*- C -*-===// +// +// This file contains definitions of C functions that are useful to get LLVM +// programs up and running. This library of functions is automatically linked +// into programs loaded into LLI. +// +// This file is compiled by the LLVM port of GCC to get LLVM code. +// +//===----------------------------------------------------------------------===// + +// Prototypes for functions exported by LLI directly. +void exit(int Code); +int putchar(int); + +// The puts() function writes the string pointed to by s, followed by a +// NEWLINE character, to the standard output stream stdout. On success the +// number of characters written is returned; otherwise they return EOF. +// +int puts(const char *S) { + const char *Str = S; + while (*Str) putchar(*Str++); + putchar('\n'); + return Str+1-S; +} + |