mirror of
https://github.com/openharmony/third_party_rust_rust.git
synced 2026-07-19 11:43:39 -04:00
@@ -27,4 +27,4 @@ pub fn target() -> Target {
|
||||
arch: "x86_64".into(),
|
||||
options: base,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,8 +690,6 @@ impl OsStr {
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(os_str_bytes)]
|
||||
///
|
||||
/// use std::ffi::OsStr;
|
||||
///
|
||||
/// let os_str = OsStr::new("Mary had a little lamb");
|
||||
@@ -821,7 +819,7 @@ impl OsStr {
|
||||
}
|
||||
|
||||
/// Converts an OS string slice to a byte slice. To convert the byte slice back into an OS
|
||||
/// string slice, use the [`OsStr::from_encoded_bytes_unchecked`] function.
|
||||
/// string slice.
|
||||
///
|
||||
/// The byte encoding is an unspecified, platform-specific, self-synchronizing superset of UTF-8.
|
||||
/// By being a self-synchronizing superset of UTF-8, this encoding is also a superset of 7-bit
|
||||
@@ -834,7 +832,6 @@ impl OsStr {
|
||||
/// and [`std::ffi`] for platform-specific, specified conversions.
|
||||
///
|
||||
/// [`std::ffi`]: crate::ffi
|
||||
#[cfg(windows)]
|
||||
#[inline]
|
||||
#[stable(feature = "os_str_bytes", since = "1.71.0")]
|
||||
pub fn as_encoded_bytes(&self) -> &[u8] {
|
||||
|
||||
@@ -192,6 +192,11 @@ impl Buf {
|
||||
}
|
||||
|
||||
impl Slice {
|
||||
#[inline]
|
||||
pub fn as_encoded_bytes(&self) -> &[u8] {
|
||||
&self.inner
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn as_os_str_bytes(&self) -> &[u8] {
|
||||
&self.inner
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
tests/ui/allocator/no_std-alloc-error-handler-custom.rs
|
||||
tests/ui/allocator/no_std-alloc-error-handler-default.rs
|
||||
tests/ui/async-await/issue-86507.rs
|
||||
tests/ui/async-await/issues/issue-62009-1.rs
|
||||
tests/ui/closure_context/issue-26046-fn-mut.rs
|
||||
tests/ui/closure_context/issue-26046-fn-once.rs
|
||||
tests/ui/confuse-field-and-method/issue-18343.rs
|
||||
tests/ui/confuse-field-and-method/issue-33784.rs
|
||||
tests/ui/confuse-field-and-method/issue-2392.rs
|
||||
tests/ui/extern-flag/force-extern.rs
|
||||
tests/ui/extern-flag/no-force-extern.rs
|
||||
tests/ui/extern-flag/redundant-force-extern.rs
|
||||
tests/ui/higher-ranked/trait-bounds/issue-30786.rs
|
||||
tests/ui/impl-trait/nested-return-type2-tait2.rs
|
||||
tests/ui/functions-closures/fn-help-with-err.rs
|
||||
tests/ui/impl-trait/nested-return-type2-tait3.rs
|
||||
tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.rs
|
||||
tests/ui/impl-trait/issues/issue-86800.rs
|
||||
tests/ui/impl-trait/normalize-tait-in-const.rs
|
||||
tests/ui/issues/issue-21763.rs
|
||||
tests/ui/issues/issue-41880.rs
|
||||
tests/ui/higher-ranked/trait-bounds/future.rs#classic
|
||||
tests/ui/hygiene/panic-location.rs
|
||||
tests/ui/intrinsics/const-eval-select-backtrace-std.rs
|
||||
tests/ui/layout/valid_range_oob.rs
|
||||
tests/ui/intrinsics/const-eval-select-backtrace.rs
|
||||
tests/ui/meta/no_std-extern-libc.rs
|
||||
tests/ui/mismatched_types/issue-36053-2.rs
|
||||
tests/ui/mir/validate/storage-live.rs
|
||||
tests/ui/never_type/fallback-closure-wrap.rs#fallback
|
||||
tests/ui/panics/default-backtrace-ice.rs
|
||||
tests/ui/issues/issue-87707.rs
|
||||
tests/ui/panics/fmt-only-once.rs
|
||||
tests/ui/panics/issue-47429-short-backtraces.rs
|
||||
tests/ui/panics/location-detail-panic-no-column.rs
|
||||
tests/ui/panics/location-detail-panic-no-file.rs
|
||||
tests/ui/panics/location-detail-panic-no-line.rs
|
||||
tests/ui/panics/location-detail-unwrap-no-file.rs
|
||||
tests/ui/panics/location-detail-panic-no-location-info.rs
|
||||
tests/ui/panics/runtime-switch.rs
|
||||
tests/ui/panics/short-ice-remove-middle-frames-2.rs
|
||||
tests/ui/panics/short-ice-remove-middle-frames.rs
|
||||
tests/ui/treat-err-as-bug/delay_span_bug.rs
|
||||
tests/ui/treat-err-as-bug/err.rs
|
||||
tests/ui/typeck/issue-31173.rs
|
||||
tests/ui/typeck/return_type_containing_closure.rs
|
||||
tests/ui/test-attrs/test-thread-capture.rs
|
||||
tests/ui/test-attrs/test-thread-nocapture.rs
|
||||
tests/ui/test-attrs/test-panic-abort-nocapture.rs
|
||||
tests/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.rs
|
||||
tests/ui/test-attrs/test-panic-abort.rs
|
||||
tests/ui/recursion/issue-83150.rs
|
||||
tests/ui/process/multi-panic.rs
|
||||
tests/ui/abi/stack-probes.rs
|
||||
tests/ui/backtrace.rs
|
||||
tests/ui/runtime/backtrace-debuginfo.rs
|
||||
tests/ui/std-backtrace.rs
|
||||
tests/ui/abi/stack-probes-lto.rs
|
||||
tests/rustdoc-ui/issues/issue-98690.rs
|
||||
tests/rustdoc-ui/ice-bug-report-url.rs
|
||||
tests/rustdoc-ui/doctest/failed-doctest-output.rs
|
||||
tests/run-make/short-ice
|
||||
tests/run-make/libtest-json
|
||||
tests/run-make/libtest-junit
|
||||
tests/run-make/inaccessible-temp-dir
|
||||
tests/codegen/issues/issue-114312.rs
|
||||
+67
-4
@@ -16,8 +16,8 @@ detect_platform() {
|
||||
copy_config() {
|
||||
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/
|
||||
chmod 750 ${rust_source_dir}/build/*clang*
|
||||
elif [ "${host_platform}" = "darwin" ]; then
|
||||
if [ "${host_cpu}" = "x86_64" ]; then
|
||||
cp ${shell_path}/mac_x8664_config.toml ${rust_source_dir}/config.toml
|
||||
@@ -74,10 +74,73 @@ move_static_rust_source() {
|
||||
tar xf rustc-1.72.0-src.tar.gz
|
||||
pushd ${1}/rustc-1.72.0-src
|
||||
cp -r {.cargo,vendor} ${2}
|
||||
cp -r library/backtrace/* ${2}/library/backtrace/
|
||||
cp -r library/stdarch/* ${2}/library/stdarch/
|
||||
cp -r src/doc/* ${2}/src/doc/
|
||||
cp -r library/{backtrace,stdarch} ${2}/library/
|
||||
cp -r src/doc/{book,edition-guide,embedded-book,nomicon} ${2}/src/doc/
|
||||
cp -r src/doc/{reference,rust-by-example,rustc-dev-guide} ${2}/src/doc/
|
||||
cp -r src/tools/cargo/* ${2}/src/tools/cargo/
|
||||
popd
|
||||
popd
|
||||
}
|
||||
|
||||
download_rust_static_source() {
|
||||
local pre_rust_date="2023-07-13"
|
||||
mkdir -p ${rust_static_dir} ${rust_source_dir}/build/cache/${pre_rust_date}
|
||||
local rust_down_net="https://mirrors.ustc.edu.cn/rust-static/dist"
|
||||
pushd ${rust_static_dir}
|
||||
local platform=$1
|
||||
local cpu=$2
|
||||
local files=("rust-std-1.71.0-${cpu}-${platform}.tar.xz" "rustc-1.71.0-${cpu}-${platform}.tar.xz" \
|
||||
"cargo-1.71.0-${cpu}-${platform}.tar.xz")
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
if [ ! -e "${file}" ]; then
|
||||
curl -O -k -m 300 ${rust_down_net}/${pre_rust_date}/${file} &
|
||||
fi
|
||||
done
|
||||
if [ ! -e "rustc-1.72.0-src.tar.gz" ]; then
|
||||
curl -O -k -m 300 ${rust_down_net}/rustc-1.72.0-src.tar.gz &
|
||||
fi
|
||||
wait
|
||||
popd
|
||||
cp ${rust_static_dir}/*.tar.xz ${rust_source_dir}/build/cache/${pre_rust_date}/
|
||||
cp ${rust_static_dir}/rustc-1.72.0-src.tar.gz ${root_build_dir}
|
||||
}
|
||||
|
||||
download_rust_at_net() {
|
||||
if [ "${host_platform}" = "linux" ] && [ "${host_cpu}" = "x86_64" ]; then
|
||||
download_rust_static_source "unknown-linux-gnu" "x86_64"
|
||||
elif [ "${host_platform}" = "darwin" ]; then
|
||||
if [ "${host_cpu}" = "x86_64" ]; then
|
||||
download_rust_static_source "apple-darwin" "x86_64"
|
||||
else
|
||||
download_rust_static_source "apple-darwin" "aarch64"
|
||||
fi
|
||||
else
|
||||
echo "Unsupported platform: $(uname -s) $(uname -m)"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_build_result() {
|
||||
pushd ${install_path}
|
||||
local target_name=${1}
|
||||
tar -xf rust-std-nightly-${1}.tar.gz
|
||||
local file_name="./rust-std-nightly-${1}/rust-std-${1}/lib/rustlib/${1}/lib/libstd.dylib.so"
|
||||
llvm-strip ${file_name}
|
||||
local file_size=$(stat -c%s ${file_name})
|
||||
# so size should not exceed 1.2M
|
||||
rm -rf rust-std-nightly-${1}
|
||||
if [ $file_size -ge 1228000 ]; then
|
||||
echo "${file_name} size exceed 1.2M, size is ${file_size}"
|
||||
exit 1;
|
||||
fi
|
||||
echo "so size is ${file_size}"
|
||||
popd
|
||||
}
|
||||
|
||||
export_ohos_path() {
|
||||
if [ "${host_platform}" = "linux" ]; then
|
||||
export PATH=${rust_tools}/clang/ohos/linux-x86_64/llvm/bin:$PATH
|
||||
export PATH=${rust_tools}/cmake/linux-x86/bin:$PATH
|
||||
fi
|
||||
}
|
||||
@@ -163,6 +163,10 @@ main() {
|
||||
collect_build_result
|
||||
unlock_bep_time
|
||||
fi
|
||||
|
||||
if [ "${host_platform}" = "linux" ]; then
|
||||
check_build_result aarch64-unknown-linux-ohos
|
||||
fi
|
||||
|
||||
echo "Building the rust toolchain Completed"
|
||||
}
|
||||
|
||||
+17
-48
@@ -5,6 +5,7 @@ readonly shell_path=$(cd $(dirname $0); pwd)
|
||||
readonly root_build_dir="${shell_path}/../../../.."
|
||||
readonly rust_source_dir="${shell_path}/.."
|
||||
readonly rust_tools="${root_build_dir}/prebuilts"
|
||||
readonly install_path="${rust_source_dir}/build/dist"
|
||||
readonly output_install="${root_build_dir}/output/"
|
||||
readonly rust_static_dir="${root_build_dir}/rust_download"
|
||||
readonly oh_tools="${rust_tools}/ohos-sdk/linux/12/native/llvm/bin"
|
||||
@@ -14,40 +15,6 @@ new_version="xxxxx"
|
||||
|
||||
source ${shell_path}/function.sh
|
||||
|
||||
download_rust_static_source() {
|
||||
local pre_rust_date="2023-07-13"
|
||||
mkdir -p ${rust_static_dir} ${rust_source_dir}/build/cache/${pre_rust_date}
|
||||
local rust_down_net="https://mirrors.ustc.edu.cn/rust-static/dist"
|
||||
pushd ${rust_static_dir}
|
||||
local platform=$1
|
||||
local cpu=$2
|
||||
local files=("rust-std-1.71.0-${cpu}-${platform}.tar.xz" "rustc-1.71.0-${cpu}-${platform}.tar.xz" "cargo-1.71.0-${cpu}-${platform}.tar.xz")
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
curl -O -k -m 300 ${rust_down_net}/${pre_rust_date}/${file} &
|
||||
done
|
||||
curl -O -k -m 300 ${rust_down_net}/rustc-1.72.0-src.tar.gz &
|
||||
wait
|
||||
popd
|
||||
cp ${rust_static_dir}/*.tar.xz ${rust_source_dir}/build/cache/${pre_rust_date}/
|
||||
cp ${rust_static_dir}/rustc-1.72.0-src.tar.gz ${root_build_dir}
|
||||
}
|
||||
|
||||
download_rust() {
|
||||
if [ "${host_platform}" = "linux" ] && [ "${host_cpu}" = "x86_64" ]; then
|
||||
download_rust_static_source "unknown-linux-gnu" "x86_64"
|
||||
elif [ "${host_platform}" = "darwin" ]; then
|
||||
if [ "${host_cpu}" = "x86_64" ]; then
|
||||
download_rust_static_source "apple-darwin" "x86_64"
|
||||
else
|
||||
download_rust_static_source "apple-darwin" "aarch64"
|
||||
fi
|
||||
else
|
||||
echo "Unsupported platform: $(uname -s) $(uname -m)"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
get_new_version() {
|
||||
pushd ${root_build_dir}/../harmony/llvm/
|
||||
local commit_id_full=$(git rev-parse HEAD)
|
||||
@@ -59,21 +26,22 @@ get_new_version() {
|
||||
collect_build_result() {
|
||||
mkdir -p ${output_install}
|
||||
if [ "${host_platform}" = "linux" ] && [ ${host_cpu} = "x86_64" ]; then
|
||||
cp ${rust_source_dir}/build/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz ${output_install}/
|
||||
cp ${rust_source_dir}/build/dist/rust-std-nightly-x86_64-pc-windows-gnullvm.tar.gz ${output_install}/
|
||||
cp ${rust_source_dir}/build/dist/rust-std-nightly-aarch64-unknown-linux-ohos.tar.gz ${output_install}/
|
||||
cp ${rust_source_dir}/build/dist/rust-std-nightly-armv7-unknown-linux-ohos.tar.gz ${output_install}/
|
||||
cp ${rust_source_dir}/build/dist/rust-std-nightly-x86_64-unknown-linux-ohos.tar.gz ${output_install}/
|
||||
cp ${install_path}/rust-nightly-x86_64-unknown-linux-gnu.tar.gz ${output_install}/
|
||||
cp ${install_path}/rust-std-nightly-x86_64-pc-windows-gnullvm.tar.gz ${output_install}/
|
||||
cp ${install_path}/rust-std-nightly-aarch64-unknown-linux-ohos.tar.gz ${output_install}/
|
||||
cp ${install_path}/rust-std-nightly-armv7-unknown-linux-ohos.tar.gz ${output_install}/
|
||||
cp ${install_path}/rust-std-nightly-x86_64-unknown-linux-ohos.tar.gz ${output_install}/
|
||||
elif [ "${host_platform}" = "darwin" ] && [ ${host_cpu} = "x86_64" ]; then
|
||||
cp ${rust_source_dir}/build/dist/rust-nightly-x86_64-apple-darwin.tar.gz ${output_install}/
|
||||
cp ${install_path}/rust-nightly-x86_64-apple-darwin.tar.gz ${output_install}/
|
||||
elif [ "${host_platform}" = "darwin" ] && [ ${host_cpu} = "arm64" ]; then
|
||||
cp ${rust_source_dir}/build/dist/rust-nightly-aarch64-apple-darwin.tar.gz ${output_install}/
|
||||
cp ${install_path}/rust-nightly-aarch64-apple-darwin.tar.gz ${output_install}/
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
detect_platform
|
||||
download_rust
|
||||
rm -rf ${rust_source_dir}/build/*
|
||||
download_rust_at_net
|
||||
copy_config
|
||||
update_config_clang ${oh_tools} ${mingw_tools}
|
||||
get_new_version
|
||||
@@ -84,14 +52,15 @@ main() {
|
||||
cp -r ${root_build_dir}/../harmony/llvm/* ${rust_source_dir}/src/llvm-project/
|
||||
|
||||
pushd ${rust_source_dir}
|
||||
if [ "${host_platform}" = "linux" ]; then
|
||||
export PATH=${rust_tools}/cmake/linux-x86/bin:${rust_tools}/clang/ohos/linux-x86_64/llvm/bin:$PATH
|
||||
fi
|
||||
export_ohos_path
|
||||
# clear cache before build
|
||||
sudo sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches'
|
||||
python3 ./x.py dist
|
||||
popd
|
||||
|
||||
collect_build_result
|
||||
|
||||
if [ "${host_platform}" = "linux" ]; then
|
||||
check_build_result aarch64-unknown-linux-ohos
|
||||
fi
|
||||
popd
|
||||
echo "Building the rust toolchain Completed"
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
readonly shell_path=$(cd $(dirname $0); pwd)
|
||||
readonly root_build_dir="${shell_path}/../../../.."
|
||||
readonly rust_source_dir="${shell_path}/.."
|
||||
readonly rust_tools="${root_build_dir}/prebuilts"
|
||||
readonly rust_static_dir="${root_build_dir}/rust_download"
|
||||
readonly oh_tools="${rust_tools}/ohos-sdk/linux/12/native/llvm/bin"
|
||||
readonly mingw_tools="${rust_tools}/mingw-w64/ohos/linux-x86_64/clang-mingw/bin"
|
||||
|
||||
source ${shell_path}/function.sh
|
||||
exclude_file=""
|
||||
|
||||
main() {
|
||||
detect_platform
|
||||
rm -rf ${rust_source_dir}/build/*
|
||||
download_rust_at_net
|
||||
copy_config
|
||||
update_config_clang ${oh_tools} ${mingw_tools}
|
||||
sed -i "s/nightly/beta/g" ${rust_source_dir}/config.toml
|
||||
sed -i "s/target = .*/target = [\"x86_64-unknown-linux-gnu\"]/g" ${rust_source_dir}/config.toml
|
||||
move_static_rust_source ${rust_static_dir} ${rust_source_dir}
|
||||
|
||||
rm -rf ${rust_source_dir}/src/llvm-project/*
|
||||
cp -r ${root_build_dir}/../harmony/llvm/* ${rust_source_dir}/src/llvm-project/
|
||||
|
||||
pushd ${rust_source_dir}
|
||||
export_ohos_path
|
||||
while read line; do
|
||||
if [ -z "$line" ]; then
|
||||
break
|
||||
fi
|
||||
exclude_file="$exclude_file --exclude $line"
|
||||
done < ${shell_path}/exclude_test.txt
|
||||
# Downloading through repo does not have an origin remote, but the Rust test code uses
|
||||
# the origin remote information. Add origin remote information through this method.
|
||||
# search "refs/remotes/origin" at rust code.
|
||||
if [ -z $(git remote | grep "origin") ]; then
|
||||
local address=$(echo $(git remote -v | grep fetch) | awk '{print $2}')
|
||||
git remote add origin ${address}
|
||||
git fetch -f origin
|
||||
fi
|
||||
|
||||
test_suite_dir=("assembly" "codegen" "codegen-units" "incremental" "mir-opt"
|
||||
"pretty" "run-coverage" "run-coverage-rustdoc" "run-make" "run-make-fulldeps"
|
||||
"run-pass-valgrind" "rustdoc" "rustdoc-js" "rustdoc-js-std"
|
||||
"rustdoc-json" "rustdoc-ui" "ui" "ui-fulldeps")
|
||||
all_test_suite=""
|
||||
for element in "${test_suite_dir[@]}"
|
||||
do
|
||||
all_test_suite="${all_test_suite} tests/${element}"
|
||||
done
|
||||
# clear cache before test
|
||||
sudo sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches'
|
||||
python3 ./x.py test --stage=2 tidy ${all_test_suite} $exclude_file --no-fail-fast
|
||||
|
||||
popd
|
||||
echo "test the rust toolchain Completed"
|
||||
}
|
||||
|
||||
main
|
||||
@@ -12,6 +12,7 @@ fn parse(config: &str) -> Config {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn download_ci_llvm() {
|
||||
if crate::llvm::is_ci_llvm_modified(&parse("")) {
|
||||
eprintln!("Detected LLVM as non-available: running in CI and modified LLVM in this change");
|
||||
@@ -40,6 +41,7 @@ fn download_ci_llvm() {
|
||||
// - https://github.com/rust-lang/rust/issues/109120
|
||||
// - https://github.com/rust-lang/rust/pull/109162#issuecomment-1496782487
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn detect_src_and_out() {
|
||||
fn test(cfg: Config, build_dir: Option<&str>) {
|
||||
// This will bring absolute form of `src/bootstrap` path
|
||||
|
||||
@@ -16,7 +16,9 @@ do
|
||||
# Get filename without metadata-id.
|
||||
file_prefix=$(echo "$file_prefix" | awk '{split($1, arr, "-"); print arr[1]}')
|
||||
|
||||
if [[ "$file_suffix" != "rlib" && "$file_suffix" != "so" || "$file_prefix" == "librustc_demangle" || "$file_prefix" == "libcfg_if" || "$file_prefix" == "libunwind" ]]
|
||||
if [[ "$file_suffix" != "rlib" && "$file_suffix" != "so" || \
|
||||
"$file_prefix" == "librustc_demangle" || "$file_prefix" == "libcfg_if" || \
|
||||
"$file_prefix" == "libunwind" ]]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
@@ -37,11 +39,16 @@ do
|
||||
newfile_name="$file_prefix.dylib.so"
|
||||
if [[ "$file_prefix" == "libtest" ]]
|
||||
then
|
||||
# Modify the dependency of `libtest.dylib.so` from `libstd-{metadata-id}.so` to `libstd.dylib.so`.
|
||||
readonly dynstr_section_vaddr=$(readelf -S "$file" | grep ".dynstr" | awk -F']' '{print $2}' | awk '{print strtonum("0x"$3)}')
|
||||
readonly libstd_str_offset=$(readelf -p .dynstr "$file" | grep "libstd-[a-z0-9]\{16\}\.so" | awk -F'[' '{print $2}' | awk '{print $1}' | awk -F']' '{print strtonum("0x"$1)}')
|
||||
# Modify the dependency of `libtest.dylib.so` from `libstd-{metadata-id}.so`
|
||||
# to `libstd.dylib.so`.
|
||||
readonly dynstr_section_vaddr=$(readelf -S "$file" | grep ".dynstr" | \
|
||||
awk -F']' '{print $2}' | awk '{print strtonum("0x"$3)}')
|
||||
readonly libstd_str_offset=$(readelf -p .dynstr "$file" | \
|
||||
grep "libstd-[a-z0-9]\{16\}\.so" | awk -F'[' '{print $2}' | \
|
||||
awk '{print $1}' | awk -F']' '{print strtonum("0x"$1)}')
|
||||
readonly libstd_str_vaddr=`expr $dynstr_section_vaddr + $libstd_str_offset`
|
||||
$(printf 'libstd.dylib.so\0\0\0\0\0\0\0\0\0\0\0' | dd of="$file" bs=1 seek=$libstd_str_vaddr count=26 conv=notrunc)
|
||||
$(printf 'libstd.dylib.so\0\0\0\0\0\0\0\0\0\0\0' | \
|
||||
dd of="$file" bs=1 seek=$libstd_str_vaddr count=26 conv=notrunc)
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -51,4 +58,4 @@ do
|
||||
fi
|
||||
|
||||
mv $file "$dir_name/$newfile_name"
|
||||
done
|
||||
done
|
||||
|
||||
@@ -328,6 +328,7 @@ target | std | host | notes
|
||||
`x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku
|
||||
`x86_64-unknown-hermit` | ✓ | | HermitCore
|
||||
`x86_64-unknown-l4re-uclibc` | ? | |
|
||||
[`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | 64-bit OpenHarmony |
|
||||
[`x86_64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 64-bit OpenBSD
|
||||
`x86_64-uwp-windows-gnu` | ✓ | |
|
||||
`x86_64-uwp-windows-msvc` | ✓ | |
|
||||
|
||||
@@ -71,6 +71,28 @@ exec /path/to/ohos-sdk/linux/native/llvm/bin/clang++ \
|
||||
"$@"
|
||||
```
|
||||
|
||||
`x86_64-unknown-linux-ohos-clang.sh`
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
exec /path/to/ohos-sdk/linux/native/llvm/bin/clang \
|
||||
-target x86_64-linux-ohos \
|
||||
--sysroot=/path/to/ohos-sdk/linux/native/sysroot \
|
||||
-D__MUSL__ \
|
||||
"$@"
|
||||
```
|
||||
|
||||
`x86_64-unknown-linux-ohos-clang++.sh`
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
exec /path/to/ohos-sdk/linux/native/llvm/bin/clang++ \
|
||||
-target x86_64-linux-ohos \
|
||||
--sysroot=/path/to/ohos-sdk/linux/native/sysroot \
|
||||
-D__MUSL__ \
|
||||
"$@"
|
||||
```
|
||||
|
||||
Future versions of the OpenHarmony SDK will avoid the need for this process.
|
||||
|
||||
## Building the target
|
||||
@@ -98,6 +120,13 @@ cxx = "/path/to/armv7-unknown-linux-ohos-clang++.sh"
|
||||
ar = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ar"
|
||||
ranlib = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ranlib"
|
||||
linker = "/path/to/armv7-unknown-linux-ohos-clang.sh"
|
||||
|
||||
[target.x86_64-unknown-linux-ohos]
|
||||
cc = "/path/to/x86_64-unknown-linux-ohos-clang.sh"
|
||||
cxx = "/path/to/x86_64-unknown-linux-ohos-clang++.sh"
|
||||
ar = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ar"
|
||||
ranlib = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ranlib"
|
||||
linker = "/path/to/x86_64-unknown-linux-ohos-clang.sh"
|
||||
```
|
||||
|
||||
## Building Rust programs
|
||||
@@ -116,6 +145,10 @@ linker = "/path/to/aarch64-unknown-linux-ohos-clang.sh"
|
||||
[target.armv7-unknown-linux-ohos]
|
||||
ar = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ar"
|
||||
linker = "/path/to/armv7-unknown-linux-ohos-clang.sh"
|
||||
|
||||
[target.x86_64-unknown-linux-ohos]
|
||||
ar = "/path/to/ohos-sdk/linux/native/llvm/bin/llvm-ar"
|
||||
linker = "/path/to/x86_64-unknown-linux-ohos-clang.sh"
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Reference in New Issue
Block a user