From 6d88732cb52b5076df6c6dd4c8e9baca95d5e93a Mon Sep 17 00:00:00 2001 From: guzhihao4 Date: Sun, 7 Apr 2024 07:39:14 +0000 Subject: [PATCH 1/2] [OHOS][Sanitizer] Add log end in sanitizers Description: Add log end strings in all sanitizers so that hiview can identify it and write to file. Issue: https://gitee.com/openharmony/third_party_llvm-project/issues/I9EIO3 Test: All sanitizer log write to hiview log Signed-off-by: guzhihao4 Change-Id: Iad0f02fbad792e248284f3e0ac52f356dee965b8 --- compiler-rt/lib/asan/asan_report.cpp | 1 + compiler-rt/lib/asan/asan_rtl.cpp | 1 + compiler-rt/lib/hwasan/hwasan_report.cpp | 1 + compiler-rt/lib/tsan/rtl/tsan_report.cpp | 1 + compiler-rt/lib/tsan/rtl/tsan_rtl.cpp | 1 + compiler-rt/lib/ubsan/ubsan_handlers.cpp | 1 + compiler-rt/lib/ubsan/ubsan_init.cpp | 1 + 7 files changed, 7 insertions(+) diff --git a/compiler-rt/lib/asan/asan_report.cpp b/compiler-rt/lib/asan/asan_report.cpp index 2a55d6c0978d..8ba48c51df63 100644 --- a/compiler-rt/lib/asan/asan_report.cpp +++ b/compiler-rt/lib/asan/asan_report.cpp @@ -191,6 +191,7 @@ class ScopedInErrorReport { Report("ABORTING\n"); Die(); } + Report("End Asan report\n"); // OHOS_LOCAL } void ReportError(const ErrorDescription &description) { diff --git a/compiler-rt/lib/asan/asan_rtl.cpp b/compiler-rt/lib/asan/asan_rtl.cpp index 686834063149..cbbdcf7914b0 100644 --- a/compiler-rt/lib/asan/asan_rtl.cpp +++ b/compiler-rt/lib/asan/asan_rtl.cpp @@ -63,6 +63,7 @@ static void AsanDie() { UnmapOrDie((void*)kLowShadowBeg, kHighShadowEnd - kLowShadowBeg); } } + Report("End Asan report (AsanDie)\n"); // OHOS_LOCAL } static void CheckUnwind() { diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp index 66d3d155d409..a59d5fef9791 100644 --- a/compiler-rt/lib/hwasan/hwasan_report.cpp +++ b/compiler-rt/lib/hwasan/hwasan_report.cpp @@ -56,6 +56,7 @@ class ScopedReport { if (common_flags()->print_module_map >= 2 || (fatal && common_flags()->print_module_map)) DumpProcessMap(); + Report("End Hwasan report\n"); // OHOS_LOCAL if (fatal) Die(); } diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.cpp b/compiler-rt/lib/tsan/rtl/tsan_report.cpp index 3b0bddc33a43..b5481eb8b340 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_report.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_report.cpp @@ -469,6 +469,7 @@ void PrintReport(const ReportDesc *rep) { } } Printf("==================\n"); + Report("End Tsan report\n"); // OHOS_LOCAL } #endif diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp index ff3bb33eb134..5b4c7a0e4bdb 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp @@ -796,6 +796,7 @@ int Finalize(ThreadState *thr) { PrintMatchedSuppressions(); failed = OnFinalize(failed); + Report("End Tsan report (Finalize)\n"); // OHOS_LOCAL return failed ? common_flags()->exitcode : 0; } diff --git a/compiler-rt/lib/ubsan/ubsan_handlers.cpp b/compiler-rt/lib/ubsan/ubsan_handlers.cpp index e201e6bba220..faafa92423bd 100644 --- a/compiler-rt/lib/ubsan/ubsan_handlers.cpp +++ b/compiler-rt/lib/ubsan/ubsan_handlers.cpp @@ -902,6 +902,7 @@ void __ubsan::__ubsan_handle_cfi_check_fail(CFICheckFailData *Data, handleCFIBadIcall(Data, Value, Opts); else __ubsan_handle_cfi_bad_type(Data, Value, ValidVtable, Opts); + Report("End CFI report\n"); // OHOS_LOCAL } void __ubsan::__ubsan_handle_cfi_check_fail_abort(CFICheckFailData *Data, diff --git a/compiler-rt/lib/ubsan/ubsan_init.cpp b/compiler-rt/lib/ubsan/ubsan_init.cpp index 01080567331e..54ff2b450519 100644 --- a/compiler-rt/lib/ubsan/ubsan_init.cpp +++ b/compiler-rt/lib/ubsan/ubsan_init.cpp @@ -37,6 +37,7 @@ static void CommonInit() { static void UbsanDie() { if (common_flags()->print_module_map >= 1) DumpProcessMap(); + Report("End CFI report (UbsanDie)\n"); // OHOS_LOCAL } static void CommonStandaloneInit() { -- Gitee From 56036e28b28f5b7cd23a41779120efb870189eb9 Mon Sep 17 00:00:00 2001 From: xwx1135370 Date: Fri, 19 Apr 2024 14:06:17 +0800 Subject: [PATCH 2/2] fixed 7719940 from https://gitee.com/xwx1135370/third_party_llvm-project/pulls/464 [LLDB][Mac] liblzma.dylib not loaded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit issue:https://gitee.com/openharmony/third_party_llvm-project/issues/I9HYZF?from=project-issue Test: Toolchain Compilation and LLDB Tool test Signed-off-by: xwx1135370 --- llvm-build/MakeLiblzma | 6 +++--- llvm-build/build.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm-build/MakeLiblzma b/llvm-build/MakeLiblzma index b78b86f3496b..d3ba203c4370 100644 --- a/llvm-build/MakeLiblzma +++ b/llvm-build/MakeLiblzma @@ -31,9 +31,9 @@ TARGET_A := liblzma.dll.a else ifeq ($(findstring darwin,$(TARGET_TRIPLE)),darwin) SDKROOT := $(shell xcrun --sdk macosx --show-sdk-path) -CFLAGS := -D_7ZIP_ST -Wall -Werror -Wno-empty-body -Wno-enum-conversion -Wno-logical-op-parentheses -Wno-self-assign -fPIC -LDFLAGS := -dynamiclib -fuse-ld=lld -Wl,-syslibroot,$(SDKROOT) -install_name @rpath/liblzma.dylib -TARGET := liblzma.dylib +CFLAGS := -D_7ZIP_ST -Wall -Werror -Wno-empty-body -Wno-enum-conversion -Wno-logical-op-parentheses -Wno-self-assign -fPIC -current_version 22.0 -compatibility_version 22.0 +LDFLAGS := -dynamiclib -fuse-ld=lld -Wl,-syslibroot,$(SDKROOT) -install_name @rpath/liblzma.22.0.dylib +TARGET := liblzma.22.0.dylib else $(warning *** warning: TARGET_TRIPLE $(TARGET_TRIPLE) has not been set in rights) endif diff --git a/llvm-build/build.py b/llvm-build/build.py index 92b11a801b6b..9daf1c4af43f 100755 --- a/llvm-build/build.py +++ b/llvm-build/build.py @@ -672,7 +672,7 @@ class LlvmCore(BuildUtils): llvm_defines['PANEL_LIBRARIES'] = ncurses_libs if self.build_config.enable_lzma_7zip: - llvm_defines['LIBLZMA_LIBRARIES'] = self.merge_out_path('lzma', 'lib', self.use_platform(), 'liblzma.dylib') + llvm_defines['LIBLZMA_LIBRARIES'] = self.merge_out_path('lzma', 'lib', self.use_platform(), 'liblzma.22.0.dylib') if self.build_config.build_libedit: llvm_defines['LibEdit_LIBRARIES'] = os.path.join(self.get_prebuilts_dir('libedit'), 'lib', 'libedit.0.dylib') @@ -1791,7 +1791,7 @@ class LlvmLibs(BuildUtils): self.check_call(cmd) if self.host_is_darwin(): - shlib_ext = '.dylib' + shlib_ext = '.22.0.dylib' if self.host_is_linux(): shlib_ext = '.so' lzma_file = os.path.join(liblzma_build_path, 'lib', target_triple, 'liblzma' + shlib_ext) -- Gitee