diff options
Diffstat (limited to 'runtime/POSIX')
-rw-r--r-- | runtime/POSIX/fd_32.c | 29 | ||||
-rw-r--r-- | runtime/POSIX/fd_64.c | 13 |
2 files changed, 32 insertions, 10 deletions
diff --git a/runtime/POSIX/fd_32.c b/runtime/POSIX/fd_32.c index 5d311206..13195fbf 100644 --- a/runtime/POSIX/fd_32.c +++ b/runtime/POSIX/fd_32.c @@ -6,7 +6,19 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// Contains 32bit definitions of posix file functions +//===--- +#if __GNUC__ +#if __x86_64__ || __ppc64__ +#define ENV64 +#else +#define ENV32 +#endif +#endif + +#include "klee/Config/Version.h" +#if defined(ENV32) || (LLVM_VERSION_CODE < LLVM_VERSION(3, 3)) #define _LARGEFILE64_SOURCE #include "fd.h" @@ -180,8 +192,7 @@ int __getdents(unsigned int fd, struct dirent *dirp, unsigned int count) /* Forward to 64 versions (uclibc expects versions w/o asm specifier) */ -int open64(const char *pathname, int flags, ...) __attribute__((weak)); -int open64(const char *pathname, int flags, ...) { +__attribute__((weak)) int open64(const char *pathname, int flags, ...) { mode_t mode = 0; if (flags & O_CREAT) { @@ -195,22 +206,20 @@ int open64(const char *pathname, int flags, ...) { return __fd_open(pathname, flags, mode); } -off64_t lseek64(int fd, off64_t off, int whence) __attribute__((weak)); -off64_t lseek64(int fd, off64_t off, int whence) { +__attribute__((weak)) off64_t lseek64(int fd, off64_t off, int whence) { return __fd_lseek(fd, off, whence); } -int stat64(const char *path, struct stat64 *buf) __attribute__((weak)); -int stat64(const char *path, struct stat64 *buf) { +__attribute__((weak)) int stat64(const char *path, struct stat64 *buf) { return __fd_stat(path, buf); } -int lstat64(const char *path, struct stat64 *buf) __attribute__((weak)); -int lstat64(const char *path, struct stat64 *buf) { +__attribute__((weak)) int lstat64(const char *path, struct stat64 *buf) { return __fd_lstat(path, buf); } -int fstat64(int fd, struct stat64 *buf) __attribute__((weak)); -int fstat64(int fd, struct stat64 *buf) { +__attribute__((weak)) int fstat64(int fd, struct stat64 *buf) { return __fd_fstat(fd, buf); } + +#endif diff --git a/runtime/POSIX/fd_64.c b/runtime/POSIX/fd_64.c index 742e560f..2178ad14 100644 --- a/runtime/POSIX/fd_64.c +++ b/runtime/POSIX/fd_64.c @@ -7,6 +7,17 @@ // //===----------------------------------------------------------------------===// +#if __GNUC__ +#if __x86_64__ || __ppc64__ +#define ENV64 +#else +#define ENV32 +#endif +#endif + + +#include "klee/Config/Version.h" +#if defined(ENV64) || (LLVM_VERSION_CODE < LLVM_VERSION(3, 3)) #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #include "fd.h" @@ -102,3 +113,5 @@ int getdents64(unsigned int fd, struct dirent *dirp, unsigned int count) { } int __getdents64(unsigned int fd, struct dirent *dirp, unsigned int count) __attribute__((alias("getdents64"))); + +#endif |