diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2017-03-15 13:42:26 +0100 |
---|---|---|
committer | Jiri Slaby <jirislaby@gmail.com> | 2017-03-15 13:46:58 +0100 |
commit | 2852ef63e23e9742dcaba4d59f44b41adbe80b96 (patch) | |
tree | 90ae4a20faea1a3609bedff1697097a50a94d0c2 | |
parent | 76bcb45aab9c86c63db3b834cca6126effd1c112 (diff) | |
download | klee-2852ef63e23e9742dcaba4d59f44b41adbe80b96.tar.gz |
runtime: POSIX, make it compile with glibc 2.25
With glibc 2.25, we see: runtime/POSIX/stubs.c:243:14: error: conflicting types for 'gnu_dev_major' unsigned int gnu_dev_major(unsigned long long int __dev) __attribute__((weak)); ^ /usr/include/sys/sysmacros.h:79:27: note: previous definition is here __SYSMACROS_DEFINE_MAJOR (__SYSMACROS_IMPL_TEMPL) ^ Glibc 2.25 switched from ULL to dev_t for gnu_dev_major, gnu_dev_minor, and gnu_dev_makedev. Handle by using an appropriate type according to the glibc version. Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
-rw-r--r-- | runtime/POSIX/stubs.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/runtime/POSIX/stubs.c b/runtime/POSIX/stubs.c index b4f31bf7..bb528ad4 100644 --- a/runtime/POSIX/stubs.c +++ b/runtime/POSIX/stubs.c @@ -240,21 +240,27 @@ int strverscmp (__const char *__s1, __const char *__s2) { return strcmp(__s1, __s2); /* XXX no doubt this is bad */ } -unsigned int gnu_dev_major(unsigned long long int __dev) __attribute__((weak)); -unsigned int gnu_dev_major(unsigned long long int __dev) { +#if __GLIBC_PREREQ(2, 25) +#define gnu_dev_type dev_t +#else +#define gnu_dev_type unsigned long long int +#endif + +unsigned int gnu_dev_major(gnu_dev_type __dev) __attribute__((weak)); +unsigned int gnu_dev_major(gnu_dev_type __dev) { return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); } -unsigned int gnu_dev_minor(unsigned long long int __dev) __attribute__((weak)); -unsigned int gnu_dev_minor(unsigned long long int __dev) { +unsigned int gnu_dev_minor(gnu_dev_type __dev) __attribute__((weak)); +unsigned int gnu_dev_minor(gnu_dev_type __dev) { return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); } -unsigned long long int gnu_dev_makedev(unsigned int __major, unsigned int __minor) __attribute__((weak)); -unsigned long long int gnu_dev_makedev(unsigned int __major, unsigned int __minor) { +gnu_dev_type gnu_dev_makedev(unsigned int __major, unsigned int __minor) __attribute__((weak)); +gnu_dev_type gnu_dev_makedev(unsigned int __major, unsigned int __minor) { return ((__minor & 0xff) | ((__major & 0xfff) << 8) - | (((unsigned long long int) (__minor & ~0xff)) << 12) - | (((unsigned long long int) (__major & ~0xfff)) << 32)); + | (((gnu_dev_type) (__minor & ~0xff)) << 12) + | (((gnu_dev_type) (__major & ~0xfff)) << 32)); } char *canonicalize_file_name (const char *name) __attribute__((weak)); |