Bug 1726474 - Always use clang-type flags when targeting wasm. r=firefox-build-system-reviewers,mhentges

The build system assumes the target compiler is of the same type as the
wasm compiler, but that's not true for wasm32-wasi, which we compile
with clang, while targeting windows, which we compile with clang-cl.
We handle the duality for host/target in a compiler-specific way, but
here, the wasm compiler is always going to be clang.

Differential Revision: https://phabricator.services.mozilla.com/D123041
This commit is contained in:
Mike Hommey 2021-08-25 07:39:01 +00:00
parent 7e072d6610
commit b7bcda87f0
2 changed files with 9 additions and 3 deletions

View File

@ -501,7 +501,7 @@ $(LIBRARY): $(OBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(WASM_ARCHIVE): $(CWASMOBJS) $(CPPWASMOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(REPORT_BUILD_VERBOSE)
$(RM) $(WASM_ARCHIVE)
$(WASM_CXX) $(OUTOPTION)$@ -Wl,--export-all -Wl,--stack-first -Wl,-z,stack-size=$(if $(MOZ_OPTIMIZE),262144,1048576) -Wl,--no-entry -Wl,--growable-table $(CWASMOBJS) $(CPPWASMOBJS)
$(WASM_CXX) -o $@ -Wl,--export-all -Wl,--stack-first -Wl,-z,stack-size=$(if $(MOZ_OPTIMIZE),262144,1048576) -Wl,--no-entry -Wl,--growable-table $(CWASMOBJS) $(CPPWASMOBJS)
$(addsuffix .c,$(WASM_ARCHIVE)): $(WASM_ARCHIVE)
$(DIST)/host/bin/wasm2c -o $@ $<
@ -597,7 +597,7 @@ $(COBJS):
$(CWASMOBJS):
$(REPORT_BUILD_VERBOSE)
$(WASM_CC) $(OUTOPTION)$@ -c $(WASM_CFLAGS) $($(notdir $<)_FLAGS) $<
$(WASM_CC) -o $@ -c $(WASM_CFLAGS) $($(notdir $<)_FLAGS) $<
WINEWRAP = $(if $(and $(filter %.exe,$1),$(WINE)),$(WINE) $1,$1)
@ -677,7 +677,7 @@ $(CPPOBJS):
$(CPPWASMOBJS):
$(REPORT_BUILD_VERBOSE)
$(call BUILDSTATUS,OBJECT_FILE $@)
$(WASM_CXX) $(OUTOPTION)$@ -c $(WASM_CXXFLAGS) $($(notdir $<)_FLAGS) $<
$(WASM_CXX) -o $@ -c $(WASM_CXXFLAGS) $($(notdir $<)_FLAGS) $<
$(CMMOBJS):
$(REPORT_BUILD_VERBOSE)

View File

@ -757,6 +757,12 @@ class WasmFlags(TargetCompileFlags):
TargetCompileFlags.__init__(self, context)
def _debug_flags(self):
substs = self._context.config.substs
if substs.get("MOZ_DEBUG") or substs.get("MOZ_DEBUG_SYMBOLS"):
return ["-g"]
return []
def _optimize_flags(self):
if not self._context.config.substs.get("MOZ_OPTIMIZE"):
return []