Closed Bug 1604740 Opened 7 months ago Closed 6 months ago

js/src/zydis/Zycore/Defines.h:188:48: error: expected constructor, destructor, or type conversion before ‘(’ token

Categories

(Core :: Javascript: WebAssembly, defect, P3)

x86_64
Other
defect

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: petr.sumbera, Assigned: lth)

Details

Attachments

(2 files, 2 obsolete files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0

Steps to reproduce:

While building on Solaris Intel I got using gcc 9.2:

0:06.65 js/src/jit
0:06.71 Blocking waiting for file lock on package cache
0:06.77 In file included from /builds/psumbera/FIREFOX-2/js/src/zydis/Zydis/Zydis.h:35,
0:06.77 from /builds/psumbera/FIREFOX-2/js/src/zydis/ZydisAPI.h:25,
0:06.77 from /builds/psumbera/FIREFOX-2/js/src/zydis/ZydisAPI.cpp:33:
0:06.77 /builds/psumbera/FIREFOX-2/js/src/zydis/Zycore/Defines.h:188:48: error: expected constructor, destructor, or type conversion before ‘(’ token
0:06.77 188 | # define ZYAN_STATIC_ASSERT(x) _Static_assert(x, #x)
0:06.77 | ^
0:06.77 /builds/psumbera/FIREFOX-2/js/src/zydis/Zycore/Types.h:98:1: note: in expansion of macro ‘ZYAN_STATIC_ASSERT’
0:06.77 98 | ZYAN_STATIC_ASSERT(sizeof(ZyanU8 ) == 1 );
0:06.77 | ^~~~~~~~~~~~~~~~~~
0:06.77 /builds/psumbera/FIREFOX-2/js/src/zydis/Zycore/Defines.h:188:48: error: expected constructor, destructor, or type conversion before ‘(’ token
0:06.77 188 | # define ZYAN_STATIC_ASSERT(x) _Static_assert(x, #x)
0:06.78 | ^

Component: Untriaged → Javascript: WebAssembly
Product: Firefox → Core
Summary: FIREFOX-2/js/src/zydis/Zycore/Defines.h:188:48: error: expected constructor, destructor, or type conversion before ‘(’ token → js/src/zydis/Zycore/Defines.h:188:48: error: expected constructor, destructor, or type conversion before ‘(’ token

This looks like a build issue in Zydis, which is an external dependency. Could you test out the upstream repository [1] to see if it also has this issue? And if so, file an issue to have it fixed upstream?

[1] https://github.com/zyantific/zydis/

Flags: needinfo?(petr.sumbera)
Priority: -- → P3

To elaborate on that, the Zydis people have been very receptive to fixes in the past, and we have set things up in Firefox so that we can reintegrate from upstream fairly easily, see js/src/zydis/README.md. So if you find a way to get past this I encourage you to upstream the patch and then ping us to reintegrate Zydis from upstream.

Also, gcc 9 is not currently supported (this is bug 1514781), and 9.2 might be very bleeding edge.

You should also be able to work around this particular problem by configuring with --disable-jitspew, as that disables Zydis.

I have submitted some pull requests to upstream:
https://github.com/zyantific/zycore-c/pull/17
https://github.com/zyantific/zydis/pull/127
With these I'm able to build Zydis (even with GCC 9.2).

When building Fierefox it uses:

/builds/psumbera/FIREFOX-2/obj-x86_64-pc-solaris2.11/js/src/zydis: /usr/gcc/9/bin/g++ -std=gnu++17 -o ZydisAPI.o -c  -I/builds/psumbera/FIREFOX-2/obj-x86_64-pc-solaris2.11/dist/system_wrappers -include /builds/psumbera/FIREFOX-2/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DDEBUG=1 -DWASM_SUPPORTS_HUGE_MEMORY -DJS_CACHEIR_SPEW -DJS_STRUCTURED_SPEW -DJS_HAS_CTYPES -DFFI_BUILDING -DEXPORT_JS_API -DMOZ_HAS_MOZGLUE -I/builds/psumbera/FIREFOX-2/js/src/zydis -I/builds/psumbera/FIREFOX-2/obj-x86_64-pc-solaris2.11/js/src/zydis -I/builds/psumbera/FIREFOX-2/obj-x86_64-pc-solaris2.11/js/src -I/builds/psumbera/FIREFOX-2/js/src -I/builds/psumbera/FIREFOX-2/obj-x86_64-pc-solaris2.11/dist/include -I/builds/psumbera/FIREFOX-2/obj-x86_64-pc-solaris2.11/dist/include/nspr -fPIC -DMOZILLA_CLIENT -include /builds/psumbera/FIREFOX-2/obj-x86_64-pc-solaris2.11/js/src/js-confdefs.h -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wduplicated-cond -Wimplicit-fallthrough -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object -Wno-error=multistatement-macros -Wno-error=class-memaccess -Wno-error=deprecated-copy -Wformat -Wformat-overflow=2 -Wno-noexcept-type -fno-sized-deallocation -fno-aligned-new -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -O -fno-omit-frame-pointer -funwind-tables -fno-strict-aliasing -Werror=format -Wno-shadow -Wno-attributes  -MD -MP -MF .deps/ZydisAPI.o.pp   /builds/psumbera/FIREFOX-2/js/src/zydis/ZydisAPI.cpp

When I remove -std=gnu++17 it just passes.

Flags: needinfo?(petr.sumbera)

Workaround might be:

--- a/js/src/zydis/Zycore/Defines.h     Mon Apr 29 14:42:18 2019 +0200
+++ b/js/src/zydis/Zycore/Defines.h     Mon Jan 06 15:06:40 2020 +0100
@@ -184,7 +187,7 @@
 /**
  * @brief   Compiler-time assertion.
  */
-#if __STDC_VERSION__ >= 201112L
+#if __STDC_VERSION__ >= 201112L && 0
 #   define ZYAN_STATIC_ASSERT(x) _Static_assert(x, #x)
 #else
 #   define ZYAN_STATIC_ASSERT(x) \
Assignee: nobody → lhansen
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
OS: Unspecified → Other
Hardware: Unspecified → x86_64

This pulls the Zydis working branch to get a compile fix for Solaris
that was upstreamed to Zydis by Oracle.

I ran the zydis/update.sh script, then 'hg add'ed three new files, and
ran a quick test - everything seems to work OK, wonders never cease.

A diff of new vs old code shows the Solaris fix is included.

This patch does not include the files in zydis/Zydis/Generated, as
they must land separately (moz-phab / arcanist problems).

These are the generated instruction tables as provided by the zydis distribution. They are too large for moz-phab, too large for arcanist, too large for bugzilla -- a general pain in the neck.

This pulls the Zydis working branch to get a compile fix for Solaris
that was upstreamed to Zydis by Oracle.

I ran the zydis/update.sh script, then 'hg add'ed four new files, and
ran a quick test - everything seems to work OK, wonders never cease.

A diff of new vs old code shows the Solaris fix is included.

The patch includes a change to update.sh that gets the pulled rev
from the git repo, not from the command line

Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
Attachment #9120403 - Attachment is obsolete: true
Attachment #9120453 - Attachment is obsolete: true

For some reason, when I do a debug build on Windows using MozillaBuild, I'm still seeing this issue.

If you're building on Windows, maybe the pertinent ifdeffery around the fix is different? See comment 6. I see that also introduced something for Windows but maybe it wasn't quite right.

You need to log in before you can comment on or make changes to this bug.