-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #57130 - VardhanThigle:Vardhan/x86_64-fortanix-unknown-…
…sgx-tier2_support, r=alexcrichton Upgrade x86_64-fortanix-unknown-sgx platform support to tier 2 ## Overview 1. This PR upgrades x86_64-fortanix-unknown-sgx platform support to tier 2 (std only) by setting up build automation for this target. 1. For supporting unwinding, this target needs to link to a port of LLVM's libunwind (more details could be found in #56979), which will be distributed along with the Rust binaries (similar to the extra musl objects) ### Building and copying libunwind: We have added a new build script (`build-x86_64-fortanix-unknown-sgx-toolchain.sh`) that will run while the container is built. This will build `libunwind.a` from git source. While the container is built, the persistent volumes where obj/ gets created aren't yet mapped. As a workaround, we copy the built `libunwind.a` to `obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-fortanix-unknown-sgx/lib/` after x.py runs. If any reviewer knows of a better solution, please do tell. r? @Mark-Simulacrum
- Loading branch information
Showing
7 changed files
with
134 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/ci/docker/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
source shared.sh | ||
|
||
if [ -z "$1" ]; then | ||
echo "Usage: ${0} <commit_id>" | ||
exit -1 | ||
fi | ||
|
||
target="x86_64-fortanix-unknown-sgx" | ||
url="https://github.com/fortanix/llvm-project/archive/${1}.tar.gz" | ||
repo_name="llvm-project" | ||
|
||
install_prereq() | ||
{ | ||
apt-get update | ||
apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
git | ||
} | ||
|
||
# Clone Fortanix's port of llvm-project to build libunwind that would link with this target. | ||
# The below method to download a single commit from llvm-project is based on fetch_submodule | ||
# from init_repo.sh | ||
fetch_llvm_commit() | ||
{ | ||
cached="download-${repo_name}.tar.gz" | ||
curl -f -sSL -o ${cached} ${url} | ||
tar -xvzf ${cached} | ||
mkdir "./${repo_name}" && tar -xf ${cached} -C ${repo_name} --strip-components 1 | ||
} | ||
|
||
build_unwind() | ||
{ | ||
dir_name="${target}_temp" | ||
rm -rf "./${dir_name}" | ||
mkdir -p ${dir_name} | ||
cd ${dir_name} | ||
|
||
retry fetch_llvm_commit | ||
cd "${repo_name}/libunwind" | ||
|
||
# Build libunwind | ||
mkdir -p build | ||
cd build | ||
cmake -DCMAKE_BUILD_TYPE="RELEASE" -DRUST_SGX=1 -G "Unix Makefiles" -DLLVM_PATH=../../llvm/ ../ | ||
make unwind_static | ||
install -D "lib/libunwind.a" "/${target}/lib/libunwind.a" | ||
rm -rf ${dir_name} | ||
} | ||
|
||
set -x | ||
hide_output install_prereq | ||
hide_output build_unwind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters