mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
restored SANITIZE make option (#3043)
* restored basic support for SANITIZE make option * disabled some unwanted UBSAN checks / enabled nullability checks / enabled ASAN use-after-scope checks (nw)
This commit is contained in:
parent
b8632487b8
commit
35e5a75243
6
makefile
6
makefile
@ -40,7 +40,7 @@
|
||||
|
||||
# DEBUG = 1
|
||||
# PROFILER = 1
|
||||
# SANITIZE = 1
|
||||
# SANITIZE =
|
||||
|
||||
# PTR64 = 1
|
||||
# BIGENDIAN = 1
|
||||
@ -781,6 +781,10 @@ endif
|
||||
ifdef WEBASSEMBLY
|
||||
PARAMS += --WEBASSEMBLY='$(WEBASSEMBLY)'
|
||||
endif
|
||||
|
||||
ifdef SANITIZE
|
||||
PARAMS += --SANITIZE='$(SANITIZE)'
|
||||
endif
|
||||
#-------------------------------------------------
|
||||
# All scripts
|
||||
#-------------------------------------------------
|
||||
|
@ -386,6 +386,11 @@ newoption {
|
||||
description = "Produce WebAssembly output when building with Emscripten.",
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "SANITIZE",
|
||||
description = "Specifies the santizer(s) to use."
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "PROJECT",
|
||||
description = "Select projects to be built. Will look into project folder for files.",
|
||||
@ -950,14 +955,42 @@ end
|
||||
buildoptions_cpp {
|
||||
"-Woverloaded-virtual",
|
||||
}
|
||||
|
||||
--ifdef SANITIZE
|
||||
--CCOMFLAGS += -fsanitize=$(SANITIZE)
|
||||
|
||||
if _OPTIONS["SANITIZE"] then
|
||||
buildoptions {
|
||||
"-fsanitize=".. _OPTIONS["SANITIZE"]
|
||||
}
|
||||
linkoptions {
|
||||
"-fsanitize=".. _OPTIONS["SANITIZE"]
|
||||
}
|
||||
if string.find(_OPTIONS["SANITIZE"], "address") then
|
||||
buildoptions {
|
||||
"-fsanitize-address-use-after-scope"
|
||||
}
|
||||
linkoptions {
|
||||
"-fsanitize-address-use-after-scope"
|
||||
}
|
||||
end
|
||||
if string.find(_OPTIONS["SANITIZE"], "undefined") then
|
||||
-- 'function' produces errors without delegates by design
|
||||
-- 'alignment' produces a lot of errors which we are not interested in
|
||||
-- 'nullability' errors are not actually undefined behavior but unintentional
|
||||
buildoptions {
|
||||
"-fno-sanitize=function",
|
||||
"-fno-sanitize=alignment",
|
||||
"-fsanitize=nullability"
|
||||
}
|
||||
linkoptions {
|
||||
"-fno-sanitize=function",
|
||||
"-fno-sanitize=alignment",
|
||||
"-fsanitize=nullability"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
--ifneq (,$(findstring thread,$(SANITIZE)))
|
||||
--CCOMFLAGS += -fPIE
|
||||
--endif
|
||||
--endif
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user