Bug 832942: work around an ARMv6 code generation bug in gcc 4.6. r=wtc, a=akeybl.
authorCamilo Viecco <cviecco@mozilla.com>
Mon, 18 Mar 2013 19:49:38 -0700
changeset 128645 b802cd3011a17d3759332732825a031b88e1566e
parent 128644 baaf828aba27dc9668d209ba9471183de5c62a17
child 128646 853deb8dc20a692faacd72f964556c64da34fa06
push id3528
push userbsmith@mozilla.com
push dateTue, 19 Mar 2013 04:05:34 +0000
treeherdermozilla-aurora@b802cd3011a1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswtc, akeybl
bugs832942
milestone21.0a2
Bug 832942: work around an ARMv6 code generation bug in gcc 4.6. r=wtc, a=akeybl.
security/nss/lib/softoken/pkcs11.c
security/patches/README
security/patches/bug-832942.patch
--- a/security/nss/lib/softoken/pkcs11.c
+++ b/security/nss/lib/softoken/pkcs11.c
@@ -1889,17 +1889,28 @@ sftk_mkPrivKey(SFTKObject *object, CK_KE
 	    crv = sftk_Attribute2SSecItem(arena, &privKey->u.ec.publicValue,
  				object, CKA_NETSCAPE_DB);
 	    if (crv != CKR_OK) break;
 	    /* privKey was zero'd so public value is already set to NULL, 0
 	     * if we don't set it explicitly */
 	}
         rv = DER_SetUInteger(privKey->arena, &privKey->u.ec.version,
                           NSSLOWKEY_EC_PRIVATE_KEY_VERSION);
-	if (rv != SECSuccess) crv = CKR_HOST_MEMORY;
+	if (rv != SECSuccess) {
+	    crv = CKR_HOST_MEMORY;
+	    /* The following ifdef is needed for Linux arm distros and
+	     * Android as gcc 4.6 has a bug when targeting arm (but not
+	     * thumb). The bug has been fixed in gcc 4.7.
+	     * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56561
+	     */
+#if defined (__arm__) && !defined(__thumb__) && defined (__GNUC__)
+	    *crvp = CKR_HOST_MEMORY;
+	    break;
+#endif
+	}
 	break;
 #endif /* NSS_ENABLE_ECC */
 
     default:
 	crv = CKR_KEY_TYPE_INCONSISTENT;
 	break;
     }
     if (crv == CKR_OK && itemTemplateCount != 0) {
--- a/security/patches/README
+++ b/security/patches/README
@@ -1,6 +1,7 @@
 This directory contains patches that were added locally
 on top of the NSS release.
 
 bug-834091.patch: Add SEC_PKCS7VerifyDetachedSignatureAtTime, which is needed
                   for B2G 1.0. This patch is probably going to be modified
                   before it can land in upstream NSS.
+bug-832942.patch: work around an ARMv6 code generation bug in gcc 4.6.
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/security/patches/bug-832942.patch
@@ -0,0 +1,33 @@
+diff --git a/lib/softoken/pkcs11.c b/lib/softoken/pkcs11.c
+--- a/lib/softoken/pkcs11.c
++++ b/lib/softoken/pkcs11.c
+@@ -1889,17 +1889,28 @@ sftk_mkPrivKey(SFTKObject *object, CK_KE
+ 	    crv = sftk_Attribute2SSecItem(arena, &privKey->u.ec.publicValue,
+  				object, CKA_NETSCAPE_DB);
+ 	    if (crv != CKR_OK) break;
+ 	    /* privKey was zero'd so public value is already set to NULL, 0
+ 	     * if we don't set it explicitly */
+ 	}
+         rv = DER_SetUInteger(privKey->arena, &privKey->u.ec.version,
+                           NSSLOWKEY_EC_PRIVATE_KEY_VERSION);
+-	if (rv != SECSuccess) crv = CKR_HOST_MEMORY;
++	if (rv != SECSuccess) {
++	    crv = CKR_HOST_MEMORY;
++	    /* The following ifdef is needed for Linux arm distros and
++	     * Android as gcc 4.6 has a bug when targeting arm (but not
++	     * thumb). The bug has been fixed in gcc 4.7.
++	     * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56561
++	     */
++#if defined (__arm__) && !defined(__thumb__) && defined (__GNUC__)
++	    *crvp = CKR_HOST_MEMORY;
++	    break;
++#endif
++	}
+ 	break;
+ #endif /* NSS_ENABLE_ECC */
+ 
+     default:
+ 	crv = CKR_KEY_TYPE_INCONSISTENT;
+ 	break;
+     }
+     if (crv == CKR_OK && itemTemplateCount != 0) {