Backed out changeset 9bada5ab20d7 (bug 1695285) for causing Linux asan bustages.

CLOSED TREE
This commit is contained in:
Alexandru Michis 2021-03-10 07:55:32 +02:00
parent 4a7c55c8ad
commit e18957315d

View File

@ -118,17 +118,11 @@ ifdef MOZ_USING_SCCACHE
export RUSTC_WRAPPER=$(CCACHE)
endif
ifdef MOZ_TSAN
ifneq (,$(MOZ_ASAN)$(MOZ_TSAN)$(MOZ_UBSAN))
ifndef CROSS_COMPILE
NATIVE_TSAN=1
NATIVE_SANITIZERS=1
endif # CROSS_COMPILE
endif # MOZ_TSAN
ifeq (WINNT,$(HOST_OS_ARCH))
ifdef MOZ_CODE_COVERAGE
WIN_CODE_COVERAGE=1
endif # MOZ_CODE_COVERAGE
endif # WINNT
endif
# We start with host variables because the rust host and the rust target might be the same,
# in which case we want the latter to take priority.
@ -160,7 +154,7 @@ CC_BASE_FLAGS += -DUNICODE
CXX_BASE_FLAGS += -DUNICODE
endif
ifeq (,$(NATIVE_TSAN)$(WIN_CODE_COVERAGE))
ifeq (,$(NATIVE_SANITIZERS)$(MOZ_CODE_COVERAGE))
# -DMOZILLA_CONFIG_H is added to prevent mozilla-config.h from injecting anything
# in C/C++ compiles from rust. That's not needed in the other branch because the
# base flags don't force-include mozilla-config.h.
@ -173,8 +167,8 @@ else
# scripts/procedural macros vs. those happening for the rust target,
# we can't blindly pass all our flags down for cc-rs to use them, because of the
# side effects they can have on what otherwise should be host builds.
# So for thread-sanitizer and coverage builds, we only pass the base compiler flags.
# This means C code built by rust is not going to be covered by thread-sanitizer
# So for sanitizer and coverage builds, we only pass the base compiler flags.
# This means C code built by rust is not going to be covered by sanitizer
# and coverage. But at least we control what compiler is being used,
# rather than relying on cc-rs guesses, which, sometimes fail us.
export CFLAGS_$(rust_host_cc_env_name)=$(HOST_CC_BASE_FLAGS)
@ -314,12 +308,12 @@ export $(cargo_linker_env_var):=$(topsrcdir)/build/cargo-linker
WRAP_HOST_LINKER_LIBPATHS:=$(HOST_LINKER_LIBPATHS)
endif
# Defining all of this for TSan builds results in crashes while running
# Defining all of this for ASan/TSan builds results in crashes while running
# some crates's build scripts (!), so disable it for now.
# See https://github.com/rust-lang/cargo/issues/5754
ifndef NATIVE_TSAN
ifndef NATIVE_SANITIZERS
$(TARGET_RECIPES): MOZ_CARGO_WRAP_LDFLAGS:=$(filter-out -fsanitize=cfi% -framework Cocoa -lobjc AudioToolbox ExceptionHandling -fprofile-%,$(LDFLAGS))
endif # NATIVE_TSAN
endif # NATIVE_SANITIZERS
$(HOST_RECIPES): MOZ_CARGO_WRAP_LDFLAGS:=$(HOST_LDFLAGS) $(WRAP_HOST_LINKER_LIBPATHS)
$(TARGET_RECIPES) $(HOST_RECIPES): MOZ_CARGO_WRAP_HOST_LDFLAGS:=$(HOST_LDFLAGS) $(WRAP_HOST_LINKER_LIBPATHS)