From 867e458adff154e12f99116cd981a9a36b1d258b Mon Sep 17 00:00:00 2001 From: Peng Huang 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 dbc00d7ac3ea3..caacb424ef575 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.