[PATCH] D17660: sanitizer: Fix endianness checks for gcc

Marcin Koƛcielnicki via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 8 06:53:16 PST 2016


koriakin retitled this revision from "ubsan: Fix endianness check in Value::getFloatValue for gcc" to "sanitizer: Fix endianness checks for gcc".
koriakin updated the summary for this revision.
koriakin removed rL LLVM as the repository for this revision.
koriakin updated this revision to Diff 50040.
koriakin added a comment.

Added a few other places in sanitizers.  There are a few uses left, but these are in areas that shouldn't be hit by gcc/clang.


http://reviews.llvm.org/D17660

Files:
  lib/asan/asan_report.cc
  lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
  lib/tsan/rtl/tsan_interceptors.cc
  lib/ubsan/ubsan_value.cc

Index: lib/ubsan/ubsan_value.cc
===================================================================
--- lib/ubsan/ubsan_value.cc
+++ lib/ubsan/ubsan_value.cc
@@ -83,7 +83,7 @@
 #endif
       case 32: {
         float Value;
-#if defined(__BIG_ENDIAN__)
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
        // For big endian the float value is in the last 4 bytes.
        // On some targets we may only have 4 bytes so we count backwards from
        // the end of Val to account for both the 32-bit and 64-bit cases.
Index: lib/tsan/rtl/tsan_interceptors.cc
===================================================================
--- lib/tsan/rtl/tsan_interceptors.cc
+++ lib/tsan/rtl/tsan_interceptors.cc
@@ -87,10 +87,10 @@
 #endif
 
 #if defined(__x86_64__) || defined(__mips__) \
-  || (defined(__powerpc64__) && defined(__BIG_ENDIAN__))
+  || (defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
 #define PTHREAD_ABI_BASE  "GLIBC_2.3.2"
 #elif defined(__aarch64__) || (defined(__powerpc64__) \
-  && defined(__LITTLE_ENDIAN__))
+  && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
 #define PTHREAD_ABI_BASE  "GLIBC_2.17"
 #endif
 
Index: lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
===================================================================
--- lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
+++ lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
@@ -209,9 +209,9 @@
     const char* const kSymbolizerArch = "--default-arch=arm64";
 #elif defined(__arm__)
     const char* const kSymbolizerArch = "--default-arch=arm";
-#elif defined(__powerpc64__) && defined(__BIG_ENDIAN__)
+#elif defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
     const char* const kSymbolizerArch = "--default-arch=powerpc64";
-#elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
+#elif defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
     const char* const kSymbolizerArch = "--default-arch=powerpc64le";
 #else
     const char* const kSymbolizerArch = "--default-arch=unknown";
Index: lib/asan/asan_report.cc
===================================================================
--- lib/asan/asan_report.cc
+++ lib/asan/asan_report.cc
@@ -471,7 +471,7 @@
   // previously. That's unfortunate, but I have no better solution,
   // especially given that the alloca may be from entirely different place
   // (e.g. use-after-scope, or different thread's stack).
-#if defined(__powerpc64__) && defined(__BIG_ENDIAN__)
+#if defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
   // On PowerPC64 ELFv1, the address of a function actually points to a
   // three-doubleword data structure with the first field containing
   // the address of the function's code.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17660.50040.patch
Type: text/x-patch
Size: 2723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160308/f5a2806b/attachment.bin>


More information about the llvm-commits mailing list