This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][PR sanitizer/78532] Fix libsanitizer build failure on sparc64-linux-gnu.
- From: Maxim Ostapenko <m dot ostapenko at samsung dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jakub Jelinek <jakub at redhat dot com>, doko at ubuntu dot com
- Date: Wed, 30 Nov 2016 15:10:49 +0300
- Subject: [PATCH][PR sanitizer/78532] Fix libsanitizer build failure on sparc64-linux-gnu.
- Authentication-results: sourceware.org; auth=none
- Cms-type: 201P
- References: <CGME20161130121049eucas1p2c6dbe9a662a8df2bd4b2ca05c9b1a5f3@eucas1p2.samsung.com>
Hi,
this patch restores libsanitizer build on sparc64-linux-gnu with Glibc
2.20+ on board.
I verified that this patch fixes the build error locally with Glibc 2.24.
Ok for mainline?
libsanitizer/ChangeLog:
2016-11-30 Maxim Ostapenko <m.ostapenko@samsung.com>
PR sanitizer/78532
* sanitizer_common/sanitizer_platform_limits_posix.h
(__sanitizer_sigaction): Adjust for sparc targets and various Glibc
versions.
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index d1a3051..066bf41 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -25,6 +25,10 @@
# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle))
#endif // !SANITIZER_FREEBSD
+#ifndef __GLIBC_PREREQ
+#define __GLIBC_PREREQ(x, y) 0
+#endif
+
namespace __sanitizer {
extern unsigned struct_utsname_sz;
extern unsigned struct_stat_sz;
@@ -628,7 +632,14 @@ namespace __sanitizer {
#endif
#ifndef __mips__
#if defined(__sparc__)
+#if __GLIBC_PREREQ (2, 20)
+ // On sparc glibc 2.19 and earlier sa_flags was unsigned long, and
+ // __glibc_reserved0 didn't exist.
+ int __glibc_reserved0;
+ int sa_flags;
+#else
unsigned long sa_flags;
+#endif
#else
int sa_flags;
#endif