sanitizer: Fix endianness checks for gcc
authorAlexey Samsonov <vonosmas@gmail.com>
Wed, 9 Mar 2016 23:39:40 +0000 (23:39 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Wed, 9 Mar 2016 23:39:40 +0000 (23:39 +0000)
commitc1424fc7c883c4bd184c4a715749a587c6b96fb2
treee9e36884ea4d9a2ed915e13c883176828114afb0
parent3c4b1290a417ea70318b7424c9376f02abf09343
sanitizer: Fix endianness checks for gcc

Summary:
__BIG_ENDIAN__ and __LITTLE_ENDIAN__ are not supported by gcc, which
eg. for ubsan Value::getFloatValue will silently fall through to
the little endian branch, breaking display of float values by ubsan.
Use __BYTE_ORDER__ == __ORDER_BIG/LITTLE_ENDIAN__ as the condition
instead, which is supported by both clang and gcc.

Noticed while porting ubsan to s390x.

Patch by Marcin Koƛcielnicki!

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

llvm-svn: 263077
compiler-rt/lib/asan/asan_report.cc
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
compiler-rt/lib/ubsan/ubsan_value.cc