diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index a631ae4e86c334d605340753a17b03fdad8eba8b..e6d87421254364ca708d4ab84fa39e6aabfa1730 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -829,7 +829,7 @@ else() endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND XRAY_SUPPORTED_ARCH AND - OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|Fuchsia") + OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|Fuchsia|OHOS") set(COMPILER_RT_HAS_XRAY TRUE) else() set(COMPILER_RT_HAS_XRAY FALSE) diff --git a/llvm-build/README.md b/llvm-build/README.md index 29a1dd13d22e4cdedcf486fd8d6ba6d61a82d54a..c6cec3fd422b23929a7470b5273c9c1ab3425a48 100644 --- a/llvm-build/README.md +++ b/llvm-build/README.md @@ -70,6 +70,7 @@ build.py options: linux check-api --build-clean # delete out folder after build packages +--build-xray # build llvm with XRay ```
diff --git a/llvm-build/build.py b/llvm-build/build.py index cb1d56478279538e962b0d24fb169c24ba2ef049..c4d04b455f59f042e6bfece00c98c057b994c138 100755 --- a/llvm-build/build.py +++ b/llvm-build/build.py @@ -45,6 +45,7 @@ class BuildConfig(): self.xunit_xml_output = args.xunit_xml_output self.enable_assertions = args.enable_assertions self.build_clean = args.build_clean + self.build_xray = args.build_xray self.need_libs = self.do_build and 'libs' not in args.no_build self.need_lldb_server = self.do_build and 'lldb-server' not in args.no_build self.build_python = args.build_python @@ -192,6 +193,12 @@ class BuildConfig(): default=False, help='Build libedit tool for Linux, Mac x86-64 or M1') + parser.add_argument( + '--build-xray', + action='store_true', + default=False, + help='Build llvm with XRay') + def parse_args(self): parser = argparse.ArgumentParser(description='Process some integers.') @@ -429,7 +436,7 @@ class BuildUtils(object): defines['Python3_LIBRARIES'] = os.path.join(self.get_python_dir(), 'lib', 'libpython%s.so' % self.build_config.LLDB_PY_VERSION) - defines['COMPILER_RT_BUILD_XRAY'] = 'OFF' + defines['COMPILER_RT_BUILD_XRAY'] = 'ON' if self.build_config.build_xray else 'OFF' return defines def get_python_dir(self): @@ -1156,6 +1163,8 @@ class LlvmLibs(BuildUtils): crt_defines['COMPILER_RT_HWASAN_WITH_INTERCEPTORS'] = 'OFF' crt_defines['COMPILER_RT_BUILD_SANITIZERS'] = \ 'OFF' if llvm_triple == self.liteos_triple('arm') or first_time else 'ON' + crt_defines['COMPILER_RT_BUILD_XRAY'] = \ + 'ON' if self.build_config.build_xray and arch in ['x86_64', 'aarch64'] and not first_time else 'OFF' crt_defines['COMPILER_RT_DEFAULT_TARGET_TRIPLE'] = llvm_triple crt_cmake_path = os.path.abspath(os.path.join(self.build_config.LLVM_PROJECT_DIR, 'compiler-rt')) self.rm_cmake_cache(crt_path)