[compiler-rt] adjust platform_limits_linux.cc #include of posix_types
authorKostya Serebryany <kcc@google.com>
Mon, 2 May 2016 19:10:48 +0000 (19:10 +0000)
committerKostya Serebryany <kcc@google.com>
Mon, 2 May 2016 19:10:48 +0000 (19:10 +0000)
commit9d91336a839d291ea52e91401e9bd92f4dfc5b5a
tree14e7ac7f6410d96932ab75fb7e7af3e96bfbd0f5
parentd83c96fa443cd2c61b99b9d7d453515f352af026
[compiler-rt] adjust platform_limits_linux.cc #include of posix_types

Summary:
Hello,

Building a recent gcc on a powerpc-linux system advertsing:

 Red Hat Enterprise Linux Server release 5.10 (Tikanga)

we stumbled on a compilation error on a file originating
from compiler-rt/lib/sanitizer-common.

sanitizer_platform_limits_linux.cc #includes asm/posix_types.h,
which, on our system, uses __kernel_fd_set and associated macros.
These aren't defined at the point of their use, and the compilation
fails with symptoms like:

  In file included from ../../../../src/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc:29:0:
  /usr/include/asm/posix_types.h:72:51: error: '__kernel_fd_set' has not been declared
  static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
  ...

The attached patch is a suggestion to fix this, by including linux/posix_types.h
instead of asm/posix_types.h. linux/posix_types defines the necessary types and
macros, then #includes asm/posix_types.h.

We have been using it locally for gcc without problems for a couple of years
on powerpc, x86 and x86_64-linux platforms. It is still needed for gcc-6 on
our powerpc host and applies cleanly on the compiler-rt trunk.

Comments ?

Thanks much in advance for your feedback,

With Kind Regards,

Olivier

Reviewers: llvm-commits, kcc

Subscribers: kcc, kubabrecka

Differential Revision: http://reviews.llvm.org/D19799

llvm-svn: 268283
compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cc