diff options
author | maxim-yurchuk <maxim-yurchuk@yandex-team.com> | 2024-12-02 19:15:43 +0300 |
---|---|---|
committer | maxim-yurchuk <maxim-yurchuk@yandex-team.com> | 2024-12-02 19:31:00 +0300 |
commit | e4293e758af131e7ef7ca74bfa1ef6f9b74b58cb (patch) | |
tree | 14483aaaf2e865976326b16d0a21a3bd4d81bf6b | |
parent | 24211947581091f2f54c8e50e3427e6621dfec3d (diff) | |
download | ydb-e4293e758af131e7ef7ca74bfa1ef6f9b74b58cb.tar.gz |
Add missing configs + add mold and coverage to piglet YDB config
commit_hash:c0112c0409a0972eb859b32a014980020df7ce0a
23 files changed, 167 insertions, 38 deletions
diff --git a/build/platform/mold/mold.json b/build/platform/mold/mold.json new file mode 100644 index 0000000000..ee314b2a2e --- /dev/null +++ b/build/platform/mold/mold.json @@ -0,0 +1,16 @@ +{ + "by_platform": { + "darwin-arm64": { + "uri": "sbr:7421008516" + }, + "darwin-x86_64": { + "uri": "sbr:7421180051" + }, + "linux-aarch64": { + "uri": "sbr:7421207790" + }, + "linux-x86_64": { + "uri": "sbr:7421606584" + } + } +} diff --git a/build/platform/mold/ya.make b/build/platform/mold/ya.make new file mode 100644 index 0000000000..2d5f8cde45 --- /dev/null +++ b/build/platform/mold/ya.make @@ -0,0 +1,13 @@ +RESOURCES_LIBRARY() + +TOOLCHAIN(mold) +VERSION(2.34.1) + +DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(MOLD_ROOT mold.json) + +LDFLAGS( + -fuse-ld=mold + --ld-path=${MOLD_ROOT_RESOURCE_GLOBAL}/bin/ld.mold +) + +END() diff --git a/contrib/libs/clang14-rt/lib/asan/ya.make b/contrib/libs/clang14-rt/lib/asan/ya.make index 981e911a74..c3cd19e360 100644 --- a/contrib/libs/clang14-rt/lib/asan/ya.make +++ b/contrib/libs/clang14-rt/lib/asan/ya.make @@ -15,8 +15,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - ADDINCL( contrib/libs/clang14-rt/lib ) diff --git a/contrib/libs/clang14-rt/lib/asan_cxx/ya.make b/contrib/libs/clang14-rt/lib/asan_cxx/ya.make index 9dad011718..0d46e10dfe 100644 --- a/contrib/libs/clang14-rt/lib/asan_cxx/ya.make +++ b/contrib/libs/clang14-rt/lib/asan_cxx/ya.make @@ -15,8 +15,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - ADDINCL( contrib/libs/clang14-rt/lib ) diff --git a/contrib/libs/clang14-rt/lib/asan_static/ya.make b/contrib/libs/clang14-rt/lib/asan_static/ya.make index f721a6a6e3..6339dbec82 100644 --- a/contrib/libs/clang14-rt/lib/asan_static/ya.make +++ b/contrib/libs/clang14-rt/lib/asan_static/ya.make @@ -15,8 +15,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - ADDINCL( contrib/libs/clang14-rt/lib ) diff --git a/contrib/libs/clang14-rt/lib/msan/ya.make b/contrib/libs/clang14-rt/lib/msan/ya.make index 67938fa41c..25dfe3000e 100644 --- a/contrib/libs/clang14-rt/lib/msan/ya.make +++ b/contrib/libs/clang14-rt/lib/msan/ya.make @@ -15,8 +15,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - ADDINCL( contrib/libs/clang14-rt/lib ) diff --git a/contrib/libs/clang14-rt/lib/msan_cxx/ya.make b/contrib/libs/clang14-rt/lib/msan_cxx/ya.make index af50884296..ef8af1073f 100644 --- a/contrib/libs/clang14-rt/lib/msan_cxx/ya.make +++ b/contrib/libs/clang14-rt/lib/msan_cxx/ya.make @@ -15,8 +15,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - ADDINCL( contrib/libs/clang14-rt/lib ) diff --git a/contrib/libs/clang14-rt/lib/tsan/ya.make b/contrib/libs/clang14-rt/lib/tsan/ya.make index 488aa06f7a..f999fab576 100644 --- a/contrib/libs/clang14-rt/lib/tsan/ya.make +++ b/contrib/libs/clang14-rt/lib/tsan/ya.make @@ -15,8 +15,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - ADDINCL( contrib/libs/clang14-rt/lib ) diff --git a/contrib/libs/clang14-rt/lib/tsan_cxx/ya.make b/contrib/libs/clang14-rt/lib/tsan_cxx/ya.make index 362b60067c..d34ca6e440 100644 --- a/contrib/libs/clang14-rt/lib/tsan_cxx/ya.make +++ b/contrib/libs/clang14-rt/lib/tsan_cxx/ya.make @@ -15,8 +15,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - ADDINCL( contrib/libs/clang14-rt/lib ) diff --git a/contrib/libs/clang18-rt/lib/asan/ya.make b/contrib/libs/clang18-rt/lib/asan/ya.make index df9c2230d8..b73b1c8081 100644 --- a/contrib/libs/clang18-rt/lib/asan/ya.make +++ b/contrib/libs/clang18-rt/lib/asan/ya.make @@ -13,8 +13,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - VERSION(18.1.8) ADDINCL( diff --git a/contrib/libs/clang18-rt/lib/asan_cxx/ya.make b/contrib/libs/clang18-rt/lib/asan_cxx/ya.make index c3905d6faf..08e0825cf1 100644 --- a/contrib/libs/clang18-rt/lib/asan_cxx/ya.make +++ b/contrib/libs/clang18-rt/lib/asan_cxx/ya.make @@ -13,8 +13,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - VERSION(18.1.8) ADDINCL( diff --git a/contrib/libs/clang18-rt/lib/asan_static/ya.make b/contrib/libs/clang18-rt/lib/asan_static/ya.make index 89daf049d9..6187b6e8a7 100644 --- a/contrib/libs/clang18-rt/lib/asan_static/ya.make +++ b/contrib/libs/clang18-rt/lib/asan_static/ya.make @@ -13,8 +13,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - VERSION(18.1.8) ADDINCL( diff --git a/contrib/libs/clang18-rt/lib/msan/ya.make b/contrib/libs/clang18-rt/lib/msan/ya.make index 8089773feb..54b50bfca3 100644 --- a/contrib/libs/clang18-rt/lib/msan/ya.make +++ b/contrib/libs/clang18-rt/lib/msan/ya.make @@ -13,8 +13,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - VERSION(18.1.8) ADDINCL( diff --git a/contrib/libs/clang18-rt/lib/msan_cxx/ya.make b/contrib/libs/clang18-rt/lib/msan_cxx/ya.make index bc9beb80ec..06bbcad52a 100644 --- a/contrib/libs/clang18-rt/lib/msan_cxx/ya.make +++ b/contrib/libs/clang18-rt/lib/msan_cxx/ya.make @@ -13,8 +13,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - VERSION(18.1.8) ADDINCL( diff --git a/contrib/libs/clang18-rt/lib/profile/ya.make b/contrib/libs/clang18-rt/lib/profile/ya.make index 63ecb24214..685644c680 100644 --- a/contrib/libs/clang18-rt/lib/profile/ya.make +++ b/contrib/libs/clang18-rt/lib/profile/ya.make @@ -13,8 +13,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - VERSION(18.1.8) ADDINCL( diff --git a/contrib/libs/clang18-rt/lib/tsan/ya.make b/contrib/libs/clang18-rt/lib/tsan/ya.make index 92ce585bec..6900ab5302 100644 --- a/contrib/libs/clang18-rt/lib/tsan/ya.make +++ b/contrib/libs/clang18-rt/lib/tsan/ya.make @@ -13,8 +13,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - VERSION(18.1.8) ADDINCL( diff --git a/contrib/libs/clang18-rt/lib/tsan_cxx/ya.make b/contrib/libs/clang18-rt/lib/tsan_cxx/ya.make index a752c10fb4..6739560227 100644 --- a/contrib/libs/clang18-rt/lib/tsan_cxx/ya.make +++ b/contrib/libs/clang18-rt/lib/tsan_cxx/ya.make @@ -13,8 +13,6 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -SUBSCRIBER(g:cpp-contrib) - VERSION(18.1.8) ADDINCL( diff --git a/contrib/libs/cxxsupp/libsan/ya.make b/contrib/libs/cxxsupp/libsan/ya.make index e770d0ac3d..016fa270d2 100644 --- a/contrib/libs/cxxsupp/libsan/ya.make +++ b/contrib/libs/cxxsupp/libsan/ya.make @@ -12,8 +12,6 @@ NO_SANITIZE() NO_SANITIZE_COVERAGE() -SUBSCRIBER(somov) - RUN_PYTHON3( generate_symbolizer.py ${CXX_COMPILER} STDOUT symbolizer.c diff --git a/library/cpp/sanitizer/address/static/ya.make b/library/cpp/sanitizer/address/static/ya.make index d8cf24a848..7210cbced9 100644 --- a/library/cpp/sanitizer/address/static/ya.make +++ b/library/cpp/sanitizer/address/static/ya.make @@ -1,7 +1,5 @@ LIBRARY() -SUBSCRIBER(g:devtools-contrib) - NO_UTIL() PEERDIR( diff --git a/library/cpp/sanitizer/memory/static/ya.make b/library/cpp/sanitizer/memory/static/ya.make index ab10fb9c88..0955ec62d8 100644 --- a/library/cpp/sanitizer/memory/static/ya.make +++ b/library/cpp/sanitizer/memory/static/ya.make @@ -1,7 +1,5 @@ LIBRARY() -SUBSCRIBER(g:devtools-contrib) - NO_UTIL() PEERDIR( diff --git a/library/cpp/sanitizer/thread/static/ya.make b/library/cpp/sanitizer/thread/static/ya.make index 0a09b0098c..7cbd7b9fd5 100644 --- a/library/cpp/sanitizer/thread/static/ya.make +++ b/library/cpp/sanitizer/thread/static/ya.make @@ -1,7 +1,5 @@ LIBRARY() -SUBSCRIBER(g:devtools-contrib) - NO_UTIL() PEERDIR( diff --git a/library/cpp/testing/dump_clang_coverage/write_profile_data.cpp b/library/cpp/testing/dump_clang_coverage/write_profile_data.cpp new file mode 100644 index 0000000000..8b13474cc8 --- /dev/null +++ b/library/cpp/testing/dump_clang_coverage/write_profile_data.cpp @@ -0,0 +1,125 @@ +#include <dlfcn.h> +#include <linux/limits.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +extern "C" { + void __llvm_profile_initialize_file(void); + int __llvm_profile_write_file(void); + void __llvm_profile_set_filename(const char* filename_pattern); + + // there might no llmv rt, for example for the targets from contrib + __attribute__((weak)) int __llvm_profile_write_file(void) { + return 0; + } + __attribute__((weak)) void __llvm_profile_initialize_file(void) { + } + __attribute__((weak)) void __llvm_profile_set_filename(const char*) { + } +} + +namespace { + void dummy() { + } +} + +bool getSoName(char* buff, size_t size) { + // returns so name for shared objects and exe_name for binaries + Dl_info dl_info = {0, 0, 0, 0}; + if (dladdr((void*)(intptr_t)dummy, &dl_info) != 0) { + if (dl_info.dli_fname) { + const char* name = dl_info.dli_fname; + char real_path[PATH_MAX]; + const char* resolved = realpath(name, real_path); + if (resolved != NULL) + name = real_path; + const char* lastSlash = strrchr(name, '/'); + if (!!lastSlash) { + name = lastSlash + 1; + } + strncpy(buff, name, size); + return true; + } + } + return false; +} + +bool getExeName(char* buff, size_t size) { + ssize_t len = readlink("/proc/self/exe", buff, size); + if (len <= 0) { + return false; + } + + buff[len] = '\0'; + char* lastSlash = strrchr(buff, '/'); + if (!!lastSlash) { + strncpy(buff, lastSlash + 1, size); + buff[(buff + len) - lastSlash] = '\0'; + } + return true; +} + +bool getSelfName(char* buff, size_t size) { +#if defined(_musl_) + return getExeName(buff, size); +#else + return getSoName(buff, size); +#endif +} + +void replaceFirst(char* data, size_t dsize, const char* pat, size_t psize, const char* repl, size_t rsize) { + char* patPtr = strstr(data, pat); + if (!patPtr) { + return; + } + + char tmp[PATH_MAX] = {0}; + char* tmpPtr = &tmp[0]; + + strcpy(tmpPtr, patPtr + psize); + strcpy(patPtr, repl); + strcpy(patPtr + rsize, tmpPtr); + data[dsize - psize + rsize] = '\0'; +} + +// Adds support of the specifier '%e' (executable filename (without path prefix)) to the LLVM_PROFILE_FILE +void parseAndSetFilename() { + const char* profile_file = getenv("LLVM_PROFILE_FILE"); + if (!profile_file) + return; + + // __llvm_profile_set_filename doesn't copy name, so it must remain valid + static char pattern[PATH_MAX] = {0}; + char* patternPtr = &pattern[0]; + + strncpy(patternPtr, profile_file, PATH_MAX - 1); + + if (!!strstr(patternPtr, "%e")) { + char buff[PATH_MAX] = {0}; + char* buffPtr = &buff[0]; + + if (getSelfName(buffPtr, PATH_MAX)) { + size_t patternSize = strlen(patternPtr); + size_t buffSize = strlen(buffPtr); + + if (patternSize + buffSize >= PATH_MAX) { + abort(); + } + replaceFirst(patternPtr, patternSize, "%e", 2, buffPtr, buffSize); + } + } + + __llvm_profile_set_filename(patternPtr); +} + +void __attribute__((constructor)) premain() { + parseAndSetFilename(); + if (getenv("YA_COVERAGE_DUMP_PROFILE_AND_EXIT")) { + __llvm_profile_initialize_file(); + int rc = __llvm_profile_write_file(); + if (!rc && getenv("YA_COVERAGE_DUMP_PROFILE_EXIT_CODE")) + rc = atoi(getenv("YA_COVERAGE_DUMP_PROFILE_EXIT_CODE")); + exit(rc); + } +} diff --git a/library/cpp/testing/dump_clang_coverage/ya.make b/library/cpp/testing/dump_clang_coverage/ya.make new file mode 100644 index 0000000000..26eb36048c --- /dev/null +++ b/library/cpp/testing/dump_clang_coverage/ya.make @@ -0,0 +1,13 @@ +LIBRARY() + +NO_CLANG_COVERAGE() + +NO_RUNTIME() + +IF (OS_LINUX) + SRCS( + GLOBAL write_profile_data.cpp + ) +ENDIF() + +END() |