http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59018
Bug ID: 59018 Summary: [4.9 Regression] libsanitizer doesn't build for x32 Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org r204368 breaks x32. There are 4 problems: 1. internal_syscall casts pointers to uint64. It doesn't work for x32 since 32-bit pointers are signed extended to int64. They should be casted to uptr first. A patch is posted at http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00403.html 2. internal_clone needs to allocate 2 int64 to restore 2 pointers by pop which only pops 64-bit integer into 64-bit register. Also "movq %6,%%r8\n" can't be used to load 32-bit pointer into 64-bit r8. We should let compiler handle it. A patch is posted at http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00405.html 3. x32 uses the same file system calls as x86-64. The types used in those system calls must be the same for x32 and x86-64. A patch is posted at http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00407.html 4. X32 uses the same FPU state as x86-64. We should check __x86_64 instead of __WORDSIZE == 64. A patch is posted at http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00408.html All patches are tested on x32, x86-64 and x86.