mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 09:54:42 +00:00
Bug 1749856 - Use GeneratedFile for rlbox.wasm.c. r=firefox-build-system-reviewers,andi
This moves the creation of both rlbox.wasm.c and rlbox.wasm.h to pre-compile, which allows static-analysis to create both files (but more importantly the .h) without also compiling rlbox.wasm.c, which takes forever. Differential Revision: https://phabricator.services.mozilla.com/D180173
This commit is contained in:
parent
82e604410a
commit
6cfdfb5db2
@ -179,7 +179,7 @@ endif
|
|||||||
|
|
||||||
ifdef ENABLE_CLANG_PLUGIN
|
ifdef ENABLE_CLANG_PLUGIN
|
||||||
# Only target rules use the clang plugin.
|
# Only target rules use the clang plugin.
|
||||||
$(filter %/target %/target-objects,$(filter-out config/export config/host build/unix/stdc++compat/% build/clang-plugin/%,$(compile_targets))): build/clang-plugin/host build/clang-plugin/tests/target-objects
|
$(filter %/target %/target-objects,$(filter-out config/export config/host build/unix/stdc++compat/% build/clang-plugin/%,$(compile_targets))) security/rlbox/pre-compile: build/clang-plugin/host build/clang-plugin/tests/target-objects
|
||||||
build/clang-plugin/tests/target-objects: build/clang-plugin/host
|
build/clang-plugin/tests/target-objects: build/clang-plugin/host
|
||||||
# clang-plugin tests require js-confdefs.h on js standalone builds and mozilla-config.h on
|
# clang-plugin tests require js-confdefs.h on js standalone builds and mozilla-config.h on
|
||||||
# other builds, because they are -include'd.
|
# other builds, because they are -include'd.
|
||||||
@ -210,9 +210,8 @@ endif
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef MOZ_USING_WASM_SANDBOXING
|
ifdef MOZ_USING_WASM_SANDBOXING
|
||||||
security/rlbox/target-objects: config/external/wasm2c_sandbox_compiler/host
|
security/rlbox/pre-compile: config/external/wasm2c_sandbox_compiler/host
|
||||||
security/rlbox/target: security/rlbox/target-objects
|
dom/media/ogg/target-objects extensions/spellcheck/hunspell/glue/target-objects gfx/thebes/target-objects parser/expat/target-objects parser/htmlparser/target-objects gfx/ots/src/target-objects: security/rlbox/pre-compile
|
||||||
dom/media/ogg/target-objects extensions/spellcheck/hunspell/glue/target-objects gfx/thebes/target-objects parser/expat/target-objects parser/htmlparser/target-objects gfx/ots/src/target-objects: security/rlbox/target-objects
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Most things are built during compile (target/host), but some things happen during export
|
# Most things are built during compile (target/host), but some things happen during export
|
||||||
|
@ -501,9 +501,6 @@ $(WASM_ARCHIVE): $(CWASMOBJS) $(CPPWASMOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOB
|
|||||||
$(RM) $(WASM_ARCHIVE)
|
$(RM) $(WASM_ARCHIVE)
|
||||||
$(WASM_CXX) -o $@ -Wl,--export-all -Wl,--stack-first -Wl,-z,stack-size=$(if $(MOZ_OPTIMIZE),262144,1048576) -Wl,--no-entry -Wl,--growable-table -Wl,--import-memory -Wl,--import-table $(CWASMOBJS) $(CPPWASMOBJS) -lwasi-emulated-process-clocks
|
$(WASM_CXX) -o $@ -Wl,--export-all -Wl,--stack-first -Wl,-z,stack-size=$(if $(MOZ_OPTIMIZE),262144,1048576) -Wl,--no-entry -Wl,--growable-table -Wl,--import-memory -Wl,--import-table $(CWASMOBJS) $(CPPWASMOBJS) -lwasi-emulated-process-clocks
|
||||||
|
|
||||||
$(addsuffix .c,$(WASM_ARCHIVE)): $(WASM_ARCHIVE) $(DIST)/host/bin/wasm2c$(HOST_BIN_SUFFIX)
|
|
||||||
$(DIST)/host/bin/wasm2c$(HOST_BIN_SUFFIX) -o $@ --disable-simd $<
|
|
||||||
|
|
||||||
ifeq ($(OS_ARCH),WINNT)
|
ifeq ($(OS_ARCH),WINNT)
|
||||||
# Import libraries are created by the rules creating shared libraries.
|
# Import libraries are created by the rules creating shared libraries.
|
||||||
# The rules to copy them to $(DIST)/lib depend on $(IMPORT_LIBRARY),
|
# The rules to copy them to $(DIST)/lib depend on $(IMPORT_LIBRARY),
|
||||||
|
12
config/wasm2c.py
Normal file
12
config/wasm2c.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
def wasm2c(output, wasm2c_bin, wasm_lib):
|
||||||
|
output.close()
|
||||||
|
return subprocess.run(
|
||||||
|
[wasm2c_bin, "-o", output.name, "--disable-simd", wasm_lib]
|
||||||
|
).returncode
|
@ -623,7 +623,6 @@ class RecursiveMakeBackend(MakeBackend):
|
|||||||
|
|
||||||
elif isinstance(obj, SandboxedWasmLibrary):
|
elif isinstance(obj, SandboxedWasmLibrary):
|
||||||
self._process_sandboxed_wasm_library(obj, backend_file)
|
self._process_sandboxed_wasm_library(obj, backend_file)
|
||||||
self._no_skip["syms"].add(backend_file.relobjdir)
|
|
||||||
|
|
||||||
elif isinstance(obj, HostLibrary):
|
elif isinstance(obj, HostLibrary):
|
||||||
self._process_linked_libraries(obj, backend_file)
|
self._process_linked_libraries(obj, backend_file)
|
||||||
|
@ -89,3 +89,12 @@ if CONFIG["MOZ_WASM_SANDBOXING_WOFF2"]:
|
|||||||
include("/modules/woff2/sources.mozbuild")
|
include("/modules/woff2/sources.mozbuild")
|
||||||
WASM_SOURCES += ["/modules/woff2/" + s for s in woff2_sources]
|
WASM_SOURCES += ["/modules/woff2/" + s for s in woff2_sources]
|
||||||
LOCAL_INCLUDES += ["/modules/woff2/include"]
|
LOCAL_INCLUDES += ["/modules/woff2/include"]
|
||||||
|
|
||||||
|
# Ideally we'd also list rlbox.wasm.h as an output, but that would put the
|
||||||
|
# generation in export rather than pre-compile, and we prefer the latter.
|
||||||
|
GeneratedFile(
|
||||||
|
"rlbox.wasm.c",
|
||||||
|
script="/config/wasm2c.py",
|
||||||
|
entry_point="wasm2c",
|
||||||
|
inputs=["!/dist/host/bin/wasm2c" + CONFIG["HOST_BIN_SUFFIX"], "!rlbox.wasm"],
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user