summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
...
* [sanitizers] [PowerPC] Intercept __tls_get_addr_opt.Marcin Koscielnicki2016-06-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | On PowerPC, if binutils and glibc are new enough, the linker uses an optimized code sequence to implement __tls_get_addr call stub, which will end up calling __tls_get_addr_opt instead of __tls_get_addr. Thus, we need to intercept it in addition to __tls_get_addr. This symbol is actually an alias of __tls_get_addr - its only purpose is that its presence in glibc triggers the optimization in linker. This means we can make our own intercepting symbol an alias as well. This patch will make the linker attempt optimization even on older glibc's (since it sees a defined __tls_get_addr_opt symbol in msan) - however, this is only a very minor performance problem (the linker generated code will never recognize a filled static TLS descriptor, always burning a few cycles), not a correctness problem. This fixes MSan's dtls_test.c, allowing us to finally enable MSan on PowerPC64. llvm-svn: 273250
* [msan] Don't check dstaddr in sendto() interceptor.Evgeniy Stepanov2016-06-201-5/+4
| | | | | | | | Dstaddr may contain uninitialized padding at the end (common implementations accept larger addrlen and ignore the extra bytes). Also, depending on the socket state, dstaddr argument may be ignored. llvm-svn: 273205
* [msan] Allow uninitialized padding in struct msghdr.Evgeniy Stepanov2016-06-201-1/+10
| | | | llvm-svn: 273204
* Hide send/sendto/sendmsg interptors under a flag.Evgeniy Stepanov2016-06-202-4/+11
| | | | | | | A runtime flag to enable checking in send* interceptors. Checking is enabled by default. llvm-svn: 273174
* [sanitizers] [SystemZ] Add __tls_get_offset interceptor.Marcin Koscielnicki2016-06-171-0/+54
| | | | | | | | | | | | | | | | | s390 is special again - instead of __tls_get_addr, it has __tls_get_offset with special calling conventions: the result is TP relative, and the argument is GOT-relative. Since we need to get address of the caller's GOT, which is in %r12, we have to use assembly like glibc does. Aside of __tls_get_offset, glibc also implements a slightly saner __tls_get_addr_internal, which takes a pointer as argument, but still returns a TP-relative offset. It is used for dlsym() called on TLS symbols, so we have to intercept it was well. Our __tls_get_offset is also implemented by delegating to it. Differential Revision: http://reviews.llvm.org/D19778 llvm-svn: 273041
* [sanitizer] [SystemZ] Enable TLS functionality.Marcin Koscielnicki2016-06-171-3/+6
| | | | | | | | This enables TLS knowledge for s390 in sanitizers. Differential Revision: http://reviews.llvm.org/D19594 llvm-svn: 273040
* Fix some warnings in the MSVC buildReid Kleckner2016-06-171-1/+1
| | | | | | | | | - Fixes warnings about the ignored -fms-compatibility-version flag. - Fixes warnings about overriding /W4 with /W3 and back. - Fixes a warning where PREFETCH() expanded to nothing in a braceless if block. llvm-svn: 273021
* [msan] Intercept send/sendto/sendmsg.Evgeniy Stepanov2016-06-172-0/+68
| | | | | | send/sendmsg moved from tsan to sanitizer_common; sendto is new. llvm-svn: 272980
* [sanitizers] introduce yet another API function: ↵Kostya Serebryany2016-06-163-0/+52
| | | | | | __sanitizer_install_malloc_and_free_hooks llvm-svn: 272943
* [sanitizer] Revert new GLIBC msghdr/cmsghdr definitionsAdhemerval Zanella2016-06-141-44/+0
| | | | | | | | | GLIBC reverted the POSIX conformance changes for msghdr/cmsghdr [1], so there is no need to fix it on sanitizers. [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=78880cc185dc521855a58001a28e3059722d8e85 llvm-svn: 272678
* [sanitizer][esan] Add internal_sigaction_syscallDerek Bruening2016-06-144-1/+70
| | | | | | | | | | | | | | | | | | | | | | | Summary: Adds a version of sigaction that uses a raw system call, to avoid circular dependencies and support calling sigaction prior to setting up interceptors. The new sigaction relies on an assembly sigreturn routine for its restorer, which is Linux x86_64-only for now. Uses the new sigaction to initialize the working set tool's shadow fault handler prior to libc interceptor being set up. This is required to support instrumentation invoked during interceptor setup, which happens with an instrumented tcmalloc or other allocator compiled with esan. Adds a test that emulates an instrumented allocator. Reviewers: aizatsky Subscribers: vitalybuka, tberghammer, zhaoqin, danalbert, kcc, srhines, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21083 llvm-svn: 272676
* Revert r272591, http://lab.llvm.org:8011/builders/clang-x64-ninja-win7 has ↵Nico Weber2016-06-144-70/+1
| | | | | | been broken since this landed. llvm-svn: 272659
* [sanitizer][esan] Add internal_sigaction_syscallDerek Bruening2016-06-134-1/+70
| | | | | | | | | | | | | | | | | | | | | | | Summary: Adds a version of sigaction that uses a raw system call, to avoid circular dependencies and support calling sigaction prior to setting up interceptors. The new sigaction relies on an assembly sigreturn routine for its restorer, which is Linux x86_64-only for now. Uses the new sigaction to initialize the working set tool's shadow fault handler prior to libc interceptor being set up. This is required to support instrumentation invoked during interceptor setup, which happens with an instrumented tcmalloc or other allocator compiled with esan. Adds a test that emulates an instrumented allocator. Reviewers: aizatsky Subscribers: vitalybuka, tberghammer, zhaoqin, danalbert, kcc, srhines, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21083 llvm-svn: 272591
* Revert "[sanitizer][esan] Add internal_sigaction_syscall"Derek Bruening2016-06-134-66/+1
| | | | | | | | This reverts commit r272553. The iOS build fails to link. llvm-svn: 272557
* [sanitizer][esan] Add internal_sigaction_syscallDerek Bruening2016-06-134-1/+66
| | | | | | | | | | | | | | | | | | | | | | | Summary: Adds a version of sigaction that uses a raw system call, to avoid circular dependencies and support calling sigaction prior to setting up interceptors. The new sigaction relies on an assembly sigreturn routine for its restorer, which is Linux x86_64-only for now. Uses the new sigaction to initialize the working set tool's shadow fault handler prior to libc interceptor being set up. This is required to support instrumentation invoked during interceptor setup, which happens with an instrumented tcmalloc or other allocator compiled with esan. Adds a test that emulates an instrumented allocator. Reviewers: aizatsky Subscribers: vitalybuka, tberghammer, zhaoqin, danalbert, kcc, srhines, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D21083 llvm-svn: 272553
* [sanitizer] Fix build for new GLIBC msghdr/cmsghdr definitionAdhemerval Zanella2016-06-071-0/+44
| | | | | | | | | | | | | | | GLIBC now follows POSIX [1] for both msghdr and cmsghdr definitions, which means that msg_iovlen, msg_controllen, and cmsg_len are no longer size_t but sockelen_t for 64-bits architectures. The final struct size does not change, since paddings were added. This patch fixes the build issue against GLIBC 2.24 socket.h header by using the same definition for internal __sanitizer_msghdr and __sanitizer_cmsghdr. [1] http://pubs.opengroup.org/onlinepubs/9699919799/ llvm-svn: 272008
* [tsan] Switch to InternalAlloc everywhere __libc_malloc is currently usedKuba Brecka2016-06-062-16/+73
| | | | | | | | | | This patch replaces all uses of __libc_malloc and friends with the internal allocator. It seems that the only reason why we have calls to __libc_malloc in the first place was the lack of the internal allocator at the time. Using the internal allocator will also make sure that the system allocator is never used (this is the same behavior as ASan), and we don’t have to worry about working with unknown pointers coming from the system allocator. Differential Revision: http://reviews.llvm.org/D21025 llvm-svn: 271916
* This patch attempts to primitive support for Win64 asanEtienne Bergeron2016-06-062-0/+14
| | | | | | | | | | | | | | Some known issues are: When "head" include instructions that involve branching, the "cut and paste" approach may break down in a way that function interception still work but calling back the original function does not work. The jmp [rip -8] saves some bytes in the "head" but finding the safe zone of 0xCC is not implemented yet. So it may stomp on preceding codes. The shadow offset is not working yet on Win64. More complexity maybe involved since there are some differences regarding virtual address space between Window 8 and Windows 8.1/10. Patch by: Wang Wei Differential Revision: http://reviews.llvm.org/D20884 llvm-svn: 271915
* [esan] Ensure internal_sigaction() bypasses interceptorsDerek Bruening2016-06-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: Implements real_sigaction() which it turns out is required for internal_sigaction() to bypass the libc interceptors. Without real_sigaction(), our internal_sigaction() calls during init happen to work due to the EsanDuringInit check in COMMON_INTERCEPTOR_ENTER (though even here it does not feel right for an "internal_" call to go through the interceptor). The real problem is when we call internal_sigaction() after we're initialized, which only happens on an unhandled SIGSEGV for which the app has no handler: then we'll spin in an infinite loop as our attempts to remove our own handler repeatedly fail. It's not easy to add a test for that, unfortunately. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20832 llvm-svn: 271626
* Add __sanitizer_set_report_fd to the internal list of symbols.Benjamin Kramer2016-05-301-0/+4
| | | | | | Otherwise it will get the wrong visibility in the resulting library. llvm-svn: 271202
* [sanitizers] introduce a common run-time option dedup_token_length to help ↵Kostya Serebryany2016-05-282-0/+14
| | | | | | with report deduplication, off by default for now. See https://github.com/google/sanitizers/issues/684 llvm-svn: 271085
* [esan] Add handling of large stack size rlimitsDerek Bruening2016-05-282-0/+5
| | | | | | | | | | | | | | | | | | | | | Summary: Adds detection of large stack size rlimits (over 1 TB or unlimited), which results in an mmap location that our shadow mapping does not support. We re-exec the application in this situation. Adds a test of this behavior. Adds general detection of mmap regions outside of our app regions. In the future we want to try to adaptively handle these but for now we abort. Moves the existing Linux-specific mmap code into a platform-specific file where the new rlimit code lives. Reviewers: eugenis Subscribers: vitalybuka, zhaoqin, kcc, aizatsky, llvm-commits, kubabrecka Differential Revision: http://reviews.llvm.org/D20745 llvm-svn: 271079
* [sanitizer] Move termination functions in their own fileKostya Serebryany2016-05-273-67/+96
| | | | | | | | | | | | | | | Summary: As suggested by kcc@ in http://reviews.llvm.org/D20084#441418, move the CheckFailed and Die functions, and their associated callback functionalities in their own separate file. I expended the build rules to include a new rule that would not include those termination functions, so that another project can define their own. The tests check-{a,t,m,ub,l,e,df}san are all passing. Reviewers: llvm-commits, kcc Subscribers: kubabrecka Differential Revision: http://reviews.llvm.org/D20742 llvm-svn: 271055
* [sanitizers] trying to fix Windows buildKostya Serebryany2016-05-271-1/+1
| | | | llvm-svn: 271050
* This patch is activating the build of Asan on Windows 64-bits.Etienne Bergeron2016-05-271-4/+7
| | | | | | | | | | | | | | | | | | It's fixing compilation errors. The runtime is not yet working. Missing features: OverrideFunction for x64 an equiv function for inline asm (atomic_compare_exchange_strong) shadow memory offset needs to be adjusted RoundUpToInstrBoundary for x64 They will be implemented by subsequent patches. Patch by Wei Wang. Differential revision: http://reviews.llvm.org/D20455 llvm-svn: 271049
* [sanitizers] introduce __sanitizer_set_report_fd so that we can re-route the ↵Kostya Serebryany2016-05-271-0/+5
| | | | | | sanitizer logging to another fd from inside the process llvm-svn: 271046
* [tsan] Don't abort when a deadlock detector finds a mutex cycle longer than 10Kuba Brecka2016-05-212-3/+8
| | | | | | | | In one of the already existing apps that I'm testing TSan on, I really see a mutex path that is longer than 10 (but not by much, something like 11-13 actually). Let's raise this to 20 and weaken the assertion so we don't crash. Differential Revision: http://reviews.llvm.org/D20427 llvm-svn: 270319
* Revert "[sanitizer] Move *fstat to the common interceptors"Benjamin Kramer2016-05-192-112/+2
| | | | | | | This reverts commit r269981. Breaks msan tests on linux http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/24019/steps/test%20standalone%20compiler-rt/logs/stdio llvm-svn: 270076
* [sanitizer] Move *fstat to the common interceptorsMike Aizatsky2016-05-182-2/+112
| | | | | | | | | | | | | | | | | | Summary: Adds *fstat to the common interceptors. Removes the now-duplicate fstat interceptor from msan/tsan This adds fstat to asan/esan, which previously did not intercept it. Resubmit of http://reviews.llvm.org/D20318 with ios build fixes. Reviewers: eugenis, vitalybuka, aizatsky Subscribers: zaks.anna, kcc, bruening, kubabrecka, srhines, danalbert, tberghammer Differential Revision: http://reviews.llvm.org/D20350 llvm-svn: 269981
* [sanitizer] Allow dlopen/dlclose interception to be disabled from cmakeFrancis Ricci2016-05-181-0/+4
| | | | | | | | | | | | | | Summary: dlopen and dlclose interception are broken when RUNPATH is used: https://llvm.org/bugs/show_bug.cgi?id=27790 Reviewers: kutuzov.viktor.84, samsonov, dvyukov, eugenis, kcc Subscribers: kcc, filcab, kubabrecka, compnerd, llvm-commits Differential Revision: http://reviews.llvm.org/D20333 llvm-svn: 269947
* [LSAN] Fix test swapcontext.cc on MIPSSagar Thakur2016-05-182-5/+5
| | | | | | | | | There is no frame validity check in the slow unwinder like there is in the fast unwinder due to which lsan reports a leak even for heap allocated coroutine in the test swapcontext.cc. Since mips/linux uses slow unwindwer instead of fast unwinder, the test fails for mips/linux. Therefore adding the checks before unwinding fixes the test for mips/linux. Reviewed by aizatsky. Differential: http://reviews.llvm.org/D19961 llvm-svn: 269882
* Revert "[sanitizer] Move *fstat to the common interceptors"Mike Aizatsky2016-05-172-112/+2
| | | | | | This reverts commit http://reviews.llvm.org/rL269856 llvm-svn: 269863
* [sanitizer] Move *fstat to the common interceptorsMike Aizatsky2016-05-172-2/+112
| | | | | | | | | | | | | | | | Summary: Adds *fstat to the common interceptors. Removes the now-duplicate fstat interceptor from msan/tsan This adds fstat to asan/esan, which previously did not intercept it. Reviewers: eugenis, vitalybuka, aizatsky Subscribers: tberghammer, danalbert, srhines, kubabrecka, bruening, kcc Differential Revision: http://reviews.llvm.org/D20318 llvm-svn: 269856
* [asan] Don't raise false alarm to recv/recvfrom when MSG_TRUNC is present.Maxim Ostapenko2016-05-171-2/+2
| | | | | | | | | | | | | | | | | | Fix https://llvm.org/bugs/show_bug.cgi?id=27673. Currenty ASan checks the return value of real recv/recvfrom to see if the written bytes fit in the buffer. That works fine most of time. However, there is an exception: (from the RECV(2) man page) MSG_TRUNC (since Linux 2.2) ... return the real length of the packet or datagram, even when it was longer than the passed buffer. ... Some programs combine MSG_TRUNC, MSG_PEEK and a single-byte buffer to peek the incoming data size without reading (much of) them. In this case, the return value is usually longer than what's been written and ASan raises a false alarm here. To avoid such false positive reports, we can use min(res, len) in COMMON_INTERCEPTOR_WRITE_RANGE checks. Differential Revision: http://reviews.llvm.org/D20280 llvm-svn: 269749
* [compiler-rt] Fix multi-configuration output pathsEtienne Bergeron2016-05-161-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When using a multi-configuration build (i.e. MSVC) the output path where libraries are dropped is incorrect. Example: ``` C:\src\llvm\examples>d:\src\llvm\build\Release\bin\clang-cl.exe -fsanitize=address test.cc LINK : fatal error LNK1181: cannot open input file 'd:\src\llvm\build\Release\bin\..\lib\clang\3.9.0\lib\windows\clang_rt.asan-i386.lib' ``` The dropped executable path contains the configuration 'Release': ``` 'd:\src\llvm\build\Release\bin\..\lib\clang\3.9.0\lib\windows\Release\clang_rt.asan-i386.lib' ``` The variable 'RUNTIME_OUTPUT_DIRECTORY' is used to specify the output directory. But CMAKE is appending the current configuration (i.e. Debug, Release). see: https://cmake.org/cmake/help/v3.0/prop_tgt/RUNTIME_OUTPUT_DIRECTORY.html ``` "Multi-configuration generators (VS, Xcode) append a per-configuration subdirectory to the specified directory." ``` To avoid this problem, the configuration specific variable must be set: 'RUNTIME_OUTPUT_DIRECTORY_DEBUG', 'RUNTIME_OUTPUT_DIRECTORY_RELEASE', and so on. Reviewers: ddunbar, chapuni, rnk Subscribers: kubabrecka, llvm-commits Differential Revision: http://reviews.llvm.org/D20261 llvm-svn: 269658
* More fixup for r269288 and r269296. Adding the missing 'return'.Kuba Brecka2016-05-121-1/+1
| | | | llvm-svn: 269310
* [sanitizer] Allow nullptr in Swift demanglerKuba Brecka2016-05-121-1/+3
| | | | | | | | The introduction of the Swift demangler now causes an assertion failure when we try to demangle nullptr, but we used to allow that (and return nullptr back). This situation is rare, but it can still happen. Let's allow nullptr. llvm-svn: 269302
* [mips][sanitizer_common] Don't use `ld` in internal_clone() on 32-bit MIPS.Daniel Sanders2016-05-121-0/+10
| | | | | | | | | | | | | | | | | | | | | | | Summary: On a 32-bit MIPS, the `ld` instruction does not exist. However, GAS has an `ld` macro that expands to a pair of `lw` instructions which load to a pair of registers (reg, and reg+1). This macro is not available in the Integrated Assembler and its use causes -fintegrated-as builds to fail. Even if it were available, the behaviour on 32-bit MIPS would be incorrect since the current usage of `ld` causes the code to clobber $5 (which is supposed to hold child_stack). It also clobbers $k0 which is reserved for kernel use. Aside from enabling builds with the integrated assembler, there is no functional change since internal_clone() is only used by StopTheWorld() which is only used by 64-bit sanitizers. Reviewers: kcc, sagar Subscribers: mohit.bhakkad, jaydeep, sagar, llvm-commits Differential Revision: http://reviews.llvm.org/D18753 llvm-svn: 269297
* Fixup for r269288. SleepForSeconds is not available in nolibc builds, let's ↵Kuba Brecka2016-05-124-0/+15
| | | | | | add an internal_sleep. llvm-svn: 269296
* [sanitizer] Fix a crash when demangling Swift symbols, take 2Kuba Brecka2016-05-123-14/+28
| | | | | | | | | | To invoke the Swift demangler, we use dlsym to locate swift_demangle. However, dlsym malloc's storage and stores it in thread-local storage. Since allocations from the symbolizer are done with the system allocator (at least in TSan, interceptors are skipped when inside the symbolizer), we will crash when we try to deallocate later using the sanitizer allocator again. To fix this, let's just not call dlsym from the demangler, and call it during initialization. The dlsym function calls malloc, so it needs to be only used after our allocator is initialized. Adding a Symbolizer::LateInitialize call that is only invoked after all other initializations. Differential Revision: http://reviews.llvm.org/D20015 llvm-svn: 269291
* [sanitizer] On OS X, exit the forked process gracefully when login_tty failsKuba Brecka2016-05-121-1/+5
| | | | | | | | We're using forkpty to spawn the atos symbolizer. In some cases, login_tty (part of forkpty) can fail due to security measures (sandboxing). In this case, we should exit with a status code instead of completely crashing the spawned process. Even processing a failed CHECK() is problematic here, because we're post-fork and pre-exec where a lot of things don't work (for multithreaded processes, for OS X GUI apps, etc.). Differential Revision: http://reviews.llvm.org/D20048 llvm-svn: 269289
* [sanitizer] Break infinite recursion in case of recursive failed CHECKsKuba Brecka2016-05-121-0/+8
| | | | | | | | While debugging ASan and TSan, I sometimes get a recursion during a failed CHECK processing. CheckFailed can call a lot of code (printing, unwinding a stack trace, symbolicating, ...) and this can fail another CHECK. This means I sometimes see a crash due to a infinite recursion stack overflow. Let's stop after 10 failed CHECKs and just kill the process immediately. I also added a Sleep(2) call before the trap, so that other threads still get a chance to print their failed CHECKs. Differential Revision: http://reviews.llvm.org/D20047 llvm-svn: 269288
* [asan] Don't use libcorkscrew on Android L+.Evgeniy Stepanov2016-05-111-0/+5
| | | | | | | | | | | | | ASan runtime library used libcorkscrew from Android platform for stack unwinding. Since Android L, this is both unnecessary (the libgcc unwinder has been fixed) and impossible (the library is not there any more). Don't even try. This should have not effect on modern Android devices other than removing a message about failing to open the library with ASAN_OPTIONS=verbosity=1. llvm-svn: 269233
* [sanitizer] Move *stat to the common interceptorsEvgeniy Stepanov2016-05-112-0/+54
| | | | | | | | | | | Adds *stat to the common interceptors. Removes the now-duplicate *stat interceptor from msan/tsan/esan. This adds *stat to asan, which previously did not intercept it. Patch by Qin Zhao. llvm-svn: 269223
* Revert r268716. This has caused test failures in MSan on Linux.Kuba Brecka2016-05-061-16/+10
| | | | llvm-svn: 268723
* [sanitizer] Fix a crash when demangling Swift symbolsKuba Brecka2016-05-061-10/+16
| | | | | | | | | | To invoke the Swift demangler, we use dlsym to locate swift_demangle. However, dlsym malloc's storage and stores it in thread-local storage. Since allocations from the symbolizer are done with the system allocator (at least in TSan, interceptors are skipped when inside the symbolizer), we will crash when we try to deallocate later using the sanitizer allocator again. To fix this, let's just not call dlsym from the demangler, and call it during initialization. Differential Revision: http://reviews.llvm.org/D19974 llvm-svn: 268716
* [sanitizer] Move stat/__xstat to the common interceptorsMike Aizatsky2016-05-033-0/+48
| | | | | | | | | | | | | | | | | | Summary: Adds stat/__xstat to the common interceptors. Removes the now-duplicate stat/__xstat interceptor from msan/tsan/esan. This adds stat/__xstat to asan, which previously did not intercept it. Resubmit of http://reviews.llvm.org/D19875 with win build fixes. Reviewers: aizatsky, eugenis Subscribers: tberghammer, llvm-commits, danalbert, vitalybuka, bruening, srhines, kubabrecka, kcc Differential Revision: http://reviews.llvm.org/D19890 llvm-svn: 268466
* Revert "[sanitizer] Move stat/__xstat to the common interceptors"Mike Aizatsky2016-05-033-48/+0
| | | | | | | | This reverts commit 268440 because it breaks the windows bot. http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21425/steps/build%20compiler-rt/logs/stdio llvm-svn: 268448
* [sanitizer] Move stat/__xstat to the common interceptorsMike Aizatsky2016-05-033-0/+48
| | | | | | | | | | | | | | | | Summary: Adds stat/__xstat to the common interceptors. Removes the now-duplicate stat/__xstat interceptor from msan/tsan/esan. This adds stat/__xstat to asan, which previously did not intercept it. Reviewers: aizatsky, eugenis Subscribers: tberghammer, danalbert, srhines, kubabrecka, llvm-commits, vitalybuka, eugenis, kcc, bruening Differential Revision: http://reviews.llvm.org/D19875 llvm-svn: 268440
* [compiler-rt] adjust platform_limits_linux.cc #include of posix_typesKostya Serebryany2016-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud