[compiler-rt] Fix compile error on ohos (PR #118193)

via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 30 19:55:17 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Peng Huang (phuang)

<details>
<summary>Changes</summary>

OHOS uses musl libc which doesn't have get_current_dir_name(). Removing get_current_dir_name related dfsw and dfso methods to fix the problem.

---
Full diff: https://github.com/llvm/llvm-project/pull/118193.diff


1 Files Affected:

- (modified) compiler-rt/lib/dfsan/dfsan_custom.cpp (+3) 


``````````diff
diff --git a/compiler-rt/lib/dfsan/dfsan_custom.cpp b/compiler-rt/lib/dfsan/dfsan_custom.cpp
index dbc00d7ac3ea39..29800479d20e66 100644
--- a/compiler-rt/lib/dfsan/dfsan_custom.cpp
+++ b/compiler-rt/lib/dfsan/dfsan_custom.cpp
@@ -1077,6 +1077,8 @@ char *__dfso_getcwd(char *buf, size_t size, dfsan_label buf_label,
   return ret;
 }
 
+#if !defined(__OHOS__)
+// OpenHOS uses musl libc which doesn't have get_current_dir_name()
 SANITIZER_INTERFACE_ATTRIBUTE
 char *__dfsw_get_current_dir_name(dfsan_label *ret_label) {
   char *ret = get_current_dir_name();
@@ -1091,6 +1093,7 @@ char *__dfso_get_current_dir_name(dfsan_label *ret_label,
                                   dfsan_origin *ret_origin) {
   return __dfsw_get_current_dir_name(ret_label);
 }
+#endif
 
 // This function is only available for glibc 2.25 or newer.  Mark it weak so
 // linking succeeds with older glibcs.

``````````

</details>


https://github.com/llvm/llvm-project/pull/118193


More information about the llvm-commits mailing list