Closed Bug 1659727 Opened 3 years ago Closed 3 years ago

mpcpucache.c invalid output constraint on Linux/ARM


(NSS :: Libraries, defect, P2)



(Not tracked)



(Reporter: jcj, Assigned: congdanhqx)




(Keywords: regression)


(2 files)

Originally from

mpi/mpcpucache.c:91:15: error: invalid output constraint '=a' in asm
: "=a"(*eax),

the compile command contains -Di386 which originates from:


this is because of the include added in the commit; at the time in not all variables that affect have been initialized yet and so it sets x86 specific variables, which are not all overwritten when is included a second time.

the easiest fix for me would be to add ifneq ($(OS_TARGET),Android) around that, but it's possible that this breaks other non-Android configs too.

so includes which sets CC and includes which includes which sets GCC_VERSION...

i'm thinking the whole ifndef NSS_DISABLE_AVX2 block should be moved from to a different file that is read after include coreconf/$(OS_TARGET).mk, but i'm not sure where to move it to.

thanks; i've added a work-around on our side for now in

but i guess this could break non-Android Linuxes as well, at least in theory, so a proper fix would be better...

Danh, do you have a suggestion as to the best way to repair this without breaking your fix from Bug 1646594? Any chance you could give us a revised patch?

Flags: needinfo?(congdanhqx)

I think: "include" in is fundamentally broken (because BSD people may also need avx2?).
(yes, the broken code written by me)

I think:

  • we should remove that broken: "include"
  • In the "ifndef NSS_DISABLE_AVX2" in "coreconf/", remove "NSS_DISABLE_AVX2 = 1", so if "coreconf/" is being visited multiple time can run into this block, (I'm not sure if this is the case).
  • Modify lib/freebl/Makefile to set NSS_DISABLE_AVX2 if not defined, I'm not really sure what older (and other) make would do if a variable was set to 0, if those make implementation doesn't unset it, we should be fine with flip those variables.

I write this without building, just some foods for thought.
I can try with build and test this weekend, though.

Flags: needinfo?(congdanhqx)

Danh, were you able to test the patch you suggested?

Flags: needinfo?(congdanhqx)
Attached patch avx2-new.patchSplinter Review
Flags: needinfo?(congdanhqx)

That approach doesn't work, since we have a guard to not include an "*.mk" file twice.
Working through it, I think putting that code in "" is broken.

I propose moving that block into "" instead.

Attach here is a patch.
I'll go away for my vacation for 5 days so please bear with me that I'm late to response to any feedback.

Current code base use CPU_ARCH to detect if avx2 is supported in
However, when included, CPU_ARCH haven't been initialised, CPU_ARCH
will be initialised by the OS specific code later on.

Move the AVX2 detection to, after all other initialisation done.

Attachment #9172558 - Flags: review?(kjacobs.bugzilla)
Assignee: nobody → congdanhqx
Severity: -- → S3
Priority: -- → P2
Attachment #9172558 - Attachment description: nss: Makefile: move avx2 detection to → Bug 1659727 - Move makefile avx2 detection to
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.57
Attachment #9172558 - Flags: review?(kjacobs.bugzilla)
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.