diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-12-08 02:39:23 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-12-08 02:39:23 +0000 |
commit | 86f9994936336675dcc1454ede5857e8851080b6 (patch) | |
tree | 6ce259563958c5e2bf4551ffe02c1214d5fe9d88 /SDKs | |
parent | acd5c617b219e0f059620c2a3928d2cc821d4534 (diff) | |
download | compiler-rt-86f9994936336675dcc1454ede5857e8851080b6.tar.gz |
SDKs: Sketch an initial stub SDK for Linux, I believe this suffices for building
the main compiler-rt and profile modules, at least on x86.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@146131 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'SDKs')
-rw-r--r-- | SDKs/linux/README.txt | 2 | ||||
-rw-r--r-- | SDKs/linux/usr/include/endian.h | 29 | ||||
-rw-r--r-- | SDKs/linux/usr/include/limits.h | 23 | ||||
-rw-r--r-- | SDKs/linux/usr/include/stdio.h | 35 | ||||
-rw-r--r-- | SDKs/linux/usr/include/stdlib.h | 32 | ||||
-rw-r--r-- | SDKs/linux/usr/include/string.h | 28 | ||||
-rw-r--r-- | SDKs/linux/usr/include/sys/mman.h | 29 | ||||
-rw-r--r-- | SDKs/linux/usr/include/sys/stat.h | 24 | ||||
-rw-r--r-- | SDKs/linux/usr/include/sys/types.h | 20 | ||||
-rw-r--r-- | SDKs/linux/usr/include/unistd.h | 26 |
10 files changed, 248 insertions, 0 deletions
diff --git a/SDKs/linux/README.txt b/SDKs/linux/README.txt new file mode 100644 index 000000000..aa0604af7 --- /dev/null +++ b/SDKs/linux/README.txt @@ -0,0 +1,2 @@ +This is a stub SDK for Linux. Currently, this has only been tested on i386 and +x86_64 using the Clang compiler. diff --git a/SDKs/linux/usr/include/endian.h b/SDKs/linux/usr/include/endian.h new file mode 100644 index 000000000..95528db15 --- /dev/null +++ b/SDKs/linux/usr/include/endian.h @@ -0,0 +1,29 @@ +/* ===-- endian.h - stub SDK header for compiler-rt -------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This is a stub SDK header file. This file is not part of the interface of + * this library nor an official version of the appropriate SDK header. It is + * intended only to stub the features of this header required by compiler-rt. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef __ENDIAN_H__ +#define __ENDIAN_H__ + +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 + +#if defined(__LITTLE_ENDIAN__) || defined(__ORDER_LITTLE_ENDIAN__) +#define __BYTE_ORDER __LITTLE_ENDIAN +#else +#define __BYTE_ORDER __BIG_ENDIAN +#endif + +#endif /* __ENDIAN_H__ */ diff --git a/SDKs/linux/usr/include/limits.h b/SDKs/linux/usr/include/limits.h new file mode 100644 index 000000000..5495a784f --- /dev/null +++ b/SDKs/linux/usr/include/limits.h @@ -0,0 +1,23 @@ +/* ===-- limits.h - stub SDK header for compiler-rt -------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This is a stub SDK header file. This file is not part of the interface of + * this library nor an official version of the appropriate SDK header. It is + * intended only to stub the features of this header required by compiler-rt. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef __LIMITS_H__ +#define __LIMITS_H__ + +/* This is only here as a landing pad for the include_next from the compiler's + built-in limits.h. */ + +#endif /* __LIMITS_H__ */ diff --git a/SDKs/linux/usr/include/stdio.h b/SDKs/linux/usr/include/stdio.h new file mode 100644 index 000000000..ddfe75548 --- /dev/null +++ b/SDKs/linux/usr/include/stdio.h @@ -0,0 +1,35 @@ +/* ===-- stdio.h - stub SDK header for compiler-rt --------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This is a stub SDK header file. This file is not part of the interface of + * this library nor an official version of the appropriate SDK header. It is + * intended only to stub the features of this header required by compiler-rt. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef __STDIO_H__ +#define __STDIO_H__ + +typedef __SIZE_TYPE__ size_t; + +struct _IO_FILE; +typedef struct _IO_FILE FILE; + +extern struct _IO_FILE *stdin; +extern struct _IO_FILE *stdout; +extern struct _IO_FILE *stderr; + +extern int fclose(FILE *); +extern int fflush(FILE *); +extern FILE *fopen(const char * restrict, const char * restrict); +extern int fprintf(FILE * restrict, const char * restrict, ...); +extern size_t fwrite(const void * restrict, size_t, size_t, FILE * restrict); + +#endif /* __STDIO_H__ */ diff --git a/SDKs/linux/usr/include/stdlib.h b/SDKs/linux/usr/include/stdlib.h new file mode 100644 index 000000000..b3755dff1 --- /dev/null +++ b/SDKs/linux/usr/include/stdlib.h @@ -0,0 +1,32 @@ +/* ===-- stdlib.h - stub SDK header for compiler-rt -------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This is a stub SDK header file. This file is not part of the interface of + * this library nor an official version of the appropriate SDK header. It is + * intended only to stub the features of this header required by compiler-rt. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef __STDLIB_H__ +#define __STDLIB_H__ + +#define NULL ((void *)0) + +typedef __SIZE_TYPE__ size_t; + +void abort(void) __attribute__((__nothrow__)) __attribute__((__noreturn__)); +void free(void *) __attribute__((__nothrow__)); +char *getenv(const char *) __attribute__((__nothrow__)) + __attribute__((__nonnull__(1))); + __attribute__((__warn_unused_result__)); +void *malloc(size_t) __attribute__((__nothrow__)) __attribute((__malloc__)) + __attribute__((__warn_unused_result__)); + +#endif /* __STDLIB_H__ */ diff --git a/SDKs/linux/usr/include/string.h b/SDKs/linux/usr/include/string.h new file mode 100644 index 000000000..5e9110937 --- /dev/null +++ b/SDKs/linux/usr/include/string.h @@ -0,0 +1,28 @@ +/* ===-- string.h - stub SDK header for compiler-rt -------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This is a stub SDK header file. This file is not part of the interface of + * this library nor an official version of the appropriate SDK header. It is + * intended only to stub the features of this header required by compiler-rt. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef __STRING_H__ +#define __STRING_H__ + +typedef __SIZE_TYPE__ size_t; + +char *strcat(char *, const char *); +char *strcpy(char *, const char *); +char *strdup(const char *); +size_t strlen(const char *); +char *strncpy(char *, const char *, size_t); + +#endif /* __STRING_H__ */ diff --git a/SDKs/linux/usr/include/sys/mman.h b/SDKs/linux/usr/include/sys/mman.h new file mode 100644 index 000000000..f27fdee69 --- /dev/null +++ b/SDKs/linux/usr/include/sys/mman.h @@ -0,0 +1,29 @@ +/* ===-- limits.h - stub SDK header for compiler-rt -------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This is a stub SDK header file. This file is not part of the interface of + * this library nor an official version of the appropriate SDK header. It is + * intended only to stub the features of this header required by compiler-rt. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef __SYS_MMAN_H__ +#define __SYS_MMAN_H__ + +typedef __SIZE_TYPE__ size_t; + +#define PROT_READ 0x1 +#define PROT_WRITE 0x1 +#define PROT_EXEC 0x4 + +extern int mprotect (void *__addr, size_t __len, int __prot) + __attribute__((__nothrow__)); + +#endif /* __SYS_MMAN_H__ */ diff --git a/SDKs/linux/usr/include/sys/stat.h b/SDKs/linux/usr/include/sys/stat.h new file mode 100644 index 000000000..0449fddb0 --- /dev/null +++ b/SDKs/linux/usr/include/sys/stat.h @@ -0,0 +1,24 @@ +/* ===-- stat.h - stub SDK header for compiler-rt ---------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This is a stub SDK header file. This file is not part of the interface of + * this library nor an official version of the appropriate SDK header. It is + * intended only to stub the features of this header required by compiler-rt. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef __SYS_STAT_H__ +#define __SYS_STAT_H__ + +typedef unsigned int mode_t; + +int mkdir(const char *, mode_t); + +#endif /* __SYS_STAT_H__ */ diff --git a/SDKs/linux/usr/include/sys/types.h b/SDKs/linux/usr/include/sys/types.h new file mode 100644 index 000000000..10e74bbd0 --- /dev/null +++ b/SDKs/linux/usr/include/sys/types.h @@ -0,0 +1,20 @@ +/* ===-- stat.h - stub SDK header for compiler-rt ---------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This is a stub SDK header file. This file is not part of the interface of + * this library nor an official version of the appropriate SDK header. It is + * intended only to stub the features of this header required by compiler-rt. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef __SYS_TYPES_H__ +#define __SYS_TYPES_H__ + +#endif /* __SYS_TYPES_H__ */ diff --git a/SDKs/linux/usr/include/unistd.h b/SDKs/linux/usr/include/unistd.h new file mode 100644 index 000000000..773b081d4 --- /dev/null +++ b/SDKs/linux/usr/include/unistd.h @@ -0,0 +1,26 @@ +/* ===-- unistd.h - stub SDK header for compiler-rt -------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This is a stub SDK header file. This file is not part of the interface of + * this library nor an official version of the appropriate SDK header. It is + * intended only to stub the features of this header required by compiler-rt. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef __UNISTD_H__ +#define __UNISTD_H__ + +enum { + _SC_PAGESIZE = 30 +}; + +extern long int sysconf (int __name) __attribute__ ((__nothrow__)); + +#endif /* __UNISTD_H__ */ |