about summary refs log tree commit diff homepage
path: root/runtime
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2021-02-19 08:02:45 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2021-02-22 16:16:12 +0000
commit148a68df793fca84a36fefd8824ea54fdf6583f4 (patch)
tree1108d4adaa999a5a5b10d4ff2cb9e0514577e168 /runtime
parent5f8d562181bce7c0d11eae0a597e3f534966e42c (diff)
downloadklee-148a68df793fca84a36fefd8824ea54fdf6583f4.tar.gz
runtime/POSIX: fix failures with glibc-2.33
commit 8ed005daf0ab of glibc-2.33 (Remove stat wrapper functions, move
them to exported symbols) removed renames of `__fxstat`, `__xstat`, and
`__lxstat` to `__fxstat64`, `__xstat64`, and `__lxstat64`, respectively.

But we relied on the renames to build `fd_64.c` properly. With glibc
2.33, we now see link failures of the POSIX runtime:
error: Linking globals named '__xstat': symbol multiply defined!

Rename the functions using `__REDIRECT_NTH` in the code as
`__USE_FILE_OFFSET64` case (which we define at the top of the file by
`#define _FILE_OFFSET_BITS 64`) did exactly that.

Fixes #1384.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/POSIX/fd_64.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/POSIX/fd_64.c b/runtime/POSIX/fd_64.c
index eec41f11..aea9ebac 100644
--- a/runtime/POSIX/fd_64.c
+++ b/runtime/POSIX/fd_64.c
@@ -73,6 +73,16 @@ int openat(int fd, const char *pathname, int flags, ...) {
   return __fd_openat(fd, pathname, flags, mode);
 }
 
+/* removed in glibc 2.33 */
+#ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH(__fxstat, (int __ver, int __fildes,
+                          struct stat *__stat_buf), __fxstat64);
+extern int __REDIRECT_NTH(__xstat, (int __ver, const char *__filename,
+                          struct stat *__stat_buf), __xstat64);
+extern int __REDIRECT_NTH(__lxstat, (int __ver, const char *__filename,
+                          struct stat *__stat_buf), __lxstat64);
+#endif
+
 off64_t lseek(int fd, off64_t offset, int whence) {
   return __fd_lseek(fd, offset, whence);
 }