[compiler-rt] Fix compile error on ohos (PR #118193)
Peng Huang via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 1 17:52:35 PST 2025
https://github.com/phuang updated https://github.com/llvm/llvm-project/pull/118193
>From 867e458adff154e12f99116cd981a9a36b1d258b Mon Sep 17 00:00:00 2001
From: Peng Huang <shawn.p.huang at gmail.com>
Date: Sat, 30 Nov 2024 22:51:59 -0500
Subject: [PATCH] Fix compile error on ohos
OpenHarmony's libc doesn't have get_current_dir_name(), So guard
get_current_dir_name() related dfsw and dfso methods with #ifndef
__OHOS__.
---
compiler-rt/lib/dfsan/dfsan_custom.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/compiler-rt/lib/dfsan/dfsan_custom.cpp b/compiler-rt/lib/dfsan/dfsan_custom.cpp
index dbc00d7ac3ea39..caacb424ef575d 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;
}
+#ifndef __OHOS__
+// OpenHarmonyOS 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 // __OHOS__
// This function is only available for glibc 2.25 or newer. Mark it weak so
// linking succeeds with older glibcs.
More information about the llvm-commits
mailing list