diff --git a/src/Makefile b/src/Makefile index 4f8b496cf84a00..f13f7f2005b4c5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -289,7 +289,7 @@ $(BUILDDIR)/builtins.o $(BUILDDIR)/builtins.dbg.obj: $(SRCDIR)/iddict.c $(SRCDIR $(BUILDDIR)/codegen.o $(BUILDDIR)/codegen.dbg.obj: $(addprefix $(SRCDIR)/,\ intrinsics.cpp jitlayers.h debug-registry.h intrinsics.h codegen_shared.h cgutils.cpp ccall.cpp abi_*.cpp processor.h builtin_proto.h) $(BUILDDIR)/debuginfo.o $(BUILDDIR)/debuginfo.dbg.obj: $(addprefix $(SRCDIR)/,debuginfo.h processor.h jitlayers.h debug-registry.h) -$(BUILDDIR)/disasm.o $(BUILDDIR)/disasm.dbg.obj: $(SRCDIR)/debuginfo.h $(SRCDIR)/processor.h +$(BUILDDIR)/disasm.o $(BUILDDIR)/disasm.dbg.obj: $(SRCDIR)/debuginfo.h $(SRCDIR)/processor.h $(SRCDIR)/jitlayers.h $(BUILDDIR)/dump.o $(BUILDDIR)/dump.dbg.obj: $(addprefix $(SRCDIR)/,common_symbols1.inc common_symbols2.inc builtin_proto.h serialize.h) $(BUILDDIR)/gc-debug.o $(BUILDDIR)/gc-debug.dbg.obj: $(SRCDIR)/gc.h $(BUILDDIR)/gc-pages.o $(BUILDDIR)/gc-pages.dbg.obj: $(SRCDIR)/gc.h diff --git a/src/jitlayers.h b/src/jitlayers.h index 8ec9ccbb9f6f04..5191eb99cb697f 100644 --- a/src/jitlayers.h +++ b/src/jitlayers.h @@ -20,6 +20,7 @@ #include #include "julia_assert.h" #include "debug-registry.h" +#include "platform.h" #include #include @@ -40,7 +41,10 @@ // and feature support (e.g. Windows, JITEventListeners for various profilers, // etc.). Thus, we currently only use JITLink where absolutely required, that is, // for Mac/aarch64. -#if defined(_OS_DARWIN_) && defined(_CPU_AARCH64_) + +#define JL_USE_NEW_PM + +#if defined(_OS_DARWIN_) && defined(_CPU_AARCH64_) || defined(_COMPILER_ASAN_ENABLED_) && defined(JL_USE_NEW_PM) && defined(_OS_LINUX_) # if JL_LLVM_VERSION < 130000 # pragma message("On aarch64-darwin, LLVM version >= 13 is required for JITLink; fallback suffers from occasional segfaults") # endif @@ -136,7 +140,6 @@ struct AnalysisManagers { OptimizationLevel getOptLevel(int optlevel); -#define JL_USE_NEW_PM typedef struct _jl_llvm_functions_t { std::string functionObject; // jlcall llvm Function name diff --git a/src/pipeline.cpp b/src/pipeline.cpp index 377773a57b8c56..3960981bf1404f 100644 --- a/src/pipeline.cpp +++ b/src/pipeline.cpp @@ -96,19 +96,17 @@ namespace { #ifdef _COMPILER_MSAN_ENABLED_ auto MSanPass = [&](/*SanitizerMask Mask, */bool CompileKernel) { - // if (LangOpts.Sanitize.has(Mask)) { + // if (LangOpts.Sanitize.has(Mask)) { // int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins; // bool Recover = CodeGenOpts.SanitizeRecover.has(Mask); // MemorySanitizerOptions options(TrackOrigins, Recover, CompileKernel, - // CodeGenOpts.SanitizeMemoryParamRetval); - MemorySanitizerOptions options{}; - #if JL_LLVM_VERSION >= 140000 + // CodeGenOpts.SanitizeMemoryParamRetval); + MemorySanitizerOptions options; MPM.addPass(ModuleMemorySanitizerPass(options)); - #endif FunctionPassManager FPM; FPM.addPass(MemorySanitizerPass(options)); - if (O.getSpeedupLevel() != 0) { + if (O != OptimizationLevel::O0) { // MemorySanitizer inserts complex instrumentation that mostly // follows the logic of the original code, but operates on // "shadow" values. It can benefit from re-running some @@ -121,7 +119,7 @@ namespace { // compiler-rt/test/msan/select_origin.cpp. } MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM))); - // } + // } }; MSanPass(/*SanitizerKind::Memory, */false); // MSanPass(SanitizerKind::KernelMemory, true); @@ -129,9 +127,7 @@ namespace { #ifdef _COMPILER_TSAN_ENABLED_ // if (LangOpts.Sanitize.has(SanitizerKind::Thread)) { - #if JL_LLVM_VERSION >= 140000 MPM.addPass(ModuleThreadSanitizerPass()); - #endif MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass())); // } #endif @@ -152,8 +148,8 @@ namespace { MPM.addPass(RequireAnalysisPass()); // MPM.addPass(ModuleAddressSanitizerPass( // Opts, UseGlobalGC, UseOdrIndicator, DestructorKind)); - MPM.addPass(ModuleAddressSanitizerPass()); - MPM.addPass(createModuleToFunctionPassAdaptor(AddressSanitizerPass())); + //Let's assume the defaults are actually fine for our purposes + MPM.addPass(ModuleAddressSanitizerPass(AddressSanitizerOptions())); // } }; ASanPass(/*SanitizerKind::Address, */false);