[compiler-rt] r244646 - [ubsan][mips] Revise r243384 to avoid special casing big-endian mips.
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 11 11:46:23 PDT 2015
This is the revision to r243384 that was requested in its merge request at http://reviews.llvm.org/D11448. I've tested it on a big-endian MIPS system as well as on my x86_64 system and it works correctly for me. I'm just waiting for it to work it's way through the buildbots.
Richard: Assuming the buildbots are ok, is this ok to merge to LLVM 3.7.0?
________________________________________
From: llvm-commits [llvm-commits-bounces at lists.llvm.org] on behalf of Daniel Sanders via llvm-commits [llvm-commits at lists.llvm.org]
Sent: 11 August 2015 19:40
To: llvm-commits at lists.llvm.org
Subject: [compiler-rt] r244646 - [ubsan][mips] Revise r243384 to avoid special casing big-endian mips.
Author: dsanders
Date: Tue Aug 11 13:40:02 2015
New Revision: 244646
URL: http://llvm.org/viewvc/llvm-project?rev=244646&view=rev
Log:
[ubsan][mips] Revise r243384 to avoid special casing big-endian mips.
Account for the case when uptr is 32-bit instead of trying to fix this case
using the little endian path.
Modified:
compiler-rt/trunk/lib/ubsan/ubsan_value.cc
Modified: compiler-rt/trunk/lib/ubsan/ubsan_value.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_value.cc?rev=244646&r1=244645&r2=244646&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_value.cc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_value.cc Tue Aug 11 13:40:02 2015
@@ -83,10 +83,11 @@ FloatMax Value::getFloatValue() const {
#endif
case 32: {
float Value;
-#if defined(__BIG_ENDIAN__) && !defined(__mips__)
- // For big endian the float value is in the second 4 bytes
- // instead of the first 4 bytes.
- internal_memcpy(&Value, ((const char*)&Val)+4, 4);
+#if defined(__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.
+ internal_memcpy(&Value, ((const char*)(&Val + 1)) - 4, 4);
#else
internal_memcpy(&Value, &Val, 4);
#endif
_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list