-
Notifications
You must be signed in to change notification settings - Fork 1.2k
WASM Xplat: Linux #1727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WASM Xplat: Linux #1727
Conversation
Enabling Webassembly to build with Linux
53397b4
to
de4503e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any place, this module is part of resulting binary. Is that intended?
@Cellule @MikeHolman please review. |
mbstowcs_s(&convertedChars, buf, idSize + 1, sectionName, _TRUNCATE); | ||
buf[idSize] = 0; | ||
TRACE_WASM_SECTION(_u("Section Header: %s, length = %u (0x%x)"), buf, sectionSize, sectionSize); | ||
TRACE_WASM_SECTION(_u("Section Header: %s, length = %u (0x%x)"), sectionName, sectionSize, sectionSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sectionName
is a char*
does it work in with a printf function using a char16 format string ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if %S
will work here to print char
string. If that doesn't, try use utf8::NarrowToWide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had changed sectionName to wchar_t to avoid the use of mbstowcs_s in linux to get around a method not defined error. Will change this back to char16* and look for another workaround to make it compile in xplat.
@@ -27,8 +27,8 @@ namespace Wasm | |||
{ | |||
SectionFlag flag; | |||
SectionCode precedent; | |||
char16* name; | |||
char* id; | |||
const wchar_t* name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the point of char16
was for cross plat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will change this back. The use of "mbstowcs_s" was giving pain in Linux, will look for a workaround.
@dotnet-bot test linux tests please |
@obastemur I'm sorry for my ignorance, but what does it mean for a module to be part of the resulting binary or not? |
@@ -0,0 +1,20 @@ | |||
add_library (Chakra.WasmReader OBJECT | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: unneeded extra blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove.
#define LAYOUT_TYPE_WMS_REG2(layout, t0, t1) \ | ||
template <typename SizePolicy> struct OpLayoutT_##layout\ | ||
{\ | ||
t0##LayoutType LAYOUT_PREFIX_##t0()0;\ | ||
t1##LayoutType LAYOUT_PREFIX_##t1()1;\ | ||
t0##LayoutType LAYOUT_FIELDS_DEF(LAYOUT_PREFIX_##t0(), 0);\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LAYOUT_FIELDS_DEF(LAYOUT_PREFIX_##t0(), 0);\ [](start = 23, length = 44)
Is this to have ()
in a field name (weird, why do we want that)? From the change I assume directly ##0
doesn't work, right? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
() is part of the macro name and it is not going to be part of the actual field name. The tricky part was to have the number to be appended to the end of the filed name to avoid naming conflicts.
##0 does not work as ## expects strings as operands.
The new Chakra.WasmReader lib is not linked to anything. Kind of related to my other question -- is it enabled on Linux? Suppose it would link to ch and Jsrt.lib? |
@obastemur, @jianchun Forgive my ignorance, I missed the step to link Cahkra.WasmReader lib for Linux. Will make this change and update the PR. |
@arunetm We don't need to enable WebAssembly on Linux right now. I don't see the harm, but regardless it is intended to be enable only in debug and test builds at the moment since it is still a WIP |
@Cellule I think it is useful to have on Linux, if for no other reason than to be able to fuzz with AFL. |
@MikeHolman Yes I believe it would be good to have, but what I am wondering is, does it have to be a blocker to merge WebAssembly to master ? |
Any update on this ? |
@Cellule Currently fixing a linker error and looking for a workaround for mbstowcs_s. |
The linker fails to find WasmLibrary::WasmDeferredParseExternalThunk defined in Language/amd64/amd64_Thunks.asm (called from Library/WasmLibrary.cpp). CMakeLists.txt includes only Language/amd64/amd64_Thunks.S and we don't have the WasmDeferredParseExternalThunk defined in it (hence this issue) @jianchun. This is a long shot question but, is it possible to allow CMake to recognize the .asm format and include Language/amd64/amd64_Thunks.asm for the build? @Cellule Is there a reason why we have WasmDeferredParseExternalThunk defined in Languages/amd64/amd64_Thunks.asm instead of Library/amd64/JavaScriptFunction.asm since its being called from Library/WasmLibrary.cpp only? Should we move it? |
@arunetm WasmDeferredParseExternalThunk needs to be rewritten in amd64_Thunks.S. You can see that by comparing amd64_Thunks.asm and amd64_Thunks.S. |
@Cellule @MikeHolman. I'm starting to rewrite the WasmDeferredParseExternalThunk inside amd64_Thunks.S (or any other possible missing pieces) to make it available for xplat builds. Is this path beneficial to do this at this point or should we disable WebAssembly in Linux in preparation to the master integration? |
@arunetm I think it's beneficial to do, but for the merge to master let's just disable on x-plat. |
Enabling Webassembly to build with Linux