diff --git a/rust-build/build.sh b/rust-build/build.sh index ce22fa54a449f4f0cbefdbe0d10751bcd57d7043..20c9bb4d814cfcf12198dfa60fa591c6c03f8896 100644 --- a/rust-build/build.sh +++ b/rust-build/build.sh @@ -56,7 +56,10 @@ if [ "${host_platform}" = "linux" ] && [ ${host_cpu} = "x86_64" ]; then cp ${shell_path}/config.toml ${rust_source_dir} chmod 750 ${shell_path}/tools/* cp ${shell_path}/tools/* ${rust_source_dir}/build/ - update_config_toml_clang ${rust_tools}/clang/ohos/linux-x86_64/llvm/bin clang llvm-ar + update_config_toml_clang ${rust_tools}/ohos-sdk/linux/12/native/llvm/bin clang llvm-ar + update_config_toml_clang ${rust_tools}/ohos-sdk/linux/12/native/llvm/bin aarch64-unknown-linux-ohos-clang llvm-ar + update_config_toml_clang ${rust_tools}/ohos-sdk/linux/12/native/llvm/bin armv7-unknown-linux-ohos-clang llvm-ar + update_config_toml_clang ${rust_tools}/ohos-sdk/linux/12/native/llvm/bin x86_64-unknown-linux-ohos-clang llvm-ar update_config_toml_clang ${rust_tools}/mingw-w64/ohos/linux-x86_64/clang-mingw/bin x86_64-w64-mingw32-clang x86_64-w64-mingw32-ar elif [ "${host_platform}" = "darwin" ] && [ ${host_cpu} = "x86_64" ]; then curl -O -k -m 300 ${rust_down_net}/2023-07-13/rustc-1.71.0-x86_64-apple-darwin.tar.xz @@ -72,7 +75,7 @@ else echo "Unsupported platform: $(uname -s) $(uname -m)" fi -mv ${rust_down_dir}/*.tar.xz ${rust_source_dir}/build/cache/2023-07-13/ +cp ${rust_down_dir}/*.tar.xz ${rust_source_dir}/build/cache/2023-07-13/ curl -O -k -m 300 ${rust_down_net}/rustc-1.72.0-src.tar.gz tar xf rustc-1.72.0-src.tar.gz diff --git a/rust-build/config.toml b/rust-build/config.toml index ecf3b24f2b404b377ffa5fdff05767a4b4fe912c..ee846c59b1559dbb99a9aca66b9cb8466b4ec2d7 100644 --- a/rust-build/config.toml +++ b/rust-build/config.toml @@ -4,9 +4,11 @@ changelog-seen = 2 [llvm] download-ci-llvm = false targets = "X86;AArch64;ARM" +cflags = "-fstack-protector-all" +cxxflags = "-fstack-protector-all" [build] -target = ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-gnullvm"] +target = ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-gnullvm", "armv7-unknown-linux-ohos", "x86_64-unknown-linux-ohos", "aarch64-unknown-linux-ohos"] submodules = false compiler-docs = false extended = true @@ -16,8 +18,8 @@ tools = [ docs = false vendor = true #verbose = 1 -#sanitizers = true -#profiler = true +sanitizers = true +profiler = true [rust] optimize = true @@ -27,8 +29,8 @@ lto = "thin-local" backtrace = false description = "xxxxx" channel = "nightly" -#strip = true -#stack-protector = "all" +strip = true +stack-protector = "strong" [install] bindir = "bin" @@ -38,7 +40,25 @@ libdir = "lib" cc = "clang" cxx = "clang++" linker = "clang" -ar = "ar" +ar = "llvm-ar" + +[target.aarch64-unknown-linux-ohos] +cc = "aarch64-unknown-linux-ohos-clang" +cxx = "aarch64-unknown-linux-ohos-clang++" +linker = "aarch64-unknown-linux-ohos-clang" +ar = "llvm-ar" + +[target.armv7-unknown-linux-ohos] +cc = "armv7-unknown-linux-ohos-clang" +cxx = "armv7-unknown-linux-ohos-clang++" +linker = "armv7-unknown-linux-ohos-clang" +ar = "llvm-ar" + +[target.x86_64-unknown-linux-ohos] +cc = "x86_64-unknown-linux-ohos-clang" +cxx = "x86_64-unknown-linux-ohos-clang++" +linker = "x86_64-unknown-linux-ohos-clang" +ar = "llvm-ar" [target.x86_64-pc-windows-gnullvm] cc = "x86_64-w64-mingw32-clang" diff --git a/rust-build/tools/aarch64-unknown-linux-ohos-clang b/rust-build/tools/aarch64-unknown-linux-ohos-clang new file mode 100644 index 0000000000000000000000000000000000000000..659e8d4e4e4e59a2e9d39830b6a6a589665847c0 --- /dev/null +++ b/rust-build/tools/aarch64-unknown-linux-ohos-clang @@ -0,0 +1,3 @@ +#!/bin/bash + +exec aarch64-unknown-linux-ohos-clang -fstack-protector-all "$@" \ No newline at end of file diff --git a/rust-build/tools/aarch64-unknown-linux-ohos-clang++ b/rust-build/tools/aarch64-unknown-linux-ohos-clang++ new file mode 100644 index 0000000000000000000000000000000000000000..f00223abbf031ad3a2e62e9f7e15441c73f25aa6 --- /dev/null +++ b/rust-build/tools/aarch64-unknown-linux-ohos-clang++ @@ -0,0 +1,3 @@ +#!/bin/bash + +exec aarch64-unknown-linux-ohos-clang++ -fstack-protector-all "$@" \ No newline at end of file diff --git a/rust-build/tools/armv7-unknown-linux-ohos-clang b/rust-build/tools/armv7-unknown-linux-ohos-clang new file mode 100644 index 0000000000000000000000000000000000000000..5bea12197124a3c9c15cd057c4e500c764aed827 --- /dev/null +++ b/rust-build/tools/armv7-unknown-linux-ohos-clang @@ -0,0 +1,3 @@ +#!/bin/bash + +exec armv7-unknown-linux-ohos-clang -fstack-protector-all "$@" \ No newline at end of file diff --git a/rust-build/tools/armv7-unknown-linux-ohos-clang++ b/rust-build/tools/armv7-unknown-linux-ohos-clang++ new file mode 100644 index 0000000000000000000000000000000000000000..f44064a0b798a92015354a97fde5c75b2512c5cd --- /dev/null +++ b/rust-build/tools/armv7-unknown-linux-ohos-clang++ @@ -0,0 +1,3 @@ +#!/bin/bash + +exec armv7-unknown-linux-ohos-clang++ -fstack-protector-all "$@" \ No newline at end of file diff --git a/rust-build/tools/x86_64-unknown-linux-ohos-clang b/rust-build/tools/x86_64-unknown-linux-ohos-clang new file mode 100644 index 0000000000000000000000000000000000000000..d9fd8a39a6e59c15d40587d497df69ed76156fd7 --- /dev/null +++ b/rust-build/tools/x86_64-unknown-linux-ohos-clang @@ -0,0 +1,3 @@ +#!/bin/bash + +exec x86_64-unknown-linux-ohos-clang -fstack-protector-all "$@" \ No newline at end of file diff --git a/rust-build/tools/x86_64-unknown-linux-ohos-clang++ b/rust-build/tools/x86_64-unknown-linux-ohos-clang++ new file mode 100644 index 0000000000000000000000000000000000000000..dc6aabe137fd25aaac1fb48967bfb0d50c914fa6 --- /dev/null +++ b/rust-build/tools/x86_64-unknown-linux-ohos-clang++ @@ -0,0 +1,3 @@ +#!/bin/bash + +exec x86_64-unknown-linux-ohos-clang++ -fstack-protector-all "$@" \ No newline at end of file