[sanitizer] Fix aarch64 sanitizer build with recent glibc

Kostya Serebryany kcc at google.com
Tue Jan 20 18:10:17 PST 2015


Thanks!
r226637

On Tue, Jan 20, 2015 at 10:05 AM, Jakub Jelinek <jakub at redhat.com> wrote:

> Hi!
>
> glibc recently changed ABI on aarch64-linux:
>
> https://sourceware.org/git/?p=glibc.git;a=commit;h=5c40c3bab2fddaca8cfe12d75944d1fef8adf1a4
> Instead of having unsigned short mode; unsigned short __pad1; it now has
> unsigned int mode; field in ipc_perm structure.
>
> This patch allows to build against the recent glibc and disables the
> ipc_perm.mode verification for older versions of glibc.
>
> I think it shouldn't be a big deal even for older glibcs, I couldn't find
> any place which would actually care about the exact mode field, rather than
> the whole structure, appart from the CHECK_SIZE_AND_OFFSET macro.
>
> --- compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h.jj
>      2014-10-14 15:11:22.170590985 +0200
> +++ compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
> 2015-01-20 18:53:20.969780785 +0100
> @@ -169,7 +169,7 @@ namespace __sanitizer {
>      unsigned __seq;
>      u64 __unused1;
>      u64 __unused2;
> -#elif defined(__mips__)
> +#elif defined(__mips__) || defined(__aarch64__)
>      unsigned int mode;
>      unsigned short __seq;
>      unsigned short __pad1;
> ---
> compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc.jj
> 2014-12-15 19:50:53.597624368 +0100
> +++ compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
> 2015-01-20 18:53:21.007780141 +0100
> @@ -1061,7 +1061,13 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
>  CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
>  CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
>  CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
> +#ifndef __GLIBC_PREREQ
> +#define __GLIBC_PREREQ(x, y) 0
> +#endif
> +#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
> +/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
>  CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
> +#endif
>
>  CHECK_TYPE_SIZE(shmid_ds);
>  CHECK_SIZE_AND_OFFSET(shmid_ds, shm_perm);
>
>
>         Jakub
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150120/42715e53/attachment.html>


More information about the llvm-commits mailing list