summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/src/__debian_export_symbols.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tqtinterface/qt4/src/__debian_export_symbols.cpp')
-rw-r--r--tqtinterface/qt4/src/__debian_export_symbols.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/tqtinterface/qt4/src/__debian_export_symbols.cpp b/tqtinterface/qt4/src/__debian_export_symbols.cpp
new file mode 100644
index 0000000..71e30ad
--- /dev/null
+++ b/tqtinterface/qt4/src/__debian_export_symbols.cpp
@@ -0,0 +1,63 @@
+// Use the __NO_INLINE__ hack below to prevent sys/stat.h from
+// exporting __extern_inline definitions of the symbols [fl]?stat64
+// with g++-4.3 or later and glibc6 >= 2.7 or later. This flag has no
+// impact on [fl]?stat(64)? symbol export for glibc6 << 2.7
+//
+#ifndef __NO_INLINE__
+# define __NO_INLINE__
+# define INLINE_ENABLED
+#endif
+
+#include <sys/stat.h>
+
+#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 7)
+
+// We must ensure that [fl]?stat64 are exported in the dynamic symbol
+// table of libqt-mt.so.3 as weak symbols to preserve ABI.
+int stat64 (__const char *__path, struct stat64 *__statbuf) __attribute__((weak));
+int lstat64 (__const char *__path, struct stat64 *__statbuf) __attribute__((weak));
+int fstat64 (int __fd, struct stat64 *__statbuf) __attribute__((weak));
+
+int stat64 (__const char *__path, struct stat64 *__statbuf)
+{
+ return __xstat64 (_STAT_VER, __path, __statbuf);
+}
+
+int lstat64 (__const char *__path, struct stat64 *__statbuf)
+{
+ return __lxstat64 (_STAT_VER, __path, __statbuf);
+}
+
+int fstat64 (int __fd, struct stat64 *__statbuf)
+{
+ return __fxstat64 (_STAT_VER, __fd, __statbuf);
+}
+
+#else
+# ifndef INLINE_ENABLED
+/*
+ * Trigger export of the extern __inline [fl]?stat64 symbols
+ * (defined at <sys/stat.h>) by referencing them in the dummy
+ * hidden function below. It's very important to reference
+ * [fl]?stat64 via their [fl]?stat aliases (because LARGEFILE
+ * is enabled) for these weak symbols to get exported.
+ *
+ * This hack is compatible with libc6-dev << 2.7 headers.
+ *
+ * This source file must be compiled with -fno-inline to have
+ * expected effect.
+ **/
+void __stat_extern_inline_export_hack()
+ __attribute__((visibility("hidden")));
+
+void __stat_extern_inline_export_hack() {
+ struct stat buf;
+ stat("", &buf);
+ lstat("", &buf);
+ fstat(0, &buf);
+}
+# else
+# error "This file must be compiled with inline disabled for the hack to be effective."
+# endif /* INLINES_ENABLED */
+
+#endif