Closed Bug 1233981 Opened 9 years ago Closed 9 years ago

rijndael.c needs to #include <intrin.h> for _xgetvb()

Categories

(NSS :: Libraries, defect, P2)

x86_64
Windows
defect

Tracking

(firefox46 affected)

RESOLVED FIXED
Tracking Status
firefox46 --- affected

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file, 2 obsolete files)

Without this, clang-cl generates:

rijndael.obj : error LNK2019: unresolved external symbol _xgetbv referenced in function check_xcr0_ymm
Attachment #8700328 - Flags: review?(wtc)
Comment on attachment 8700328 [details] [diff] [review]
Add #include <intrin.h> to rijndael.c for _xgetvb()

Review of attachment 8700328 [details] [diff] [review]:
-----------------------------------------------------------------

Ehsan: thanks for the patch. I suggest two changes.

::: security/nss/lib/freebl/rijndael.c
@@ +31,5 @@
>  static int has_intel_clmul = 0;
>  static PRBool use_hw_gcm = PR_FALSE;
> +#if defined(_MSC_VER)
> +#if !defined(_M_IX86)
> +#include <intrin.h>

I would simplify the ifdef as #if defined(_MSC_VER) && !defined(_M_IX86).

According to the MSDN page at https://msdn.microsoft.com/en-us/library/hh977022.aspx, we should include the header immintrin.h. Could you please try that? Thanks.
Attachment #8700328 - Flags: review?(wtc) → review+
Thanks for the review!  Should I land on the nss repository with your suggestions or would you like to look at another version of the patch?
Ehsan: I don't think you have commit access to the NSS repository
(https://hg.mozilla.org/projects/nss). Please attach a new version
of the patch, and I'll check it in for you. Thanks.
clang-cl currently declares _xgetbv() in intrin.h not in immintrin.h, like many other intrinsics.  In other similar situations we have just included intrin.h, even though that's not necessary for MSVC.  I prefer to do the same here, if possible.
Attachment #8700328 - Attachment is obsolete: true
Ehsan: I added a comment to the #include statement and checked in your patch:
https://hg.mozilla.org/projects/nss/rev/9e482f91fcbd
Attachment #8703211 - Attachment is obsolete: true
Attachment #8703741 - Flags: review+
Attachment #8703741 - Flags: checked-in+
Status: NEW → RESOLVED
Closed: 9 years ago
OS: Unspecified → Windows
Priority: -- → P2
Hardware: Unspecified → x86_64
Resolution: --- → FIXED
Target Milestone: --- → 3.22
Thanks, Wan-Teh!

Is there a bug tracking the next NSS merge on mozilla-central?
Ehsan: I just did a search for "NSS 3.22" in Bugzilla and found
the tracking bug: bug 1228410.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: