klee/0001-runtime-POSIX-fix-failures-with-glibc-2.33.patch

49 lines
1.3 KiB
Diff

From: Jiri Slaby <jirislaby@gmail.com>
Date: Fri, 19 Feb 2021 08:02:45 +0100
Subject: runtime/POSIX: fix failures with glibc-2.33
Patch-mainline: submitted, pr #1385
References: stat
commit 8ed005daf0ab03e142500324a34087ce179ae78e of glibc-2.33 (Remove
stat wrapper functions, move them to exported symbols) removed
definitions of __fxstat, __xstat, and __lxstat. But we need them so that
we build __fxstat64, __xstat64, and __lxstat64 in fd_64.c properly.
Otherwise we see link failures of the POSIX runtime:
error: Linking globals named '__xstat': symbol multiply defined!
Fixes #1384.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
runtime/POSIX/fd_64.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/runtime/POSIX/fd_64.c b/runtime/POSIX/fd_64.c
index eec41f113024..2a1c774962e2 100644
--- a/runtime/POSIX/fd_64.c
+++ b/runtime/POSIX/fd_64.c
@@ -77,6 +77,19 @@ off64_t lseek(int fd, off64_t offset, int whence) {
return __fd_lseek(fd, offset, whence);
}
+/* glibc 2.33 removed these defs */
+#ifdef __USE_FILE_OFFSET64
+#ifndef __fxstat
+#define __fxstat __fxstat64
+#endif
+#ifndef __xstat
+#define __xstat __xstat64
+#endif
+#ifndef __lxstat
+#define __lxstat __lxstat64
+#endif
+#endif
+
int __xstat(int vers, const char *path, struct stat *buf) {
return __fd_stat(path, (struct stat64*) buf);
}
--
2.30.1