diff options
author | robot-brewer <robot-brewer@yandex-team.com> | 2024-11-11 09:16:28 +0300 |
---|---|---|
committer | robot-brewer <robot-brewer@yandex-team.com> | 2024-11-11 09:32:08 +0300 |
commit | 27a5e2170c973f0df354c8a3c73bfd613f659036 (patch) | |
tree | 2241c64e06910a1ddfa5b4f5d524c502af4bc9d4 | |
parent | aa2573e03c0a4debad8edd5acab600ccaa29e896 (diff) | |
download | ydb-27a5e2170c973f0df354c8a3c73bfd613f659036.tar.gz |
Release clang18 #3
https://github.com/yandex/toolchain-registry/releases/tag/clang18-v3
commit_hash:242ab0166e0b3ae29fd381117df005246a4e4eb9
23 files changed, 2287 insertions, 36 deletions
diff --git a/build/conf/compilers/gnu_compiler.conf b/build/conf/compilers/gnu_compiler.conf index 4b29295a46..6bdf5ec21a 100644 --- a/build/conf/compilers/gnu_compiler.conf +++ b/build/conf/compilers/gnu_compiler.conf @@ -68,6 +68,16 @@ when ($CLANG16 == "yes") { CFLAGS+=-Wno-array-parameter -Wno-deprecate-lax-vec-conv-all -Wno-unqualified-std-cast-call -Wno-unused-but-set-parameter -Wno-implicit-function-declaration -Wno-int-conversion -Wno-incompatible-function-pointer-types -Wno-address-of-packed-member } +when ($CLANG18 == "yes") { + CFLAGS+=-Wno-array-parameter -Wno-deprecate-lax-vec-conv-all -Wno-unqualified-std-cast-call -Wno-unused-but-set-parameter -Wno-implicit-function-declaration -Wno-int-conversion -Wno-incompatible-function-pointer-types -Wno-address-of-packed-member + CFLAGS+=-Wno-deprecated-this-capture -Wno-c++11-narrowing-const-reference -Wno-missing-field-initializers \ + -Wno-packed-non-pod -Wno-format -Wno-vla-cxx-extension -Wno-invalid-offsetof -Wno-exceptions \ + -Wno-include-angled-in-module-purview -Wno-unused-parameter + when ($MAPSMOBI_BUILD_TARGET == "yes") { + CFLAGS+=-Wno-deprecated-declarations + } +} + when ($MSAN_TRACK_ORIGIN == "yes") { CFLAGS+=-fsanitize-memory-track-origins=2 } diff --git a/build/mapping.conf.json b/build/mapping.conf.json index b5686ff1c6..835a2ca988 100644 --- a/build/mapping.conf.json +++ b/build/mapping.conf.json @@ -142,6 +142,10 @@ "7421180051": "https://devtools-registry.s3.yandex.net/7421180051", "7421207790": "https://devtools-registry.s3.yandex.net/7421207790", "7421606584": "https://devtools-registry.s3.yandex.net/7421606584", + "7412448309": "https://devtools-registry.s3.yandex.net/7412448309", + "7412319411": "https://devtools-registry.s3.yandex.net/7412319411", + "7412751020": "https://devtools-registry.s3.yandex.net/7412751020", + "7412874863": "https://devtools-registry.s3.yandex.net/7412874863", "360916612": "https://devtools-registry.s3.yandex.net/360916612", "4312064267": "https://devtools-registry.s3.yandex.net/4312064267", "4312063561": "https://devtools-registry.s3.yandex.net/4312063561", @@ -886,6 +890,9 @@ "7193803465": "https://devtools-registry.s3.yandex.net/7193803465", "7324464594": "https://devtools-registry.s3.yandex.net/7324464594", "7414146467": "https://devtools-registry.s3.yandex.net/7414146467", + "7406675906": "https://devtools-registry.s3.yandex.net/7406675906", + "7406663741": "https://devtools-registry.s3.yandex.net/7406663741", + "7406665335": "https://devtools-registry.s3.yandex.net/7406665335", "7193800506": "https://devtools-registry.s3.yandex.net/7193800506", "7324461714": "https://devtools-registry.s3.yandex.net/7324461714", "7193813071": "https://devtools-registry.s3.yandex.net/7193813071", @@ -992,6 +999,11 @@ "7336031045": "https://devtools-registry.s3.yandex.net/7336031045", "7320257970": "https://devtools-registry.s3.yandex.net/7320257970", "7336062757": "https://devtools-registry.s3.yandex.net/7336062757", + "7406874438": "https://devtools-registry.s3.yandex.net/7406874438", + "7407124272": "https://devtools-registry.s3.yandex.net/7407124272", + "7406983705": "https://devtools-registry.s3.yandex.net/7406983705", + "7407028815": "https://devtools-registry.s3.yandex.net/7407028815", + "7407150115": "https://devtools-registry.s3.yandex.net/7407150115", "6048579718": "https://devtools-registry.s3.yandex.net/6048579718", "2980468199": "https://devtools-registry.s3.yandex.net/2980468199", "5562224408": "https://devtools-registry.s3.yandex.net/5562224408" @@ -1138,6 +1150,10 @@ "7421180051": "bin-mold-darwin-x86_64-9ed8f351aa52a09a3d6ab1d977afb583bf69d8d5", "7421207790": "bin-mold-linux-aarch64-9ed8f351aa52a09a3d6ab1d977afb583bf69d8d5", "7421606584": "bin-mold-linux-x86_64-9ed8f351aa52a09a3d6ab1d977afb583bf69d8d5", + "7412448309": "bin-lld-18-darwin-arm64-9ed8f351aa52a09a3d6ab1d977afb583bf69d8d5", + "7412319411": "bin-lld-18-darwin-x86_64-9ed8f351aa52a09a3d6ab1d977afb583bf69d8d5", + "7412751020": "bin-lld-18-linux-aarch64-9ed8f351aa52a09a3d6ab1d977afb583bf69d8d5", + "7412874863": "bin-lld-18-linux-x86_64-9ed8f351aa52a09a3d6ab1d977afb583bf69d8d5", "360916612": "binutils 2.26 for linux_ubuntu_10.04_lucid", "4312064267": "black_linter for linux", "4312063561": "black_linter for linux-aarch64", @@ -1882,6 +1898,9 @@ "7193803465": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/17df2ad2-24bc-49e8-8909-b58685dac393/yfm-docs.tar", "7324464594": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/32cc8c74-decd-44a8-bc8c-f8f0d7edfffe/yfm-docs.tar", "7414146467": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/66167d72-07fa-444c-8493-dea0a39d034e/yfm-docs.tar", + "7406675906": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/6bba4fa0-ac5e-4a8a-89df-ce9e09573567/yfm-docs.tar", + "7406663741": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/6f3d31a2-e730-48d5-92b4-024148b5768a/yfm-docs.tar", + "7406665335": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/895e2cbd-d4a8-4a5c-9cf5-5666e796f17a/yfm-docs.tar", "7193800506": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/9be8ed55-d7f8-4029-a7fd-fbfa072b896f/yfm-docs.tar", "7324461714": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/b3543418-58d4-4e1c-b2be-43b55b035e91/yfm-docs.tar", "7193813071": "none-none-none-service_resources/TASKLET_EXECUTABLE/backup/b6531a79-b803-4672-a9e9-f9f348009f5f/yfm-docs.tar", @@ -1988,10 +2007,15 @@ "7336031045": "ynd-bin-frozen-python3-linux-x86_64-eacbfe8057414a218b407c837c9dcd8f2162f810", "7320257970": "ynd-bin-frozen-python3-mingw-w64-x86_64-e139f4d2038ecfbb34fbbd77f84c4b63ddcb613b", "7336062757": "ynd-bin-frozen-python3-mingw-w64-x86_64-eacbfe8057414a218b407c837c9dcd8f2162f810", + "7406874438": "ynd-clang-18-optimized-darwin-arm64-56872a411472c7ec2b09f2c8372ea4c67d069a5b", + "7407124272": "ynd-clang-18-optimized-darwin-x86_64-56872a411472c7ec2b09f2c8372ea4c67d069a5b", + "7406983705": "ynd-clang-18-optimized-linux-aarch64-56872a411472c7ec2b09f2c8372ea4c67d069a5b", + "7407028815": "ynd-clang-18-optimized-linux-x86_64-56872a411472c7ec2b09f2c8372ea4c67d069a5b", + "7407150115": "ynd-clang-18-optimized-mingw-w64-x86_64-56872a411472c7ec2b09f2c8372ea4c67d069a5b", "6048579718": "yt/go/ytrecipe/cmd/ytexec for linux", "2980468199": "ytexec for linux", "5562224408": "ytexec for linux" }, "resources_info": {}, "tasks": {} -}
\ No newline at end of file +} diff --git a/build/platform/clang/clang18.json b/build/platform/clang/clang18.json new file mode 100644 index 0000000000..3381614aa1 --- /dev/null +++ b/build/platform/clang/clang18.json @@ -0,0 +1,19 @@ +{ + "by_platform": { + "darwin-arm64": { + "uri": "sbr:7406874438" + }, + "darwin-x86_64": { + "uri": "sbr:7407124272" + }, + "linux-aarch64": { + "uri": "sbr:7406983705" + }, + "linux-x86_64": { + "uri": "sbr:7407028815" + }, + "win32-x86_64": { + "uri": "sbr:7407150115" + } + } +} diff --git a/build/platform/clang/ya.make b/build/platform/clang/ya.make index 64dfc5e686..ad51f7210f 100644 --- a/build/platform/clang/ya.make +++ b/build/platform/clang/ya.make @@ -2,6 +2,7 @@ RESOURCES_LIBRARY() DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(CLANG14 clang14.json) DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(CLANG16 clang16.json) +DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(CLANG18 clang18.json) # This is the default clang to be used in llvm-version-independent cases DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(CLANG clang14.json) diff --git a/build/platform/lld/lld16.json b/build/platform/lld/lld18.json index acae68da9d..8ac4f7068c 100644 --- a/build/platform/lld/lld16.json +++ b/build/platform/lld/lld18.json @@ -1,16 +1,16 @@ { "by_platform": { "darwin-arm64": { - "uri": "sbr:6782946027" + "uri": "sbr:7412448309" }, "darwin-x86_64": { - "uri": "sbr:6782783684" + "uri": "sbr:7412319411" }, "linux-aarch64": { - "uri": "sbr:6782721573" + "uri": "sbr:7412751020" }, "linux-x86_64": { - "uri": "sbr:6782718840" + "uri": "sbr:7412874863" } } } diff --git a/build/platform/lld/ya.make b/build/platform/lld/ya.make index 3b8902f650..0992bf58af 100644 --- a/build/platform/lld/ya.make +++ b/build/platform/lld/ya.make @@ -5,8 +5,13 @@ DEFAULT(LLD_VERSION ${CLANG_VER}) TOOLCHAIN(lld) VERSION(${LLD_VERSION}) -# lld16 is the only supported version at the time -DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(LLD_ROOT lld16.json) +# There is no backward compatibility between LLVM IR versions 16 and 18. +# So, we need to select lld18 when using clang18 to compile src in LTO mode. +IF (LLD_VERSION == 18) + DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(LLD_ROOT lld18.json) +ELSEIF (LLD_VERSION == 16) + DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(LLD_ROOT lld16.json) +ENDIF() IF (OS_ANDROID) # Use LLD shipped with Android NDK. diff --git a/build/scripts/copy_clang_profile_rt.py b/build/scripts/copy_clang_profile_rt.py index 84444b9dbf..ae2627324b 100644 --- a/build/scripts/copy_clang_profile_rt.py +++ b/build/scripts/copy_clang_profile_rt.py @@ -9,7 +9,7 @@ import process_command_files as pcf # List is a temporary thing to ensure that nothing breaks before and after switching to newer clang # Remove after DTCC-1902 -CLANG_RT_VERSIONS = [14, 16] +CLANG_RT_VERSIONS = [14, 16, 18] def copy_clang_rt_profile(cmd, build_root, arch): diff --git a/build/ya.conf.json b/build/ya.conf.json index 0a0836a7d2..2912aaa200 100644 --- a/build/ya.conf.json +++ b/build/ya.conf.json @@ -135,6 +135,55 @@ }, "formula": "build/platform/clang/clang16.json" }, + "clang18": { + "executable": { + "c++": [ + "bin", + "clang++" + ], + "c++filt": [ + "bin", + "llvm-cxxfilt" + ], + "cc": [ + "bin", + "clang" + ], + "clang-rename": [ + "bin", + "clang-rename" + ], + "llvm-cov": [ + "bin", + "llvm-cov" + ], + "llvm-gcov": [ + "bin", + "llvm-gcov" + ], + "llvm-nm": [ + "bin", + "llvm-nm" + ], + "llvm-objcopy": [ + "bin", + "llvm-objcopy" + ], + "llvm-profdata": [ + "bin", + "llvm-profdata" + ], + "llvm-strip": [ + "bin", + "llvm-strip" + ], + "llvm-symbolizer": [ + "bin", + "llvm-symbolizer" + ] + }, + "formula": "build/platform/clang/clang18.json" + }, "gdb": { "executable": { "gcore": [ @@ -463,6 +512,675 @@ }, "platforms": [ { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "x86_64", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "aarch64", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "arch": "aarch64", + "os": "LINUX" + }, + "target": { + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "arch": "aarch64", + "os": "LINUX" + }, + "target": { + "arch": "aarch64", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "ppc64le", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "power9le", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "x86_64", + "os": "DARWIN" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "arm64", + "os": "DARWIN" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "i386", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "x86_64", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "armv7", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "arm64", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "arm64", + "os": "IOSSIM" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "armv7a", + "os": "YOCTO" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "x86_64", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "aarch64", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "ppc64le", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "power9le", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "x86_64", + "os": "DARWIN" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "arm64", + "os": "DARWIN" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "i386", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "x86_64", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "armv7", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "arm64", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "arm64", + "os": "IOSSIM" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "x86_64", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "aarch64", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "ppc64le", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "power9le", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "x86_64", + "os": "DARWIN" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "arm64", + "os": "DARWIN" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "i386", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "x86_64", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "armv7", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "arm64", + "os": "IOS" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "arm64", + "os": "IOSSIM" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "armv7a", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "armv7a_cortex_a9", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "armv7ahf_cortex_a35", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "armv7ahf_cortex_a53", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "armv7ahf", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "armv8a_cortex_a35", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "armv8a_cortex_a53", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "arch": "ppc64le", + "os": "LINUX" + }, + "target": { + "arch": "ppc64le", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "arch": "ppc64le", + "os": "LINUX" + }, + "target": { + "arch": "power9le", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "DARWIN" + }, + "target": { + "arch": "armv7ahf_cortex_a53", + "os": "LINUX" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "wasm64", + "os": "EMSCRIPTEN" + } + }, + { + "default": false, + "host": { + "arch": "arm64", + "os": "DARWIN" + }, + "target": { + "arch": "armv7ahf_cortex_a53", + "os": "LINUX" + } + } + ], + "tools": { + "c++": { + "bottle": "clang16", + "executable": "c++" + }, + "c++filt": { + "bottle": "clang16", + "executable": "c++filt" + }, + "cc": { + "bottle": "clang16", + "executable": "cc" + }, + "clang-rename": { + "bottle": "clang16", + "executable": "clang-rename" + }, + "gcov": { + "bottle": "clang16", + "executable": "llvm-gcov" + }, + "llvm-cov": { + "bottle": "clang16", + "executable": "llvm-cov" + }, + "llvm-profdata": { + "bottle": "clang16", + "executable": "llvm-profdata" + }, + "llvm-symbolizer": { + "bottle": "clang16", + "executable": "llvm-symbolizer" + }, + "nm": { + "bottle": "clang16", + "executable": "llvm-nm" + }, + "objcopy": { + "bottle": "clang16", + "executable": "llvm-objcopy" + }, + "strip": { + "bottle": "clang16", + "executable": "llvm-strip" + } + } + }, + "clang16-windows": { + "name": "clang16", + "params": { + "c_compiler": "$(CLANG)/bin/clang-cl", + "cxx_compiler": "$(CLANG)/bin/clang-cl", + "cxx_std": "c++20", + "llvm-symbolizer": "$(CLANG)/bin/llvm-symbolizer", + "match_root": "CLANG", + "type": "msvc", + "use_bundle": true, + "use_clang": true, + "version": "2019", + "werror_mode": "all" + }, + "platforms": [ + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "x86_64", + "os": "WIN" + } + }, + { + "default": false, + "host": { + "os": "LINUX" + }, + "target": { + "arch": "i686", + "os": "WIN" + } + }, + { + "default": false, + "host": { + "os": "WIN" + }, + "target": { + "arch": "x86_64", + "os": "WIN" + } + }, + { + "default": false, + "host": { + "os": "WIN" + }, + "target": { + "arch": "i686", + "os": "WIN" + } + } + ], + "tools": { + "c++": { + "bottle": "clang16", + "executable": "c++" + }, + "c++filt": { + "bottle": "clang16", + "executable": "c++filt" + }, + "cc": { + "bottle": "clang16", + "executable": "cc" + }, + "gcov": { + "bottle": "clang16", + "executable": "llvm-gcov" + }, + "llvm-cov": { + "bottle": "clang16", + "executable": "llvm-cov" + }, + "llvm-profdata": { + "bottle": "clang16", + "executable": "llvm-profdata" + }, + "llvm-symbolizer": { + "bottle": "clang16", + "executable": "llvm-symbolizer" + }, + "nm": { + "bottle": "clang16", + "executable": "llvm-nm" + }, + "objcopy": { + "bottle": "clang16", + "executable": "llvm-objcopy" + }, + "strip": { + "bottle": "clang16", + "executable": "llvm-strip" + } + } + }, + "clang18": { + "env": { + "CPATH": [ + "" + ], + "LIBRARY_PATH": [ + "" + ], + "SDKROOT": [ + "" + ] + }, + "params": { + "c_compiler": "$(CLANG)/bin/clang", + "cxx_compiler": "$(CLANG)/bin/clang++", + "gcc_version": "18", + "llvm-symbolizer": "$(CLANG)/bin/llvm-symbolizer", + "match_root": "CLANG", + "objcopy": "$(CLANG)/bin/llvm-objcopy", + "profiles": "$(XCODE_TOOLS_ROOT-sbr:799017771)/Xcode/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles", + "simctl": "$(XCODE_TOOLS_ROOT-sbr:799017771)/Xcode/SystemRoot/PrivateFrameworks/CoreSimulator.framework/Resources/bin/simctl", + "strip": "$(CLANG)/bin/llvm-strip", + "type": "clang", + "use_bundle": true, + "werror_mode": "all" + }, + "platforms": [ + { "default": true, "host": { "os": "LINUX" @@ -970,53 +1688,53 @@ ], "tools": { "c++": { - "bottle": "clang16", + "bottle": "clang18", "executable": "c++" }, "c++filt": { - "bottle": "clang16", + "bottle": "clang18", "executable": "c++filt" }, "cc": { - "bottle": "clang16", + "bottle": "clang18", "executable": "cc" }, "clang-rename": { - "bottle": "clang16", + "bottle": "clang18", "executable": "clang-rename" }, "gcov": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-gcov" }, "llvm-cov": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-cov" }, "llvm-profdata": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-profdata" }, "llvm-symbolizer": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-symbolizer" }, "nm": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-nm" }, "objcopy": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-objcopy" }, "strip": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-strip" } } }, - "clang16-windows": { - "name": "clang16", + "clang18-windows": { + "name": "clang18", "params": { "c_compiler": "$(CLANG)/bin/clang-cl", "cxx_compiler": "$(CLANG)/bin/clang-cl", @@ -1073,43 +1791,43 @@ ], "tools": { "c++": { - "bottle": "clang16", + "bottle": "clang18", "executable": "c++" }, "c++filt": { - "bottle": "clang16", + "bottle": "clang18", "executable": "c++filt" }, "cc": { - "bottle": "clang16", + "bottle": "clang18", "executable": "cc" }, "gcov": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-gcov" }, "llvm-cov": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-cov" }, "llvm-profdata": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-profdata" }, "llvm-symbolizer": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-symbolizer" }, "nm": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-nm" }, "objcopy": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-objcopy" }, "strip": { - "bottle": "clang16", + "bottle": "clang18", "executable": "llvm-strip" } } diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 1970dab5cc..7b9c9acf89 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -75,6 +75,9 @@ CLANG_VER=14 when ($CLANG16 == "yes") { CLANG_VER=16 } +when ($CLANG18 == "yes") { + CLANG_VER=18 +} USE_ARCADIA_COMPILER_RUNTIME=yes @@ -4694,6 +4697,11 @@ macro USE_LLVM_BC16() { SET(LLVM_LLC_TOOL contrib/libs/llvm16/tools/llc) } +macro USE_LLVM_BC18() { + SET(CLANG_BC_ROOT ${CLANG18_RESOURCE_GLOBAL}) + SET(LLVM_LLC_TOOL contrib/libs/llvm18/tools/llc) +} + ### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...) ### ### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not. diff --git a/build/ymake_conf.py b/build/ymake_conf.py index 982dce80fc..40bc8cec59 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -2071,7 +2071,11 @@ class MSVCCompiler(MSVC, Compiler): '-fms-compatibility-version=19.21', # for msvc compatibility # https://clang.llvm.org/docs/UsersManual.html#microsoft-extensions - '-fdelayed-template-parsing', + # '-fdelayed-template-parsing', + '-Wno-deprecated-this-capture', + '-Wno-c++11-narrowing-const-reference', + '-Wno-vla-cxx-extension', # https://github.com/llvm/llvm-project/issues/62836 + '-Wno-invalid-offsetof', ] if target.is_x86: flags.append('-m32') diff --git a/contrib/libs/clang18-rt/include/sanitizer/asan_interface.h b/contrib/libs/clang18-rt/include/sanitizer/asan_interface.h new file mode 100644 index 0000000000..37b6d08f4d --- /dev/null +++ b/contrib/libs/clang18-rt/include/sanitizer/asan_interface.h @@ -0,0 +1,340 @@ +//===-- sanitizer/asan_interface.h ------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file is a part of AddressSanitizer (ASan). +// +// Public interface header. +//===----------------------------------------------------------------------===// +#ifndef SANITIZER_ASAN_INTERFACE_H +#define SANITIZER_ASAN_INTERFACE_H + +#include <sanitizer/common_interface_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif +/// Marks a memory region (<c>[addr, addr+size)</c>) as unaddressable. +/// +/// This memory must be previously allocated by your program. Instrumented +/// code is forbidden from accessing addresses in this region until it is +/// unpoisoned. This function is not guaranteed to poison the entire region - +/// it could poison only a subregion of <c>[addr, addr+size)</c> due to ASan +/// alignment restrictions. +/// +/// \note This function is not thread-safe because no two threads can poison or +/// unpoison memory in the same memory region simultaneously. +/// +/// \param addr Start of memory region. +/// \param size Size of memory region. +void SANITIZER_CDECL __asan_poison_memory_region(void const volatile *addr, + size_t size); + +/// Marks a memory region (<c>[addr, addr+size)</c>) as addressable. +/// +/// This memory must be previously allocated by your program. Accessing +/// addresses in this region is allowed until this region is poisoned again. +/// This function could unpoison a super-region of <c>[addr, addr+size)</c> due +/// to ASan alignment restrictions. +/// +/// \note This function is not thread-safe because no two threads can +/// poison or unpoison memory in the same memory region simultaneously. +/// +/// \param addr Start of memory region. +/// \param size Size of memory region. +void SANITIZER_CDECL __asan_unpoison_memory_region(void const volatile *addr, + size_t size); + +// Macros provided for convenience. +#ifdef __has_feature +#if __has_feature(address_sanitizer) +#define ASAN_DEFINE_REGION_MACROS +#endif +#elif defined(__SANITIZE_ADDRESS__) +#define ASAN_DEFINE_REGION_MACROS +#endif + +#ifdef ASAN_DEFINE_REGION_MACROS +/// Marks a memory region as unaddressable. +/// +/// \note Macro provided for convenience; defined as a no-op if ASan is not +/// enabled. +/// +/// \param addr Start of memory region. +/// \param size Size of memory region. +#define ASAN_POISON_MEMORY_REGION(addr, size) \ + __asan_poison_memory_region((addr), (size)) + +/// Marks a memory region as addressable. +/// +/// \note Macro provided for convenience; defined as a no-op if ASan is not +/// enabled. +/// +/// \param addr Start of memory region. +/// \param size Size of memory region. +#define ASAN_UNPOISON_MEMORY_REGION(addr, size) \ + __asan_unpoison_memory_region((addr), (size)) +#else +#define ASAN_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#define ASAN_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size)) +#endif +#undef ASAN_DEFINE_REGION_MACROS + +/// Checks if an address is poisoned. +/// +/// Returns 1 if <c><i>addr</i></c> is poisoned (that is, 1-byte read/write +/// access to this address would result in an error report from ASan). +/// Otherwise returns 0. +/// +/// \param addr Address to check. +/// +/// \retval 1 Address is poisoned. +/// \retval 0 Address is not poisoned. +int SANITIZER_CDECL __asan_address_is_poisoned(void const volatile *addr); + +/// Checks if a region is poisoned. +/// +/// If at least one byte in <c>[beg, beg+size)</c> is poisoned, returns the +/// address of the first such byte. Otherwise returns 0. +/// +/// \param beg Start of memory region. +/// \param size Start of memory region. +/// \returns Address of first poisoned byte. +void *SANITIZER_CDECL __asan_region_is_poisoned(void *beg, size_t size); + +/// Describes an address (useful for calling from the debugger). +/// +/// Prints the description of <c><i>addr</i></c>. +/// +/// \param addr Address to describe. +void SANITIZER_CDECL __asan_describe_address(void *addr); + +/// Checks if an error has been or is being reported (useful for calling from +/// the debugger to get information about an ASan error). +/// +/// Returns 1 if an error has been (or is being) reported. Otherwise returns 0. +/// +/// \returns 1 if an error has been (or is being) reported. Otherwise returns +/// 0. +int SANITIZER_CDECL __asan_report_present(void); + +/// Gets the PC (program counter) register value of an ASan error (useful for +/// calling from the debugger). +/// +/// Returns PC if an error has been (or is being) reported. +/// Otherwise returns 0. +/// +/// \returns PC value. +void *SANITIZER_CDECL __asan_get_report_pc(void); + +/// Gets the BP (base pointer) register value of an ASan error (useful for +/// calling from the debugger). +/// +/// Returns BP if an error has been (or is being) reported. +/// Otherwise returns 0. +/// +/// \returns BP value. +void *SANITIZER_CDECL __asan_get_report_bp(void); + +/// Gets the SP (stack pointer) register value of an ASan error (useful for +/// calling from the debugger). +/// +/// If an error has been (or is being) reported, returns SP. +/// Otherwise returns 0. +/// +/// \returns SP value. +void *SANITIZER_CDECL __asan_get_report_sp(void); + +/// Gets the address of the report buffer of an ASan error (useful for calling +/// from the debugger). +/// +/// Returns the address of the report buffer if an error has been (or is being) +/// reported. Otherwise returns 0. +/// +/// \returns Address of report buffer. +void *SANITIZER_CDECL __asan_get_report_address(void); + +/// Gets access type of an ASan error (useful for calling from the debugger). +/// +/// Returns access type (read or write) if an error has been (or is being) +/// reported. Otherwise returns 0. +/// +/// \returns Access type (0 = read, 1 = write). +int SANITIZER_CDECL __asan_get_report_access_type(void); + +/// Gets access size of an ASan error (useful for calling from the debugger). +/// +/// Returns access size if an error has been (or is being) reported. Otherwise +/// returns 0. +/// +/// \returns Access size in bytes. +size_t SANITIZER_CDECL __asan_get_report_access_size(void); + +/// Gets the bug description of an ASan error (useful for calling from a +/// debugger). +/// +/// \returns Returns a bug description if an error has been (or is being) +/// reported - for example, "heap-use-after-free". Otherwise returns an empty +/// string. +const char *SANITIZER_CDECL __asan_get_report_description(void); + +/// Gets information about a pointer (useful for calling from the debugger). +/// +/// Returns the category of the given pointer as a constant string. +/// Possible return values are <c>global</c>, <c>stack</c>, <c>stack-fake</c>, +/// <c>heap</c>, <c>heap-invalid</c>, <c>shadow-low</c>, <c>shadow-gap</c>, +/// <c>shadow-high</c>, and <c>unknown</c>. +/// +/// If the return value is <c>global</c> or <c>stack</c>, tries to also return +/// the variable name, address, and size. If the return value is <c>heap</c>, +/// tries to return the chunk address and size. <c><i>name</i></c> should point +/// to an allocated buffer of size <c><i>name_size</i></c>. +/// +/// \param addr Address to locate. +/// \param name Buffer to store the variable's name. +/// \param name_size Size in bytes of the variable's name buffer. +/// \param[out] region_address Address of the region. +/// \param[out] region_size Size of the region in bytes. +/// +/// \returns Returns the category of the given pointer as a constant string. +const char *SANITIZER_CDECL __asan_locate_address(void *addr, char *name, + size_t name_size, + void **region_address, + size_t *region_size); + +/// Gets the allocation stack trace and thread ID for a heap address (useful +/// for calling from the debugger). +/// +/// Stores up to <c><i>size</i></c> frames in <c><i>trace</i></c>. Returns +/// the number of stored frames or 0 on error. +/// +/// \param addr A heap address. +/// \param trace A buffer to store the stack trace. +/// \param size Size in bytes of the trace buffer. +/// \param[out] thread_id The thread ID of the address. +/// +/// \returns Returns the number of stored frames or 0 on error. +size_t SANITIZER_CDECL __asan_get_alloc_stack(void *addr, void **trace, + size_t size, int *thread_id); + +/// Gets the free stack trace and thread ID for a heap address (useful for +/// calling from the debugger). +/// +/// Stores up to <c><i>size</i></c> frames in <c><i>trace</i></c>. Returns +/// the number of stored frames or 0 on error. +/// +/// \param addr A heap address. +/// \param trace A buffer to store the stack trace. +/// \param size Size in bytes of the trace buffer. +/// \param[out] thread_id The thread ID of the address. +/// +/// \returns Returns the number of stored frames or 0 on error. +size_t SANITIZER_CDECL __asan_get_free_stack(void *addr, void **trace, + size_t size, int *thread_id); + +/// Gets the current shadow memory mapping (useful for calling from the +/// debugger). +/// +/// \param[out] shadow_scale Shadow scale value. +/// \param[out] shadow_offset Offset value. +void SANITIZER_CDECL __asan_get_shadow_mapping(size_t *shadow_scale, + size_t *shadow_offset); + +/// This is an internal function that is called to report an error. However, +/// it is still a part of the interface because you might want to set a +/// breakpoint on this function in the debugger. +/// +/// \param pc <c><i>pc</i></c> value of the ASan error. +/// \param bp <c><i>bp</i></c> value of the ASan error. +/// \param sp <c><i>sp</i></c> value of the ASan error. +/// \param addr Address of the ASan error. +/// \param is_write True if the error is a write error; false otherwise. +/// \param access_size Size of the memory access of the ASan error. +void SANITIZER_CDECL __asan_report_error(void *pc, void *bp, void *sp, + void *addr, int is_write, + size_t access_size); + +// Deprecated. Call __sanitizer_set_death_callback instead. +void SANITIZER_CDECL __asan_set_death_callback(void (*callback)(void)); + +/// Sets the callback function to be called during ASan error reporting. +/// +/// The callback provides a string pointer to the report. +/// +/// \param callback User-provided function. +void SANITIZER_CDECL +__asan_set_error_report_callback(void (*callback)(const char *)); + +/// User-provided callback on ASan errors. +/// +/// You can provide a function that would be called immediately when ASan +/// detects an error. This is useful in cases when ASan detects an error but +/// your program crashes before the ASan report is printed. +void SANITIZER_CDECL __asan_on_error(void); + +/// Prints accumulated statistics to <c>stderr</c> (useful for calling from the +/// debugger). +void SANITIZER_CDECL __asan_print_accumulated_stats(void); + +/// User-provided default option settings. +/// +/// You can provide your own implementation of this function to return a string +/// containing ASan runtime options (for example, +/// <c>verbosity=1:halt_on_error=0</c>). +/// +/// \returns Default options string. +const char *SANITIZER_CDECL __asan_default_options(void); + +// The following two functions facilitate garbage collection in presence of +// ASan's fake stack. + +/// Gets an opaque handler to the current thread's fake stack. +/// +/// Returns an opaque handler to be used by +/// <c>__asan_addr_is_in_fake_stack()</c>. Returns NULL if the current thread +/// does not have a fake stack. +/// +/// \returns An opaque handler to the fake stack or NULL. +void *SANITIZER_CDECL __asan_get_current_fake_stack(void); + +/// Checks if an address belongs to a given fake stack. +/// +/// If <c><i>fake_stack</i></c> is non-NULL and <c><i>addr</i></c> belongs to a +/// fake frame in <c><i>fake_stack</i></c>, returns the address of the real +/// stack that corresponds to the fake frame and sets <c><i>beg</i></c> and +/// <c><i>end</i></c> to the boundaries of this fake frame. Otherwise returns +/// NULL and does not touch <c><i>beg</i></c> and <c><i>end</i></c>. +/// +/// If <c><i>beg</i></c> or <c><i>end</i></c> are NULL, they are not touched. +/// +/// \note This function can be called from a thread other than the owner of +/// <c><i>fake_stack</i></c>, but the owner thread needs to be alive. +/// +/// \param fake_stack An opaque handler to a fake stack. +/// \param addr Address to test. +/// \param[out] beg Beginning of fake frame. +/// \param[out] end End of fake frame. +/// \returns Stack address or NULL. +void *SANITIZER_CDECL __asan_addr_is_in_fake_stack(void *fake_stack, void *addr, + void **beg, void **end); + +/// Performs shadow memory cleanup of the current thread's stack before a +/// function marked with the <c>[[noreturn]]</c> attribute is called. +/// +/// To avoid false positives on the stack, must be called before no-return +/// functions like <c>_exit()</c> and <c>execl()</c>. +void SANITIZER_CDECL __asan_handle_no_return(void); + +/// Update allocation stack trace for the given allocation to the current stack +/// trace. Returns 1 if successful, 0 if not. +int SANITIZER_CDECL __asan_update_allocation_context(void *addr); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // SANITIZER_ASAN_INTERFACE_H diff --git a/contrib/libs/clang18-rt/include/sanitizer/common_interface_defs.h b/contrib/libs/clang18-rt/include/sanitizer/common_interface_defs.h new file mode 100644 index 0000000000..f9fce595b3 --- /dev/null +++ b/contrib/libs/clang18-rt/include/sanitizer/common_interface_defs.h @@ -0,0 +1,455 @@ +//===-- sanitizer/common_interface_defs.h -----------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Common part of the public sanitizer interface. +//===----------------------------------------------------------------------===// + +#ifndef SANITIZER_COMMON_INTERFACE_DEFS_H +#define SANITIZER_COMMON_INTERFACE_DEFS_H + +#include <stddef.h> +#include <stdint.h> + +// Windows allows a user to set their default calling convention, but we always +// use __cdecl +#ifdef _WIN32 +#define SANITIZER_CDECL __cdecl +#else +#define SANITIZER_CDECL +#endif + +#ifdef __cplusplus +extern "C" { +#endif +// Arguments for __sanitizer_sandbox_on_notify() below. +typedef struct { + // Enable sandbox support in sanitizer coverage. + int coverage_sandboxed; + // File descriptor to write coverage data to. If -1 is passed, a file will + // be pre-opened by __sanitizer_sandbox_on_notify(). This field has no + // effect if coverage_sandboxed == 0. + intptr_t coverage_fd; + // If non-zero, split the coverage data into well-formed blocks. This is + // useful when coverage_fd is a socket descriptor. Each block will contain + // a header, allowing data from multiple processes to be sent over the same + // socket. + unsigned int coverage_max_block_size; +} __sanitizer_sandbox_arguments; + +// Tell the tools to write their reports to "path.<pid>" instead of stderr. +void SANITIZER_CDECL __sanitizer_set_report_path(const char *path); +// Tell the tools to write their reports to the provided file descriptor +// (casted to void *). +void SANITIZER_CDECL __sanitizer_set_report_fd(void *fd); +// Get the current full report file path, if a path was specified by +// an earlier call to __sanitizer_set_report_path. Returns null otherwise. +const char *SANITIZER_CDECL __sanitizer_get_report_path(); + +// Notify the tools that the sandbox is going to be turned on. The reserved +// parameter will be used in the future to hold a structure with functions +// that the tools may call to bypass the sandbox. +void SANITIZER_CDECL +__sanitizer_sandbox_on_notify(__sanitizer_sandbox_arguments *args); + +// This function is called by the tool when it has just finished reporting +// an error. 'error_summary' is a one-line string that summarizes +// the error message. This function can be overridden by the client. +void SANITIZER_CDECL +__sanitizer_report_error_summary(const char *error_summary); + +// Some of the sanitizers (for example ASan/TSan) could miss bugs that happen +// in unaligned loads/stores. To find such bugs reliably, you need to replace +// plain unaligned loads/stores with these calls. + +/// Loads a 16-bit unaligned value. +// +/// \param p Pointer to unaligned memory. +/// +/// \returns Loaded value. +uint16_t SANITIZER_CDECL __sanitizer_unaligned_load16(const void *p); + +/// Loads a 32-bit unaligned value. +/// +/// \param p Pointer to unaligned memory. +/// +/// \returns Loaded value. +uint32_t SANITIZER_CDECL __sanitizer_unaligned_load32(const void *p); + +/// Loads a 64-bit unaligned value. +/// +/// \param p Pointer to unaligned memory. +/// +/// \returns Loaded value. +uint64_t SANITIZER_CDECL __sanitizer_unaligned_load64(const void *p); + +/// Stores a 16-bit unaligned value. +/// +/// \param p Pointer to unaligned memory. +/// \param x 16-bit value to store. +void SANITIZER_CDECL __sanitizer_unaligned_store16(void *p, uint16_t x); + +/// Stores a 32-bit unaligned value. +/// +/// \param p Pointer to unaligned memory. +/// \param x 32-bit value to store. +void SANITIZER_CDECL __sanitizer_unaligned_store32(void *p, uint32_t x); + +/// Stores a 64-bit unaligned value. +/// +/// \param p Pointer to unaligned memory. +/// \param x 64-bit value to store. +void SANITIZER_CDECL __sanitizer_unaligned_store64(void *p, uint64_t x); + +// Returns 1 on the first call, then returns 0 thereafter. Called by the tool +// to ensure only one report is printed when multiple errors occur +// simultaneously. +int SANITIZER_CDECL __sanitizer_acquire_crash_state(); + +/// Annotates the current state of a contiguous container, such as +/// <c>std::vector</c>, <c>std::string</c>, or similar. +/// +/// A contiguous container is a container that keeps all of its elements +/// in a contiguous region of memory. The container owns the region of memory +/// <c>[beg, end)</c>; the memory <c>[beg, mid)</c> is used to store the +/// current elements, and the memory <c>[mid, end)</c> is reserved for future +/// elements (<c>beg <= mid <= end</c>). For example, in +/// <c>std::vector<> v</c>: +/// +/// \code +/// beg = &v[0]; +/// end = beg + v.capacity() * sizeof(v[0]); +/// mid = beg + v.size() * sizeof(v[0]); +/// \endcode +/// +/// This annotation tells the Sanitizer tool about the current state of the +/// container so that the tool can report errors when memory from +/// <c>[mid, end)</c> is accessed. Insert this annotation into methods like +/// <c>push_back()</c> or <c>pop_back()</c>. Supply the old and new values of +/// <c>mid</c>(<c><i>old_mid</i></c> and <c><i>new_mid</i></c>). In the initial +/// state <c>mid == end</c>, so that should be the final state when the +/// container is destroyed or when the container reallocates the storage. +/// +/// For ASan, <c><i>beg</i></c> no longer needs to be 8-aligned, +/// first and last granule may be shared with other objects +/// and therefore the function can be used for any allocator. +/// +/// The following example shows how to use the function: +/// +/// \code +/// int32_t x[3]; // 12 bytes +/// char *beg = (char*)&x[0]; +/// char *end = beg + 12; +/// __sanitizer_annotate_contiguous_container(beg, end, beg, end); +/// \endcode +/// +/// \note Use this function with caution and do not use for anything other +/// than vector-like classes. +/// \note Unaligned <c><i>beg</i></c> or <c><i>end</i></c> may miss bugs in +/// these granules. +/// +/// \param beg Beginning of memory region. +/// \param end End of memory region. +/// \param old_mid Old middle of memory region. +/// \param new_mid New middle of memory region. +void SANITIZER_CDECL __sanitizer_annotate_contiguous_container( + const void *beg, const void *end, const void *old_mid, const void *new_mid); + +/// Similar to <c>__sanitizer_annotate_contiguous_container</c>. +/// +/// Annotates the current state of a contiguous container memory, +/// such as <c>std::deque</c>'s single chunk, when the boundries are moved. +/// +/// A contiguous chunk is a chunk that keeps all of its elements +/// in a contiguous region of memory. The container owns the region of memory +/// <c>[storage_beg, storage_end)</c>; the memory <c>[container_beg, +/// container_end)</c> is used to store the current elements, and the memory +/// <c>[storage_beg, container_beg), [container_end, storage_end)</c> is +/// reserved for future elements (<c>storage_beg <= container_beg <= +/// container_end <= storage_end</c>). For example, in <c> std::deque </c>: +/// - chunk with a frist deques element will have container_beg equal to address +/// of the first element. +/// - in every next chunk with elements, true is <c> container_beg == +/// storage_beg </c>. +/// +/// Argument requirements: +/// During unpoisoning memory of empty container (before first element is +/// added): +/// - old_container_beg_p == old_container_end_p +/// During poisoning after last element was removed: +/// - new_container_beg_p == new_container_end_p +/// \param storage_beg Beginning of memory region. +/// \param storage_end End of memory region. +/// \param old_container_beg Old beginning of used region. +/// \param old_container_end End of used region. +/// \param new_container_beg New beginning of used region. +/// \param new_container_end New end of used region. +void SANITIZER_CDECL __sanitizer_annotate_double_ended_contiguous_container( + const void *storage_beg, const void *storage_end, + const void *old_container_beg, const void *old_container_end, + const void *new_container_beg, const void *new_container_end); + +/// Returns true if the contiguous container <c>[beg, end)</c> is properly +/// poisoned. +/// +/// Proper poisoning could occur, for example, with +/// <c>__sanitizer_annotate_contiguous_container</c>), that is, if +/// <c>[beg, mid)</c> is addressable and <c>[mid, end)</c> is unaddressable. +/// Full verification requires O (<c>end - beg</c>) time; this function tries +/// to avoid such complexity by touching only parts of the container around +/// <c><i>beg</i></c>, <c><i>mid</i></c>, and <c><i>end</i></c>. +/// +/// \param beg Beginning of memory region. +/// \param mid Middle of memory region. +/// \param end Old end of memory region. +/// +/// \returns True if the contiguous container <c>[beg, end)</c> is properly +/// poisoned. +int SANITIZER_CDECL __sanitizer_verify_contiguous_container(const void *beg, + const void *mid, + const void *end); + +/// Returns true if the double ended contiguous +/// container <c>[storage_beg, storage_end)</c> is properly poisoned. +/// +/// Proper poisoning could occur, for example, with +/// <c>__sanitizer_annotate_double_ended_contiguous_container</c>), that is, if +/// <c>[storage_beg, container_beg)</c> is not addressable, <c>[container_beg, +/// container_end)</c> is addressable and <c>[container_end, end)</c> is +/// unaddressable. Full verification requires O (<c>storage_end - +/// storage_beg</c>) time; this function tries to avoid such complexity by +/// touching only parts of the container around <c><i>storage_beg</i></c>, +/// <c><i>container_beg</i></c>, <c><i>container_end</i></c>, and +/// <c><i>storage_end</i></c>. +/// +/// \param storage_beg Beginning of memory region. +/// \param container_beg Beginning of used region. +/// \param container_end End of used region. +/// \param storage_end End of memory region. +/// +/// \returns True if the double-ended contiguous container <c>[storage_beg, +/// container_beg, container_end, end)</c> is properly poisoned - only +/// [container_beg; container_end) is addressable. +int SANITIZER_CDECL __sanitizer_verify_double_ended_contiguous_container( + const void *storage_beg, const void *container_beg, + const void *container_end, const void *storage_end); + +/// Similar to <c>__sanitizer_verify_contiguous_container()</c> but also +/// returns the address of the first improperly poisoned byte. +/// +/// Returns NULL if the area is poisoned properly. +/// +/// \param beg Beginning of memory region. +/// \param mid Middle of memory region. +/// \param end Old end of memory region. +/// +/// \returns The bad address or NULL. +const void *SANITIZER_CDECL __sanitizer_contiguous_container_find_bad_address( + const void *beg, const void *mid, const void *end); + +/// returns the address of the first improperly poisoned byte. +/// +/// Returns NULL if the area is poisoned properly. +/// +/// \param storage_beg Beginning of memory region. +/// \param container_beg Beginning of used region. +/// \param container_end End of used region. +/// \param storage_end End of memory region. +/// +/// \returns The bad address or NULL. +const void *SANITIZER_CDECL +__sanitizer_double_ended_contiguous_container_find_bad_address( + const void *storage_beg, const void *container_beg, + const void *container_end, const void *storage_end); + +/// Prints the stack trace leading to this call (useful for calling from the +/// debugger). +void SANITIZER_CDECL __sanitizer_print_stack_trace(void); + +// Symbolizes the supplied 'pc' using the format string 'fmt'. +// Outputs at most 'out_buf_size' bytes into 'out_buf'. +// If 'out_buf' is not empty then output is zero or more non empty C strings +// followed by single empty C string. Multiple strings can be returned if PC +// corresponds to inlined function. Inlined frames are printed in the order +// from "most-inlined" to the "least-inlined", so the last frame should be the +// not inlined function. +// Inlined frames can be removed with 'symbolize_inline_frames=0'. +// The format syntax is described in +// lib/sanitizer_common/sanitizer_stacktrace_printer.h. +void SANITIZER_CDECL __sanitizer_symbolize_pc(void *pc, const char *fmt, + char *out_buf, + size_t out_buf_size); +// Same as __sanitizer_symbolize_pc, but for data section (i.e. globals). +void SANITIZER_CDECL __sanitizer_symbolize_global(void *data_ptr, + const char *fmt, + char *out_buf, + size_t out_buf_size); +// Determine the return address. +#if !defined(_MSC_VER) || defined(__clang__) +#define __sanitizer_return_address() \ + __builtin_extract_return_addr(__builtin_return_address(0)) +#else +void *_ReturnAddress(void); +#pragma intrinsic(_ReturnAddress) +#define __sanitizer_return_address() _ReturnAddress() +#endif + +/// Sets the callback to be called immediately before death on error. +/// +/// Passing 0 will unset the callback. +/// +/// \param callback User-provided callback. +void SANITIZER_CDECL __sanitizer_set_death_callback(void (*callback)(void)); + +// Interceptor hooks. +// Whenever a libc function interceptor is called, it checks if the +// corresponding weak hook is defined, and calls it if it is indeed defined. +// The primary use-case is data-flow-guided fuzzing, where the fuzzer needs +// to know what is being passed to libc functions (for example memcmp). +// FIXME: implement more hooks. + +/// Interceptor hook for <c>memcmp()</c>. +/// +/// \param called_pc PC (program counter) address of the original call. +/// \param s1 Pointer to block of memory. +/// \param s2 Pointer to block of memory. +/// \param n Number of bytes to compare. +/// \param result Value returned by the intercepted function. +void SANITIZER_CDECL __sanitizer_weak_hook_memcmp(void *called_pc, + const void *s1, + const void *s2, size_t n, + int result); + +/// Interceptor hook for <c>strncmp()</c>. +/// +/// \param called_pc PC (program counter) address of the original call. +/// \param s1 Pointer to block of memory. +/// \param s2 Pointer to block of memory. +/// \param n Number of bytes to compare. +/// \param result Value returned by the intercepted function. +void SANITIZER_CDECL __sanitizer_weak_hook_strncmp(void *called_pc, + const char *s1, + const char *s2, size_t n, + int result); + +/// Interceptor hook for <c>strncasecmp()</c>. +/// +/// \param called_pc PC (program counter) address of the original call. +/// \param s1 Pointer to block of memory. +/// \param s2 Pointer to block of memory. +/// \param n Number of bytes to compare. +/// \param result Value returned by the intercepted function. +void SANITIZER_CDECL __sanitizer_weak_hook_strncasecmp(void *called_pc, + const char *s1, + const char *s2, size_t n, + int result); + +/// Interceptor hook for <c>strcmp()</c>. +/// +/// \param called_pc PC (program counter) address of the original call. +/// \param s1 Pointer to block of memory. +/// \param s2 Pointer to block of memory. +/// \param result Value returned by the intercepted function. +void SANITIZER_CDECL __sanitizer_weak_hook_strcmp(void *called_pc, + const char *s1, + const char *s2, int result); + +/// Interceptor hook for <c>strcasecmp()</c>. +/// +/// \param called_pc PC (program counter) address of the original call. +/// \param s1 Pointer to block of memory. +/// \param s2 Pointer to block of memory. +/// \param result Value returned by the intercepted function. +void SANITIZER_CDECL __sanitizer_weak_hook_strcasecmp(void *called_pc, + const char *s1, + const char *s2, + int result); + +/// Interceptor hook for <c>strstr()</c>. +/// +/// \param called_pc PC (program counter) address of the original call. +/// \param s1 Pointer to block of memory. +/// \param s2 Pointer to block of memory. +/// \param result Value returned by the intercepted function. +void SANITIZER_CDECL __sanitizer_weak_hook_strstr(void *called_pc, + const char *s1, + const char *s2, char *result); + +void SANITIZER_CDECL __sanitizer_weak_hook_strcasestr(void *called_pc, + const char *s1, + const char *s2, + char *result); + +void SANITIZER_CDECL __sanitizer_weak_hook_memmem(void *called_pc, + const void *s1, size_t len1, + const void *s2, size_t len2, + void *result); + +// Prints stack traces for all live heap allocations ordered by total +// allocation size until top_percent of total live heap is shown. top_percent +// should be between 1 and 100. At most max_number_of_contexts contexts +// (stack traces) are printed. +// Experimental feature currently available only with ASan on Linux/x86_64. +void SANITIZER_CDECL __sanitizer_print_memory_profile( + size_t top_percent, size_t max_number_of_contexts); + +/// Notify ASan that a fiber switch has started (required only if implementing +/// your own fiber library). +/// +/// Before switching to a different stack, you must call +/// <c>__sanitizer_start_switch_fiber()</c> with a pointer to the bottom of the +/// destination stack and with its size. When code starts running on the new +/// stack, it must call <c>__sanitizer_finish_switch_fiber()</c> to finalize +/// the switch. The <c>__sanitizer_start_switch_fiber()</c> function takes a +/// <c>void**</c> pointer argument to store the current fake stack if there is +/// one (it is necessary when the runtime option +/// <c>detect_stack_use_after_return</c> is enabled). +/// +/// When restoring a stack, this <c>void**</c> pointer must be given to the +/// <c>__sanitizer_finish_switch_fiber()</c> function. In most cases, this +/// pointer can be stored on the stack immediately before switching. When +/// leaving a fiber definitely, NULL must be passed as the first argument to +/// the <c>__sanitizer_start_switch_fiber()</c> function so that the fake stack +/// is destroyed. If your program does not need stack use-after-return +/// detection, you can always pass NULL to these two functions. +/// +/// \note The fake stack mechanism is disabled during fiber switch, so if a +/// signal callback runs during the switch, it will not benefit from stack +/// use-after-return detection. +/// +/// \param[out] fake_stack_save Fake stack save location. +/// \param bottom Bottom address of stack. +/// \param size Size of stack in bytes. +void SANITIZER_CDECL __sanitizer_start_switch_fiber(void **fake_stack_save, + const void *bottom, + size_t size); + +/// Notify ASan that a fiber switch has completed (required only if +/// implementing your own fiber library). +/// +/// When code starts running on the new stack, it must call +/// <c>__sanitizer_finish_switch_fiber()</c> to finalize +/// the switch. For usage details, see the description of +/// <c>__sanitizer_start_switch_fiber()</c>. +/// +/// \param fake_stack_save Fake stack save location. +/// \param[out] bottom_old Bottom address of old stack. +/// \param[out] size_old Size of old stack in bytes. +void SANITIZER_CDECL __sanitizer_finish_switch_fiber(void *fake_stack_save, + const void **bottom_old, + size_t *size_old); + +// Get full module name and calculate pc offset within it. +// Returns 1 if pc belongs to some module, 0 if module was not found. +int SANITIZER_CDECL __sanitizer_get_module_and_offset_for_pc( + void *pc, char *module_path, size_t module_path_len, void **pc_offset); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // SANITIZER_COMMON_INTERFACE_DEFS_H diff --git a/contrib/libs/clang18-rt/include/sanitizer/hwasan_interface.h b/contrib/libs/clang18-rt/include/sanitizer/hwasan_interface.h new file mode 100644 index 0000000000..407f488a24 --- /dev/null +++ b/contrib/libs/clang18-rt/include/sanitizer/hwasan_interface.h @@ -0,0 +1,109 @@ +//===-- sanitizer/hwasan_interface.h ----------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file is a part of HWAddressSanitizer. +// +// Public interface header. +//===----------------------------------------------------------------------===// +#ifndef SANITIZER_HWASAN_INTERFACE_H +#define SANITIZER_HWASAN_INTERFACE_H + +#include <sanitizer/common_interface_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif +// Libc hook for program startup in statically linked executables. +// Initializes enough of the runtime to run instrumented code. This function +// should only be called in statically linked executables because it modifies +// the GOT, which won't work in regular binaries because RELRO will already +// have been applied by the time the function is called. This also means that +// the function should be called before libc applies RELRO. +// Does not call libc unless there is an error. +// Can be called multiple times. +void SANITIZER_CDECL __hwasan_init_static(void); + +// This function may be optionally provided by user and should return +// a string containing HWASan runtime options. See asan_flags.h for details. +const char *SANITIZER_CDECL __hwasan_default_options(void); + +void SANITIZER_CDECL __hwasan_enable_allocator_tagging(void); +void SANITIZER_CDECL __hwasan_disable_allocator_tagging(void); + +// Mark region of memory with the given tag. Both address and size need to be +// 16-byte aligned. +void SANITIZER_CDECL __hwasan_tag_memory(const volatile void *p, + unsigned char tag, size_t size); + +/// Set pointer tag. Previous tag is lost. +void *SANITIZER_CDECL __hwasan_tag_pointer(const volatile void *p, + unsigned char tag); + +/// Get tag from the pointer. +unsigned char SANITIZER_CDECL +__hwasan_get_tag_from_pointer(const volatile void *p); + +// Set memory tag from the current SP address to the given address to zero. +// This is meant to annotate longjmp and other non-local jumps. +// This function needs to know the (almost) exact destination frame address; +// clearing shadow for the entire thread stack like __asan_handle_no_return +// does would cause false reports. +void SANITIZER_CDECL __hwasan_handle_longjmp(const void *sp_dst); + +// Set memory tag for the part of the current thread stack below sp_dst to +// zero. Call this in vfork() before returning in the parent process. +void SANITIZER_CDECL __hwasan_handle_vfork(const void *sp_dst); + +// Libc hook for thread creation. Should be called in the child thread before +// any instrumented code. +void SANITIZER_CDECL __hwasan_thread_enter(); + +// Libc hook for thread destruction. No instrumented code should run after +// this call. +void SANITIZER_CDECL __hwasan_thread_exit(); + +// Print shadow and origin for the memory range to stderr in a human-readable +// format. +void SANITIZER_CDECL __hwasan_print_shadow(const volatile void *x, size_t size); + +// Print one-line report about the memory usage of the current process. +void SANITIZER_CDECL __hwasan_print_memory_usage(); + +/* Returns the offset of the first byte in the memory range that can not be + * accessed through the pointer in x, or -1 if the whole range is good. */ +intptr_t SANITIZER_CDECL __hwasan_test_shadow(const volatile void *x, + size_t size); + +/* Sets the callback function to be called during HWASan error reporting. */ +void SANITIZER_CDECL +__hwasan_set_error_report_callback(void (*callback)(const char *)); + +int SANITIZER_CDECL __sanitizer_posix_memalign(void **memptr, size_t alignment, + size_t size); +void *SANITIZER_CDECL __sanitizer_memalign(size_t alignment, size_t size); +void *SANITIZER_CDECL __sanitizer_aligned_alloc(size_t alignment, size_t size); +void *SANITIZER_CDECL __sanitizer___libc_memalign(size_t alignment, + size_t size); +void *SANITIZER_CDECL __sanitizer_valloc(size_t size); +void *SANITIZER_CDECL __sanitizer_pvalloc(size_t size); +void SANITIZER_CDECL __sanitizer_free(void *ptr); +void SANITIZER_CDECL __sanitizer_cfree(void *ptr); +size_t SANITIZER_CDECL __sanitizer_malloc_usable_size(const void *ptr); +struct mallinfo SANITIZER_CDECL __sanitizer_mallinfo(); +int SANITIZER_CDECL __sanitizer_mallopt(int cmd, int value); +void SANITIZER_CDECL __sanitizer_malloc_stats(void); +void *SANITIZER_CDECL __sanitizer_calloc(size_t nmemb, size_t size); +void *SANITIZER_CDECL __sanitizer_realloc(void *ptr, size_t size); +void *SANITIZER_CDECL __sanitizer_reallocarray(void *ptr, size_t nmemb, + size_t size); +void *SANITIZER_CDECL __sanitizer_malloc(size_t size); +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // SANITIZER_HWASAN_INTERFACE_H diff --git a/contrib/libs/clang18-rt/include/sanitizer/lsan_interface.h b/contrib/libs/clang18-rt/include/sanitizer/lsan_interface.h new file mode 100644 index 0000000000..18f3456a12 --- /dev/null +++ b/contrib/libs/clang18-rt/include/sanitizer/lsan_interface.h @@ -0,0 +1,89 @@ +//===-- sanitizer/lsan_interface.h ------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file is a part of LeakSanitizer. +// +// Public interface header. +//===----------------------------------------------------------------------===// +#ifndef SANITIZER_LSAN_INTERFACE_H +#define SANITIZER_LSAN_INTERFACE_H + +#include <sanitizer/common_interface_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif +// Allocations made between calls to __lsan_disable() and __lsan_enable() will +// be treated as non-leaks. Disable/enable pairs may be nested. +void SANITIZER_CDECL __lsan_disable(void); +void SANITIZER_CDECL __lsan_enable(void); + +// The heap object into which p points will be treated as a non-leak. +void SANITIZER_CDECL __lsan_ignore_object(const void *p); + +// Memory regions registered through this interface will be treated as sources +// of live pointers during leak checking. Useful if you store pointers in +// mapped memory. +// Points of note: +// - __lsan_unregister_root_region() must be called with the same pointer and +// size that have earlier been passed to __lsan_register_root_region() +// - LSan will skip any inaccessible memory when scanning a root region. E.g., +// if you map memory within a larger region that you have mprotect'ed, you can +// register the entire large region. +// - the implementation is not optimized for performance. This interface is +// intended to be used for a small number of relatively static regions. +void SANITIZER_CDECL __lsan_register_root_region(const void *p, size_t size); +void SANITIZER_CDECL __lsan_unregister_root_region(const void *p, size_t size); + +// Check for leaks now. This function behaves identically to the default +// end-of-process leak check. In particular, it will terminate the process if +// leaks are found and the exitcode runtime flag is non-zero. +// Subsequent calls to this function will have no effect and end-of-process +// leak check will not run. Effectively, end-of-process leak check is moved to +// the time of first invocation of this function. +// By calling this function early during process shutdown, you can instruct +// LSan to ignore shutdown-only leaks which happen later on. +void SANITIZER_CDECL __lsan_do_leak_check(void); + +// Check for leaks now. Returns zero if no leaks have been found or if leak +// detection is disabled, non-zero otherwise. +// This function may be called repeatedly, e.g. to periodically check a +// long-running process. It prints a leak report if appropriate, but does not +// terminate the process. It does not affect the behavior of +// __lsan_do_leak_check() or the end-of-process leak check, and is not +// affected by them. +int SANITIZER_CDECL __lsan_do_recoverable_leak_check(void); + +// The user may optionally provide this function to disallow leak checking +// for the program it is linked into (if the return value is non-zero). This +// function must be defined as returning a constant value; any behavior beyond +// that is unsupported. +// To avoid dead stripping, you may need to define this function with +// __attribute__((used)) +int SANITIZER_CDECL __lsan_is_turned_off(void); + +// This function may be optionally provided by user and should return +// a string containing LSan runtime options. See lsan_flags.inc for details. +const char *SANITIZER_CDECL __lsan_default_options(void); + +// This function may be optionally provided by the user and should return +// a string containing LSan suppressions. +const char *SANITIZER_CDECL __lsan_default_suppressions(void); +#ifdef __cplusplus +} // extern "C" + +namespace __lsan { +class ScopedDisabler { +public: + ScopedDisabler() { __lsan_disable(); } + ~ScopedDisabler() { __lsan_enable(); } +}; +} // namespace __lsan +#endif + +#endif // SANITIZER_LSAN_INTERFACE_H diff --git a/contrib/libs/clang18-rt/include/sanitizer/msan_interface.h b/contrib/libs/clang18-rt/include/sanitizer/msan_interface.h new file mode 100644 index 0000000000..6fedc03125 --- /dev/null +++ b/contrib/libs/clang18-rt/include/sanitizer/msan_interface.h @@ -0,0 +1,135 @@ +//===-- msan_interface.h --------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file is a part of MemorySanitizer. +// +// Public interface header. +//===----------------------------------------------------------------------===// +#ifndef MSAN_INTERFACE_H +#define MSAN_INTERFACE_H + +#include <sanitizer/common_interface_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif +/* Set raw origin for the memory range. */ +void SANITIZER_CDECL __msan_set_origin(const volatile void *a, size_t size, + uint32_t origin); + +/* Get raw origin for an address. */ +uint32_t SANITIZER_CDECL __msan_get_origin(const volatile void *a); + +/* Test that this_id is a descendant of prev_id (or they are simply equal). + * "descendant" here means they are part of the same chain, created with + * __msan_chain_origin. */ +int SANITIZER_CDECL __msan_origin_is_descendant_or_same(uint32_t this_id, + uint32_t prev_id); + +/* Returns non-zero if tracking origins. */ +int SANITIZER_CDECL __msan_get_track_origins(void); + +/* Returns the origin id of the latest UMR in the calling thread. */ +uint32_t SANITIZER_CDECL __msan_get_umr_origin(void); + +/* Make memory region fully initialized (without changing its contents). */ +void SANITIZER_CDECL __msan_unpoison(const volatile void *a, size_t size); + +/* Make a null-terminated string fully initialized (without changing its + contents). */ +void SANITIZER_CDECL __msan_unpoison_string(const volatile char *a); + +/* Make first n parameters of the next function call fully initialized. */ +void SANITIZER_CDECL __msan_unpoison_param(size_t n); + +/* Make memory region fully uninitialized (without changing its contents). + This is a legacy interface that does not update origin information. Use + __msan_allocated_memory() instead. */ +void SANITIZER_CDECL __msan_poison(const volatile void *a, size_t size); + +/* Make memory region partially uninitialized (without changing its contents). + */ +void SANITIZER_CDECL __msan_partial_poison(const volatile void *data, + void *shadow, size_t size); + +/* Returns the offset of the first (at least partially) poisoned byte in the + memory range, or -1 if the whole range is good. */ +intptr_t SANITIZER_CDECL __msan_test_shadow(const volatile void *x, + size_t size); + +/* Checks that memory range is fully initialized, and reports an error if it + * is not. */ +void SANITIZER_CDECL __msan_check_mem_is_initialized(const volatile void *x, + size_t size); + +/* For testing: + __msan_set_expect_umr(1); + ... some buggy code ... + __msan_set_expect_umr(0); + The last line will verify that a UMR happened. */ +void SANITIZER_CDECL __msan_set_expect_umr(int expect_umr); + +/* Change the value of keep_going flag. Non-zero value means don't terminate + program execution when an error is detected. This will not affect error in + modules that were compiled without the corresponding compiler flag. */ +void SANITIZER_CDECL __msan_set_keep_going(int keep_going); + +/* Print shadow and origin for the memory range to stderr in a human-readable + format. */ +void SANITIZER_CDECL __msan_print_shadow(const volatile void *x, size_t size); + +/* Print shadow for the memory range to stderr in a minimalistic + human-readable format. */ +void SANITIZER_CDECL __msan_dump_shadow(const volatile void *x, size_t size); + +/* Returns true if running under a dynamic tool (DynamoRio-based). */ +int SANITIZER_CDECL __msan_has_dynamic_component(void); + +/* Tell MSan about newly allocated memory (ex.: custom allocator). + Memory will be marked uninitialized, with origin at the call site. */ +void SANITIZER_CDECL __msan_allocated_memory(const volatile void *data, + size_t size); + +/* Tell MSan about newly destroyed memory. Mark memory as uninitialized. */ +void SANITIZER_CDECL __sanitizer_dtor_callback(const volatile void *data, + size_t size); +void SANITIZER_CDECL __sanitizer_dtor_callback_fields(const volatile void *data, + size_t size); +void SANITIZER_CDECL __sanitizer_dtor_callback_vptr(const volatile void *data); + +/* This function may be optionally provided by user and should return + a string containing Msan runtime options. See msan_flags.h for details. */ +const char *SANITIZER_CDECL __msan_default_options(void); + +/* Deprecated. Call __sanitizer_set_death_callback instead. */ +void SANITIZER_CDECL +__msan_set_death_callback(void(SANITIZER_CDECL *callback)(void)); + +/* Update shadow for the application copy of size bytes from src to dst. + Src and dst are application addresses. This function does not copy the + actual application memory, it only updates shadow and origin for such + copy. Source and destination regions can overlap. */ +void SANITIZER_CDECL __msan_copy_shadow(const volatile void *dst, + const volatile void *src, size_t size); + +/* Disables uninitialized memory checks in interceptors. */ +void SANITIZER_CDECL __msan_scoped_disable_interceptor_checks(void); + +/* Re-enables uninitialized memory checks in interceptors after a previous + call to __msan_scoped_disable_interceptor_checks. */ +void SANITIZER_CDECL __msan_scoped_enable_interceptor_checks(void); + +void SANITIZER_CDECL __msan_start_switch_fiber(const void *bottom, size_t size); +void SANITIZER_CDECL __msan_finish_switch_fiber(const void **bottom_old, + size_t *size_old); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif diff --git a/contrib/libs/clang18-rt/include/sanitizer/tsan_interface.h b/contrib/libs/clang18-rt/include/sanitizer/tsan_interface.h new file mode 100644 index 0000000000..e11a4175cd --- /dev/null +++ b/contrib/libs/clang18-rt/include/sanitizer/tsan_interface.h @@ -0,0 +1,316 @@ +//===-- tsan_interface.h ----------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file is a part of ThreadSanitizer (TSan), a race detector. +// +// Public interface header for TSan. +//===----------------------------------------------------------------------===// +#ifndef SANITIZER_TSAN_INTERFACE_H +#define SANITIZER_TSAN_INTERFACE_H + +#include <sanitizer/common_interface_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// __tsan_release establishes a happens-before relation with a preceding +// __tsan_acquire on the same address. +void SANITIZER_CDECL __tsan_acquire(void *addr); +void SANITIZER_CDECL __tsan_release(void *addr); + +// Annotations for custom mutexes. +// The annotations allow to get better reports (with sets of locked mutexes), +// detect more types of bugs (e.g. mutex misuses, races between lock/unlock and +// destruction and potential deadlocks) and improve precision and performance +// (by ignoring individual atomic operations in mutex code). However, the +// downside is that annotated mutex code itself is not checked for correctness. + +// Mutex creation flags are passed to __tsan_mutex_create annotation. +// If mutex has no constructor and __tsan_mutex_create is not called, +// the flags may be passed to __tsan_mutex_pre_lock/__tsan_mutex_post_lock +// annotations. + +// Mutex has static storage duration and no-op constructor and destructor. +// This effectively makes tsan ignore destroy annotation. +static const unsigned __tsan_mutex_linker_init = 1 << 0; +// Mutex is write reentrant. +static const unsigned __tsan_mutex_write_reentrant = 1 << 1; +// Mutex is read reentrant. +static const unsigned __tsan_mutex_read_reentrant = 1 << 2; +// Mutex does not have static storage duration, and must not be used after +// its destructor runs. The opposite of __tsan_mutex_linker_init. +// If this flag is passed to __tsan_mutex_destroy, then the destruction +// is ignored unless this flag was previously set on the mutex. +static const unsigned __tsan_mutex_not_static = 1 << 8; + +// Mutex operation flags: + +// Denotes read lock operation. +static const unsigned __tsan_mutex_read_lock = 1 << 3; +// Denotes try lock operation. +static const unsigned __tsan_mutex_try_lock = 1 << 4; +// Denotes that a try lock operation has failed to acquire the mutex. +static const unsigned __tsan_mutex_try_lock_failed = 1 << 5; +// Denotes that the lock operation acquires multiple recursion levels. +// Number of levels is passed in recursion parameter. +// This is useful for annotation of e.g. Java builtin monitors, +// for which wait operation releases all recursive acquisitions of the mutex. +static const unsigned __tsan_mutex_recursive_lock = 1 << 6; +// Denotes that the unlock operation releases all recursion levels. +// Number of released levels is returned and later must be passed to +// the corresponding __tsan_mutex_post_lock annotation. +static const unsigned __tsan_mutex_recursive_unlock = 1 << 7; + +// Convenient composed constants. +static const unsigned __tsan_mutex_try_read_lock = + __tsan_mutex_read_lock | __tsan_mutex_try_lock; +static const unsigned __tsan_mutex_try_read_lock_failed = + __tsan_mutex_try_read_lock | __tsan_mutex_try_lock_failed; + +// Annotate creation of a mutex. +// Supported flags: mutex creation flags. +void SANITIZER_CDECL __tsan_mutex_create(void *addr, unsigned flags); + +// Annotate destruction of a mutex. +// Supported flags: +// - __tsan_mutex_linker_init +// - __tsan_mutex_not_static +void SANITIZER_CDECL __tsan_mutex_destroy(void *addr, unsigned flags); + +// Annotate start of lock operation. +// Supported flags: +// - __tsan_mutex_read_lock +// - __tsan_mutex_try_lock +// - all mutex creation flags +void SANITIZER_CDECL __tsan_mutex_pre_lock(void *addr, unsigned flags); + +// Annotate end of lock operation. +// Supported flags: +// - __tsan_mutex_read_lock (must match __tsan_mutex_pre_lock) +// - __tsan_mutex_try_lock (must match __tsan_mutex_pre_lock) +// - __tsan_mutex_try_lock_failed +// - __tsan_mutex_recursive_lock +// - all mutex creation flags +void SANITIZER_CDECL __tsan_mutex_post_lock(void *addr, unsigned flags, + int recursion); + +// Annotate start of unlock operation. +// Supported flags: +// - __tsan_mutex_read_lock +// - __tsan_mutex_recursive_unlock +int SANITIZER_CDECL __tsan_mutex_pre_unlock(void *addr, unsigned flags); + +// Annotate end of unlock operation. +// Supported flags: +// - __tsan_mutex_read_lock (must match __tsan_mutex_pre_unlock) +void SANITIZER_CDECL __tsan_mutex_post_unlock(void *addr, unsigned flags); + +// Annotate start/end of notify/signal/broadcast operation. +// Supported flags: none. +void SANITIZER_CDECL __tsan_mutex_pre_signal(void *addr, unsigned flags); +void SANITIZER_CDECL __tsan_mutex_post_signal(void *addr, unsigned flags); + +// Annotate start/end of a region of code where lock/unlock/signal operation +// diverts to do something else unrelated to the mutex. This can be used to +// annotate, for example, calls into cooperative scheduler or contention +// profiling code. +// These annotations must be called only from within +// __tsan_mutex_pre/post_lock, __tsan_mutex_pre/post_unlock, +// __tsan_mutex_pre/post_signal regions. +// Supported flags: none. +void SANITIZER_CDECL __tsan_mutex_pre_divert(void *addr, unsigned flags); +void SANITIZER_CDECL __tsan_mutex_post_divert(void *addr, unsigned flags); + +// Check that the current thread does not hold any mutexes, +// report a bug report otherwise. +void SANITIZER_CDECL __tsan_check_no_mutexes_held(); + +// External race detection API. +// Can be used by non-instrumented libraries to detect when their objects are +// being used in an unsafe manner. +// - __tsan_external_read/__tsan_external_write annotates the logical reads +// and writes of the object at the specified address. 'caller_pc' should +// be the PC of the library user, which the library can obtain with e.g. +// `__builtin_return_address(0)`. +// - __tsan_external_register_tag registers a 'tag' with the specified name, +// which is later used in read/write annotations to denote the object type +// - __tsan_external_assign_tag can optionally mark a heap object with a tag +void *SANITIZER_CDECL __tsan_external_register_tag(const char *object_type); +void SANITIZER_CDECL __tsan_external_register_header(void *tag, + const char *header); +void SANITIZER_CDECL __tsan_external_assign_tag(void *addr, void *tag); +void SANITIZER_CDECL __tsan_external_read(void *addr, void *caller_pc, + void *tag); +void SANITIZER_CDECL __tsan_external_write(void *addr, void *caller_pc, + void *tag); + +// Fiber switching API. +// - TSAN context for fiber can be created by __tsan_create_fiber +// and freed by __tsan_destroy_fiber. +// - TSAN context of current fiber or thread can be obtained +// by calling __tsan_get_current_fiber. +// - __tsan_switch_to_fiber should be called immediately before switch +// to fiber, such as call of swapcontext. +// - Fiber name can be set by __tsan_set_fiber_name. +void *SANITIZER_CDECL __tsan_get_current_fiber(void); +void *SANITIZER_CDECL __tsan_create_fiber(unsigned flags); +void SANITIZER_CDECL __tsan_destroy_fiber(void *fiber); +void SANITIZER_CDECL __tsan_switch_to_fiber(void *fiber, unsigned flags); +void SANITIZER_CDECL __tsan_set_fiber_name(void *fiber, const char *name); + +// Flags for __tsan_switch_to_fiber: +// Do not establish a happens-before relation between fibers +static const unsigned __tsan_switch_to_fiber_no_sync = 1 << 0; + +// User-provided callback invoked on TSan initialization. +void SANITIZER_CDECL __tsan_on_initialize(); + +// User-provided callback invoked on TSan shutdown. +// `failed` - Nonzero if TSan did detect issues, zero otherwise. +// Return `0` if TSan should exit as if no issues were detected. Return nonzero +// if TSan should exit as if issues were detected. +int SANITIZER_CDECL __tsan_on_finalize(int failed); + +// Release TSan internal memory in a best-effort manner. +void SANITIZER_CDECL __tsan_flush_memory(); + +// User-provided default TSAN options. +const char *SANITIZER_CDECL __tsan_default_options(void); + +// User-provided default TSAN suppressions. +const char *SANITIZER_CDECL __tsan_default_suppressions(void); + +/// Returns a report's description. +/// +/// Returns a report's description (issue type), number of duplicate issues +/// found, counts of array data (stack traces, memory operations, locations, +/// mutexes, threads, unique thread IDs) and a stack trace of a <c>sleep()</c> +/// call (if one was involved in the issue). +/// +/// \param report Opaque pointer to the current report. +/// \param[out] description Report type description. +/// \param[out] count Count of duplicate issues. +/// \param[out] stack_count Count of stack traces. +/// \param[out] mop_count Count of memory operations. +/// \param[out] loc_count Count of locations. +/// \param[out] mutex_count Count of mutexes. +/// \param[out] thread_count Count of threads. +/// \param[out] unique_tid_count Count of unique thread IDs. +/// \param sleep_trace A buffer to store the stack trace of a <c>sleep()</c> +/// call. +/// \param trace_size Size in bytes of the trace buffer. +/// \returns Returns 1 if successful, 0 if not. +int SANITIZER_CDECL __tsan_get_report_data( + void *report, const char **description, int *count, int *stack_count, + int *mop_count, int *loc_count, int *mutex_count, int *thread_count, + int *unique_tid_count, void **sleep_trace, unsigned long trace_size); + +/// Returns information about stack traces included in the report. +/// +/// \param report Opaque pointer to the current report. +/// \param idx Index to the report's stacks. +/// \param trace A buffer to store the stack trace. +/// \param trace_size Size in bytes of the trace buffer. +/// \returns Returns 1 if successful, 0 if not. +int SANITIZER_CDECL __tsan_get_report_stack(void *report, unsigned long idx, + void **trace, + unsigned long trace_size); + +/// Returns information about memory operations included in the report. +/// +/// \param report Opaque pointer to the current report. +/// \param idx Index to the report's memory operations. +/// \param[out] tid Thread ID of the memory operation. +/// \param[out] addr Address of the memory operation. +/// \param[out] size Size of the memory operation. +/// \param[out] write Write flag of the memory operation. +/// \param[out] atomic Atomicity flag of the memory operation. +/// \param trace A buffer to store the stack trace. +/// \param trace_size Size in bytes of the trace buffer. +/// \returns Returns 1 if successful, 0 if not. +int SANITIZER_CDECL __tsan_get_report_mop(void *report, unsigned long idx, + int *tid, void **addr, int *size, + int *write, int *atomic, void **trace, + unsigned long trace_size); + +/// Returns information about locations included in the report. +/// +/// \param report Opaque pointer to the current report. +/// \param idx Index to the report's locations. +/// \param[out] type Type of the location. +/// \param[out] addr Address of the location. +/// \param[out] start Start of the location. +/// \param[out] size Size of the location. +/// \param[out] tid Thread ID of the location. +/// \param[out] fd File descriptor of the location. +/// \param[out] suppressable Suppressable flag. +/// \param trace A buffer to store the stack trace. +/// \param trace_size Size in bytes of the trace buffer. +/// \returns Returns 1 if successful, 0 if not. +int SANITIZER_CDECL __tsan_get_report_loc(void *report, unsigned long idx, + const char **type, void **addr, + void **start, unsigned long *size, + int *tid, int *fd, int *suppressable, + void **trace, + unsigned long trace_size); + +/// Returns information about mutexes included in the report. +/// +/// \param report Opaque pointer to the current report. +/// \param idx Index to the report's mutexes. +/// \param[out] mutex_id Id of the mutex. +/// \param[out] addr Address of the mutex. +/// \param[out] destroyed Destroyed mutex flag. +/// \param trace A buffer to store the stack trace. +/// \param trace_size Size in bytes of the trace buffer. +/// \returns Returns 1 if successful, 0 if not. +int SANITIZER_CDECL __tsan_get_report_mutex(void *report, unsigned long idx, + uint64_t *mutex_id, void **addr, + int *destroyed, void **trace, + unsigned long trace_size); + +/// Returns information about threads included in the report. +/// +/// \param report Opaque pointer to the current report. +/// \param idx Index to the report's threads. +/// \param[out] tid Thread ID of the thread. +/// \param[out] os_id Operating system's ID of the thread. +/// \param[out] running Running flag of the thread. +/// \param[out] name Name of the thread. +/// \param[out] parent_tid ID of the parent thread. +/// \param trace A buffer to store the stack trace. +/// \param trace_size Size in bytes of the trace buffer. +/// \returns Returns 1 if successful, 0 if not. +int SANITIZER_CDECL __tsan_get_report_thread(void *report, unsigned long idx, + int *tid, uint64_t *os_id, + int *running, const char **name, + int *parent_tid, void **trace, + unsigned long trace_size); + +/// Returns information about unique thread IDs included in the report. +/// +/// \param report Opaque pointer to the current report. +/// \param idx Index to the report's unique thread IDs. +/// \param[out] tid Unique thread ID of the report. +/// \returns Returns 1 if successful, 0 if not. +int SANITIZER_CDECL __tsan_get_report_unique_tid(void *report, + unsigned long idx, int *tid); + +/// Returns the current report. +/// +/// If TSan is currently reporting a detected issue on the current thread, +/// returns an opaque pointer to the current report. Otherwise returns NULL. +/// \returns An opaque pointer to the current report. Otherwise returns NULL. +void *SANITIZER_CDECL __tsan_get_current_report(); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // SANITIZER_TSAN_INTERFACE_H diff --git a/contrib/libs/farmhash/arch/sse41/ya.make b/contrib/libs/farmhash/arch/sse41/ya.make index c53364807c..68d0307a2e 100644 --- a/contrib/libs/farmhash/arch/sse41/ya.make +++ b/contrib/libs/farmhash/arch/sse41/ya.make @@ -8,7 +8,10 @@ LICENSE(MIT) NO_COMPILER_WARNINGS() -IF (NOT MSVC OR CLANG_CL) +SET(OK_CC NOT MSVC OR CLANG_CL) +SET(HAS_SSE41_FLAG OK_CC AND NOT ARCH_ARM) + +IF (HAS_SSE41_FLAG == yes) CFLAGS(-msse4.1) ENDIF() diff --git a/contrib/libs/farmhash/arch/sse42_aesni/ya.make b/contrib/libs/farmhash/arch/sse42_aesni/ya.make index bcdd8646b7..edb55693e0 100644 --- a/contrib/libs/farmhash/arch/sse42_aesni/ya.make +++ b/contrib/libs/farmhash/arch/sse42_aesni/ya.make @@ -8,7 +8,10 @@ LICENSE(MIT) NO_COMPILER_WARNINGS() -IF (NOT MSVC OR CLANG_CL) +SET(OK_CC NOT MSVC OR CLANG_CL) +SET(HAS_SSE42_FLAG OK_CC AND NOT ARCH_ARM) + +IF (HAS_SSE42_FLAG == yes) CFLAGS( -msse4.2 -maes diff --git a/contrib/libs/grpc/include/grpcpp/impl/call_op_set.h b/contrib/libs/grpc/include/grpcpp/impl/call_op_set.h index 88f0ea0e00..f1084b0e95 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/call_op_set.h +++ b/contrib/libs/grpc/include/grpcpp/impl/call_op_set.h @@ -283,6 +283,11 @@ class CallOpSendInitialMetadata { } maybe_compression_level_; }; +// win headers create macro SendMessage +#if defined(_WIN32) && defined(SendMessage) +#undef SendMessage +#endif + class CallOpSendMessage { public: CallOpSendMessage() : send_buf_() {} diff --git a/contrib/libs/libpng/pngpriv.h b/contrib/libs/libpng/pngpriv.h index 6ae5f3c1fd..d226cb9a1e 100644 --- a/contrib/libs/libpng/pngpriv.h +++ b/contrib/libs/libpng/pngpriv.h @@ -514,6 +514,11 @@ */ # include <float.h> +#if defined(__clang__) && __clang_major__ >= 17 +#include <math.h> +#define __MATH_H__ +#endif + # if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) /* We need to check that <math.h> hasn't already been included earlier diff --git a/contrib/python/scipy/py3/scipy/sparse/linalg/_eigen/arpack/_arpack-f2pywrappers.f b/contrib/python/scipy/py3/scipy/sparse/linalg/_eigen/arpack/_arpack-f2pywrappers.f index be8b409ec3..655e88ff3f 100644 --- a/contrib/python/scipy/py3/scipy/sparse/linalg/_eigen/arpack/_arpack-f2pywrappers.f +++ b/contrib/python/scipy/py3/scipy/sparse/linalg/_eigen/arpack/_arpack-f2pywrappers.f @@ -36,7 +36,7 @@ C It contains Fortran 77 wrappers to fortran functions. &,mneupd,mcaupd,mcaup2,mcaitr,mceigh,mcapps,mcgets,mceupd) end - subroutine f2pyinittiming(setupfunc) + subroutine f2pyinittiming_uniq(setupfunc) external setupfunc integer nopx integer nbx diff --git a/contrib/python/scipy/py3/scipy/sparse/linalg/_eigen/arpack/_arpackmodule.c b/contrib/python/scipy/py3/scipy/sparse/linalg/_eigen/arpack/_arpackmodule.c index 86f7ad8e04..c11a3ac645 100644 --- a/contrib/python/scipy/py3/scipy/sparse/linalg/_eigen/arpack/_arpackmodule.c +++ b/contrib/python/scipy/py3/scipy/sparse/linalg/_eigen/arpack/_arpackmodule.c @@ -5280,7 +5280,7 @@ static void f2py_setup_timing(char *nopx,char *nbx,char *nrorth,char *nitref,cha f2py_timing_def[i_f2py++].data = titref; f2py_timing_def[i_f2py++].data = trvec; } -extern void F_FUNC(f2pyinittiming,F2PYINITTIMING)(void(*)(char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*)); +extern void F_FUNC(f2pyinittiming_uniq,F2PYINITTIMING)(void(*)(char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*)); static void f2py_init_timing(void) { F_FUNC(f2pyinittiming,F2PYINITTIMING)(f2py_setup_timing); } diff --git a/contrib/tools/python/src/Include/pyconfig.win32.h b/contrib/tools/python/src/Include/pyconfig.win32.h index 8aeb631ab1..6aae7b85b0 100644 --- a/contrib/tools/python/src/Include/pyconfig.win32.h +++ b/contrib/tools/python/src/Include/pyconfig.win32.h @@ -233,7 +233,9 @@ typedef int pid_t; #define Py_IS_NAN _isnan #define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X)) #define Py_IS_FINITE(X) _finite(X) +#ifndef __clang__ #define copysign _copysign +#endif /* VS 2010 and above already defines hypot as _hypot */ #if _MSC_VER < 1600 |