From bd0f3345a938b35ce6a12f6150373b0955b8dd12 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 10 Jul 2011 15:24:15 -0500 Subject: Add Qt3 development HEAD version --- src/__debian_export_symbols.cpp | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/__debian_export_symbols.cpp (limited to 'src/__debian_export_symbols.cpp') diff --git a/src/__debian_export_symbols.cpp b/src/__debian_export_symbols.cpp new file mode 100644 index 0000000..71e30ad --- /dev/null +++ b/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 + +#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 ) 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 -- cgit v1.2.1