From b6da6abe6b898547908f8b304a4234e109a956db Mon Sep 17 00:00:00 2001 From: liujia178 Date: Fri, 7 Jul 2023 10:19:49 +0800 Subject: [PATCH] [BUILD] Reform ohos llvm build process (Fortify_Source) Issue: https://gitee.com/openharmony/third_party_llvm-project/issues/I7F4C3 Signed-off-by: liujia178 Change-Id: Icb0549ab922afb001705893bf9e1abfbe93a5f14 --- llvm-build/README.md | 2 ++ llvm-build/build.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/llvm-build/README.md b/llvm-build/README.md index f7be8cf15d39..689ae00beda2 100644 --- a/llvm-build/README.md +++ b/llvm-build/README.md @@ -75,6 +75,8 @@ When build successfully completed. following artifacts will be available in `out `sysroot` -> sysroots for OHOS targets `install` -> toolchain build + +following artifacts will be available in `packages` directory `*.tar.bz2` -> archived versions of toolchain and sysroots
diff --git a/llvm-build/build.py b/llvm-build/build.py index c751738e5dbd..dd62bc0f36d8 100755 --- a/llvm-build/build.py +++ b/llvm-build/build.py @@ -597,6 +597,7 @@ class LlvmCore(BuildUtils): cflags = '-fstack-protector-strong' if not self.host_is_darwin(): ldflags += ' -Wl,-z,relro,-z,now -pie' + cflags += ' -D_FORTIFY_SOURCE=2' if self.build_config.strip: ldflags += ' -s' @@ -894,6 +895,7 @@ class LlvmLibs(BuildUtils): '--target=%s' % llvm_triple, '-ffunction-sections', '-fdata-sections', + '-D_FORTIFY_SOURCE=2', extra_flags, ] cflags.extend(cflag) -- Gitee