From 81ef2a0d7544b54cc298d61042b215c239a70a04 Mon Sep 17 00:00:00 2001 From: Dmitri Makarov Date: Wed, 22 Mar 2023 10:41:40 -0400 Subject: [PATCH] Update references to platform-tools (#30764) --- .buildkite/hooks/pre-command | 2 +- ...f-tools-info.sh => platform-tools-info.sh} | 4 +- ci/test-stable.sh | 2 +- .../developing/on-chain-programs/debugging.md | 14 +- programs/sbf/build.rs | 4 +- sdk/cargo-build-sbf/src/main.rs | 180 +++++++----------- sdk/cargo-build-sbf/tests/crates.rs | 2 +- sdk/cargo-test-bpf/src/main.rs | 3 - sdk/sbf/.gitignore | 1 + sdk/sbf/c/sbf.mk | 8 +- sdk/sbf/env.sh | 8 +- sdk/sbf/scripts/dump.sh | 2 +- sdk/sbf/scripts/install.sh | 26 +-- sdk/sbf/scripts/objcopy.sh | 2 +- sdk/sbf/scripts/strip.sh | 2 +- 15 files changed, 106 insertions(+), 154 deletions(-) rename ci/{sbf-tools-info.sh => platform-tools-info.sh} (71%) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 31a3abea4bddb4..f22ced8585abf0 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -10,7 +10,7 @@ export PS4="++" # Restore target/ from the previous CI build on this machine # eval "$(ci/channel-info.sh)" -eval "$(ci/sbf-tools-info.sh)" +eval "$(ci/platform-tools-info.sh)" source "ci/rust-version.sh" HOST_RUST_VERSION="$rust_stable" pattern='^[0-9]+\.[0-9]+\.[0-9]+$' diff --git a/ci/sbf-tools-info.sh b/ci/platform-tools-info.sh similarity index 71% rename from ci/sbf-tools-info.sh rename to ci/platform-tools-info.sh index c644c23abcbd61..d8ee41cb5fbb00 100755 --- a/ci/sbf-tools-info.sh +++ b/ci/platform-tools-info.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Finds the version of sbf-tools used by this source tree. +# Finds the version of platform-tools used by this source tree. # # stdout of this script may be eval-ed. # @@ -11,7 +11,7 @@ SBF_TOOLS_VERSION=unknown cargo_build_sbf_main="${here}/../sdk/cargo-build-sbf/src/main.rs" if [[ -f "${cargo_build_sbf_main}" ]]; then - version=$(sed -e 's/^.*sbf_tools_version\s*=\s*String::from("\(v[0-9.]\+\)").*/\1/;t;d' "${cargo_build_sbf_main}") + version=$(sed -e 's/^.*platform_tools_version\s*=\s*String::from("\(v[0-9.]\+\)").*/\1/;t;d' "${cargo_build_sbf_main}") if [[ ${version} != '' ]]; then SBF_TOOLS_VERSION="${version}" else diff --git a/ci/test-stable.sh b/ci/test-stable.sh index e1066e703fa4b4..10adb977e76fb1 100755 --- a/ci/test-stable.sh +++ b/ci/test-stable.sh @@ -125,7 +125,7 @@ test-stable-sbf) exit 1 fi - # sbf-tools version + # platform-tools version "$cargo_build_sbf" -V # SBF program instruction count assertion diff --git a/docs/src/developing/on-chain-programs/debugging.md b/docs/src/developing/on-chain-programs/debugging.md index 0c296d71c86361..0e8c604c877c59 100644 --- a/docs/src/developing/on-chain-programs/debugging.md +++ b/docs/src/developing/on-chain-programs/debugging.md @@ -115,7 +115,7 @@ To turn on SBF interpreter trace messages in a local cluster configure the Source level debugging of on-chain programs written in Rust or C can be done using the stand-alone tool rbpf-cli, included in the SDK, and lldb, distrubuted with Solana Rust and Clang compiler binary package -sbf-tools. +platform-tools. The rbpf-cli tool loads a compiled on-chain program, executes it in RBPF virtual machine and runs a gdb server that accepts incoming @@ -162,11 +162,11 @@ to run rbpf-cli) run the command solana-lldb ``` -This script is installed in sbf-tools path. If that path is not added -to `PATH` environment variable, it may be necessary to specify the -full path, e.g. +This script is installed in platform-tools path. If that path is not +added to `PATH` environment variable, it may be necessary to specify +the full path, e.g. ``` -~/.cache/solana/v1.35/sbf-tools/llvm/bin/solana-lldb +~/.cache/solana/v1.35/platform-tools/llvm/bin/solana-lldb ``` After starting the debugger, load the .debug file by entering the following command at the debugger prompt @@ -198,12 +198,12 @@ extension. Open CodeLLDB Extension Settings. In Advanced settings change the value of `Lldb: Library` field to the path of `liblldb.so` (or liblldb.dylib on macOS). For example on Linux a possible path to Solana customized lldb can be -`/home//.cache/solana/v1.33/sbf-tools/llvm/lib/liblldb.so.` +`/home//.cache/solana/v1.33/platform-tools/llvm/lib/liblldb.so.` where `` is your Linux system username. This can also be added directly to `~/.config/Code/User/settings.json` file, e.g. ``` { - "lldb.library": "/home//.cache/solana/v1.35/sbf-tools/llvm/lib/liblldb.so" + "lldb.library": "/home//.cache/solana/v1.35/platform-tools/llvm/lib/liblldb.so" } ``` diff --git a/programs/sbf/build.rs b/programs/sbf/build.rs index c6c95c9f4f30ad..007ba9bfa2833e 100644 --- a/programs/sbf/build.rs +++ b/programs/sbf/build.rs @@ -46,7 +46,7 @@ fn main() { if sbf_c { let install_dir = "OUT_DIR=../target/".to_string() + &env::var("PROFILE").unwrap() + "/sbf"; - println!("cargo:warning=(not a warning) Building C-based SBF programs"); + println!("cargo:warning=(not a warning) Building C-based on-chain programs"); assert!(Command::new("make") .current_dir("c") .arg("programs") @@ -110,7 +110,7 @@ fn main() { "upgraded", ]; for program in rust_programs.iter() { - println!("cargo:warning=(not a warning) Building Rust-based SBF programs: solana_sbf_rust_{program}"); + println!("cargo:warning=(not a warning) Building Rust-based on-chain programs: solana_sbf_rust_{program}"); assert!(Command::new("../../cargo-build-sbf") .args([ "--manifest-path", diff --git a/sdk/cargo-build-sbf/src/main.rs b/sdk/cargo-build-sbf/src/main.rs index af7565d89e5610..a327d0835b3418 100644 --- a/sdk/cargo-build-sbf/src/main.rs +++ b/sdk/cargo-build-sbf/src/main.rs @@ -24,7 +24,7 @@ struct Config<'a> { cargo_args: Option>, sbf_out_dir: Option, sbf_sdk: PathBuf, - sbf_tools_version: &'a str, + platform_tools_version: &'a str, dump: bool, features: Vec, force_tools_install: bool, @@ -51,7 +51,7 @@ impl Default for Config<'_> { .join("sdk") .join("sbf"), sbf_out_dir: None, - sbf_tools_version: "(unknown)", + platform_tools_version: "(unknown)", dump: false, features: vec![], force_tools_install: false, @@ -63,7 +63,7 @@ impl Default for Config<'_> { verbose: false, workspace: false, jobs: None, - arch: "sbf", + arch: "sbfv1", } } } @@ -132,17 +132,13 @@ pub fn is_version_string(arg: &str) -> Result<(), String> { Err("a version string starts with 'v' and contains major and minor version numbers separated by a dot, e.g. v1.32".to_string()) } -fn find_installed_sbf_tools(arch: &str) -> Vec { +fn find_installed_platform_tools() -> Vec { let home_dir = PathBuf::from(env::var("HOME").unwrap_or_else(|err| { error!("Can't get home directory path: {}", err); exit(1); })); let solana = home_dir.join(".cache").join("solana"); - let package = if arch == "bpf" { - "bpf-tools" - } else { - "sbf-tools" - }; + let package = "platform-tools"; std::fs::read_dir(solana) .unwrap() .filter_map(|e| match e { @@ -158,8 +154,8 @@ fn find_installed_sbf_tools(arch: &str) -> Vec { .collect::>() } -fn get_latest_sbf_tools_version() -> Result { - let url = "https://github.com/solana-labs/sbf-tools/releases/latest"; +fn get_latest_platform_tools_version() -> Result { + let url = "https://github.com/solana-labs/platform-tools/releases/latest"; let resp = reqwest::blocking::get(url).map_err(|err| format!("Failed to GET {url}: {err}"))?; let path = std::path::Path::new(resp.url().path()); let version = path.file_name().unwrap().to_string_lossy().to_string(); @@ -178,22 +174,18 @@ fn normalize_version(version: String) -> String { } } -fn validate_sbf_tools_version( - arch: &str, - requested_version: &str, - builtin_version: String, -) -> String { +fn validate_platform_tools_version(requested_version: &str, builtin_version: String) -> String { let normalized_requested = normalize_version(requested_version.to_string()); let requested_semver = semver::Version::parse(&normalized_requested[1..]).unwrap(); - let installed_versions = find_installed_sbf_tools(arch); + let installed_versions = find_installed_platform_tools(); for v in installed_versions { if requested_semver <= semver::Version::parse(&normalize_version(v)[1..]).unwrap() { return requested_version.to_string(); } } - let latest_version = get_latest_sbf_tools_version().unwrap_or_else(|err| { + let latest_version = get_latest_platform_tools_version().unwrap_or_else(|err| { debug!( - "Can't get the latest version of sbf-tools: {}. Using built-in version {}.", + "Can't get the latest version of platform-tools: {}. Using built-in version {}.", err, &builtin_version, ); builtin_version.clone() @@ -211,7 +203,7 @@ fn validate_sbf_tools_version( } } -fn make_sbf_tools_path_for_version(package: &str, version: &str) -> PathBuf { +fn make_platform_tools_path_for_version(package: &str, version: &str) -> PathBuf { let home_dir = PathBuf::from(env::var("HOME").unwrap_or_else(|err| { error!("Can't get home directory path: {}", err); exit(1); @@ -273,7 +265,7 @@ fn install_if_missing( fs::create_dir_all(target_path).map_err(|err| err.to_string())?; let mut url = String::from(url); url.push('/'); - url.push_str(config.sbf_tools_version); + url.push_str(config.platform_tools_version); url.push('/'); url.push_str(download_file_name); let download_file_path = target_path.join(download_file_name); @@ -432,11 +424,7 @@ fn check_undefined_symbols(config: &Config, program: &Path) { let readelf = config .sbf_sdk .join("dependencies") - .join(if config.arch == "bpf" { - "bpf-tools" - } else { - "sbf-tools" - }) + .join("platform-tools") .join("llvm") .join("bin") .join("llvm-readelf"); @@ -470,16 +458,12 @@ fn check_undefined_symbols(config: &Config, program: &Path) { } } -// check whether custom SBF toolchain is linked, and link it if it is not. -fn link_sbf_toolchain(config: &Config) { +// check whether custom solana toolchain is linked, and link it if it is not. +fn link_solana_toolchain(config: &Config) { let toolchain_path = config .sbf_sdk .join("dependencies") - .join(if config.arch == "bpf" { - "bpf-tools" - } else { - "sbf-tools" - }) + .join("platform-tools") .join("rust"); let rustup = PathBuf::from("rustup"); let rustup_args = vec!["toolchain", "list", "-v"]; @@ -493,16 +477,12 @@ fn link_sbf_toolchain(config: &Config) { } let mut do_link = true; for line in rustup_output.lines() { - if line.starts_with(if config.arch == "bpf" { "bpf" } else { "sbf" }) { + if line.starts_with("solana") { let mut it = line.split_whitespace(); let _ = it.next(); let path = it.next(); if path.unwrap() != toolchain_path.to_str().unwrap() { - let rustup_args = vec![ - "toolchain", - "uninstall", - if config.arch == "bpf" { "bpf" } else { "sbf" }, - ]; + let rustup_args = vec!["toolchain", "uninstall", "solana"]; let output = spawn( &rustup, rustup_args, @@ -521,7 +501,7 @@ fn link_sbf_toolchain(config: &Config) { let rustup_args = vec![ "toolchain", "link", - if config.arch == "bpf" { "bpf" } else { "sbf" }, + "solana", toolchain_path.to_str().unwrap(), ]; let output = spawn( @@ -535,7 +515,11 @@ fn link_sbf_toolchain(config: &Config) { } } -fn build_sbf_package(config: &Config, target_directory: &Path, package: &cargo_metadata::Package) { +fn build_solana_package( + config: &Config, + target_directory: &Path, + package: &cargo_metadata::Package, +) { let program_name = { let cdylib_targets = package .targets @@ -580,13 +564,7 @@ fn build_sbf_package(config: &Config, target_directory: &Path, package: &cargo_m .cloned() .unwrap_or_else(|| target_directory.join("deploy")); - let target_build_directory = target_directory - .join(if config.arch == "bpf" { - "bpfel-unknown-unknown" - } else { - "sbf-solana-solana" - }) - .join("release"); + let target_build_directory = target_directory.join("sbf-solana-solana").join("release"); env::set_current_dir(root_package_dir).unwrap_or_else(|err| { error!( @@ -596,7 +574,7 @@ fn build_sbf_package(config: &Config, target_directory: &Path, package: &cargo_m exit(1); }); - info!("SBF SDK: {}", config.sbf_sdk.display()); + info!("Solana SDK: {}", config.sbf_sdk.display()); if config.no_default_features { info!("No default features"); } @@ -611,34 +589,20 @@ fn build_sbf_package(config: &Config, target_directory: &Path, package: &cargo_m } else { "x86_64" }; - let sbf_tools_download_file_name = if cfg!(target_os = "windows") { - if config.arch == "bpf" { - format!("solana-bpf-tools-windows-{arch}.tar.bz2") - } else { - format!("solana-sbf-tools-windows-{arch}.tar.bz2") - } + let platform_tools_download_file_name = if cfg!(target_os = "windows") { + format!("platform-tools-windows-{arch}.tar.bz2") } else if cfg!(target_os = "macos") { - if config.arch == "bpf" { - format!("solana-bpf-tools-osx-{arch}.tar.bz2") - } else { - format!("solana-sbf-tools-osx-{arch}.tar.bz2") - } - } else if config.arch == "bpf" { - format!("solana-bpf-tools-linux-{arch}.tar.bz2") - } else { - format!("solana-sbf-tools-linux-{arch}.tar.bz2") - }; - let package = if config.arch == "bpf" { - "bpf-tools" + format!("platform-tools-osx-{arch}.tar.bz2") } else { - "sbf-tools" + format!("platform-tools-linux-{arch}.tar.bz2") }; - let target_path = make_sbf_tools_path_for_version(package, config.sbf_tools_version); + let package = "platform-tools"; + let target_path = make_platform_tools_path_for_version(package, config.platform_tools_version); install_if_missing( config, package, - "https://github.com/solana-labs/sbf-tools/releases/download", - sbf_tools_download_file_name.as_str(), + "https://github.com/solana-labs/platform-tools/releases/download", + platform_tools_download_file_name.as_str(), &target_path, ) .unwrap_or_else(|err| { @@ -653,19 +617,15 @@ fn build_sbf_package(config: &Config, target_directory: &Path, package: &cargo_m ); exit(1); }); - error!("Failed to install sbf-tools: {}", err); + error!("Failed to install platform-tools: {}", err); exit(1); }); - link_sbf_toolchain(config); + link_solana_toolchain(config); let llvm_bin = config .sbf_sdk .join("dependencies") - .join(if config.arch == "bpf" { - "bpf-tools" - } else { - "sbf-tools" - }) + .join("platform-tools") .join("llvm") .join("bin"); env::set_var("CC", llvm_bin.join("clang")); @@ -675,19 +635,15 @@ fn build_sbf_package(config: &Config, target_directory: &Path, package: &cargo_m // RUSTC variable overrides cargo + mechanism of // selecting the rust compiler and makes cargo run a rust compiler - // other than the one linked in BPF toolchain. We have to prevent + // other than the one linked in Solana toolchain. We have to prevent // this by removing RUSTC from the child process environment. if env::var("RUSTC").is_ok() { warn!( - "Removed RUSTC from cargo environment, because it overrides +sbf cargo command line option." + "Removed RUSTC from cargo environment, because it overrides +solana cargo command line option." ); env::remove_var("RUSTC") } - let cargo_target = if config.arch == "bpf" { - "CARGO_TARGET_BPFEL_UNKNOWN_UNKNOWN_RUSTFLAGS" - } else { - "CARGO_TARGET_SBF_SOLANA_SOLANA_RUSTFLAGS" - }; + let cargo_target = "CARGO_TARGET_SBF_SOLANA_SOLANA_RUSTFLAGS"; let rustflags = env::var("RUSTFLAGS").ok().unwrap_or_default(); if env::var("RUSTFLAGS").is_ok() { warn!( @@ -722,15 +678,11 @@ fn build_sbf_package(config: &Config, target_directory: &Path, package: &cargo_m let cargo_build = PathBuf::from("cargo"); let mut cargo_build_args = vec![ - if config.arch == "bpf" { "+bpf" } else { "+sbf" }, + "+solana", "build", "--release", "--target", - if config.arch == "bpf" { - "bpfel-unknown-unknown" - } else { - "sbf-solana-solana" - }, + "sbf-solana-solana", ]; if config.arch == "sbfv2" { cargo_build_args.push("-Zbuild-std=std,panic_abort"); @@ -884,7 +836,7 @@ fn build_sbf_package(config: &Config, target_directory: &Path, package: &cargo_m } } -fn build_sbf(config: Config, manifest_path: Option) { +fn build_solana(config: Config, manifest_path: Option) { let mut metadata_command = cargo_metadata::MetadataCommand::new(); if let Some(manifest_path) = manifest_path { metadata_command.manifest_path(manifest_path); @@ -900,7 +852,7 @@ fn build_sbf(config: Config, manifest_path: Option) { if let Some(root_package) = metadata.root_package() { if !config.workspace { - build_sbf_package(&config, metadata.target_directory.as_ref(), root_package); + build_solana_package(&config, metadata.target_directory.as_ref(), root_package); return; } } @@ -921,7 +873,7 @@ fn build_sbf(config: Config, manifest_path: Option) { .collect::>(); for package in all_sbf_packages { - build_sbf_package(&config, metadata.target_directory.as_ref(), package); + build_solana_package(&config, metadata.target_directory.as_ref(), package); } } @@ -940,9 +892,13 @@ fn main() { } // The following line is scanned by CI configuration script to - // separate cargo caches according to the version of sbf-tools. - let sbf_tools_version = String::from("v1.35"); - let version = format!("{}\nsbf-tools {}", crate_version!(), sbf_tools_version); + // separate cargo caches according to the version of platform-tools. + let platform_tools_version = String::from("v1.36"); + let version = format!( + "{}\nplatform-tools {}", + crate_version!(), + platform_tools_version, + ); let matches = clap::Command::new(crate_name!()) .about(crate_description!()) .version(version.as_str()) @@ -1001,7 +957,7 @@ fn main() { Arg::new("force_tools_install") .long("force-tools-install") .takes_value(false) - .help("Download and install sbf-tools even when existing tools are located"), + .help("Download and install platform-tools even when existing tools are located"), ) .arg( Arg::new("generate_child_script_on_failure") @@ -1034,7 +990,9 @@ fn main() { .value_name("STRING") .takes_value(true) .validator(is_version_string) - .help("sbf-tools version to use or to install, a version string, e.g. \"v1.32\""), + .help( + "platform-tools version to use or to install, a version string, e.g. \"v1.32\"", + ), ) .arg( Arg::new("verbose") @@ -1048,7 +1006,7 @@ fn main() { .long("workspace") .takes_value(false) .alias("all") - .help("Build all SBF packages in the workspace"), + .help("Build all Solana packages in the workspace"), ) .arg( Arg::new("jobs") @@ -1062,23 +1020,19 @@ fn main() { .arg( Arg::new("arch") .long("arch") - .possible_values(["bpf", "sbf", "sbfv2"]) - .default_value("sbf") - .help("Build for the given SBF version"), + .possible_values(["sbfv1", "sbfv2"]) + .default_value("sbfv1") + .help("Build for the given target architecture"), ) .get_matches_from(args); let sbf_sdk: PathBuf = matches.value_of_t_or_exit("sbf_sdk"); let sbf_out_dir: Option = matches.value_of_t("sbf_out_dir").ok(); - let sbf_tools_version = if let Some(tools_version) = matches.value_of("tools_version") { - validate_sbf_tools_version( - matches.value_of("arch").unwrap(), - tools_version, - sbf_tools_version, - ) + let platform_tools_version = if let Some(tools_version) = matches.value_of("tools_version") { + validate_platform_tools_version(tools_version, platform_tools_version) } else { - sbf_tools_version + platform_tools_version }; let config = Config { cargo_args: matches @@ -1086,7 +1040,7 @@ fn main() { .map(|vals| vals.collect::>()), sbf_sdk: fs::canonicalize(&sbf_sdk).unwrap_or_else(|err| { error!( - "SBF SDK path does not exist: {}: {}", + "Solana SDK path does not exist: {}: {}", sbf_sdk.display(), err ); @@ -1101,7 +1055,7 @@ fn main() { .join(sbf_out_dir) } }), - sbf_tools_version: sbf_tools_version.as_str(), + platform_tools_version: platform_tools_version.as_str(), dump: matches.is_present("dump"), features: matches.values_of_t("features").ok().unwrap_or_default(), force_tools_install: matches.is_present("force_tools_install"), @@ -1120,5 +1074,5 @@ fn main() { debug!("{:?}", config); debug!("manifest_path: {:?}", manifest_path); } - build_sbf(config, manifest_path); + build_solana(config, manifest_path); } diff --git a/sdk/cargo-build-sbf/tests/crates.rs b/sdk/cargo-build-sbf/tests/crates.rs index 850acca6a6d2df..8da5e7c46fd56b 100644 --- a/sdk/cargo-build-sbf/tests/crates.rs +++ b/sdk/cargo-build-sbf/tests/crates.rs @@ -125,7 +125,7 @@ fn test_sbfv2() { .join("sdk") .join("sbf") .join("dependencies") - .join("sbf-tools") + .join("platform-tools") .join("llvm") .join("bin") .join("llvm-readelf"); diff --git a/sdk/cargo-test-bpf/src/main.rs b/sdk/cargo-test-bpf/src/main.rs index 344bb042e3812b..3befa78779318e 100644 --- a/sdk/cargo-test-bpf/src/main.rs +++ b/sdk/cargo-test-bpf/src/main.rs @@ -32,9 +32,6 @@ fn main() { args.remove(0); } } - let index = args.iter().position(|x| x == "--").unwrap_or(args.len()); - args.insert(index, "bpf".to_string()); - args.insert(index, "--arch".to_string()); print!("cargo-test-bpf child: {}", program.display()); for a in &args { print!(" {a}"); diff --git a/sdk/sbf/.gitignore b/sdk/sbf/.gitignore index e9ab3169be5448..fdd62a6c72572e 100644 --- a/sdk/sbf/.gitignore +++ b/sdk/sbf/.gitignore @@ -3,6 +3,7 @@ /dependencies/llvm-native* /dependencies/rust-bpf-sysroot* /dependencies/bpf-tools* +/dependencies/platform-tools* /dependencies/sbf-tools* /dependencies/xargo* /dependencies/bin* diff --git a/sdk/sbf/c/sbf.mk b/sdk/sbf/c/sbf.mk index a0880da79b0fe4..6699daf120e639 100644 --- a/sdk/sbf/c/sbf.mk +++ b/sdk/sbf/c/sbf.mk @@ -14,9 +14,9 @@ TEST_PREFIX ?= test_ OUT_DIR ?= ./out OS := $(shell uname) -LLVM_DIR = $(LOCAL_PATH)../dependencies/sbf-tools/llvm +LLVM_DIR = $(LOCAL_PATH)../dependencies/platform-tools/llvm LLVM_SYSTEM_INC_DIRS := $(LLVM_DIR)/lib/clang/15.0.4/include -COMPILER_RT_DIR = $(LOCAL_PATH)../dependencies/sbf-tools/rust/lib/rustlib/sbf-solana-solana/lib +COMPILER_RT_DIR = $(LOCAL_PATH)../dependencies/platform-tools/rust/lib/rustlib/sbf-solana-solana/lib STD_INC_DIRS := $(LLVM_DIR)/include STD_LIB_DIRS := $(LLVM_DIR)/lib @@ -111,9 +111,9 @@ TEST_CXX_FLAGS := \ help: @echo '' - @echo 'SBF Program makefile' + @echo 'Solana VM Program makefile' @echo '' - @echo 'This makefile will build SBF Programs from C or C++ source files into ELFs' + @echo 'This makefile will build Solana Programs from C or C++ source files into ELFs' @echo '' @echo 'Assumptions:' @echo ' - Programs are located in the source directory: $(SRC_DIR)/' diff --git a/sdk/sbf/env.sh b/sdk/sbf/env.sh index 63e57e6d51f980..a3f25bfad131a6 100644 --- a/sdk/sbf/env.sh +++ b/sdk/sbf/env.sh @@ -10,7 +10,7 @@ fi "$sbf_sdk"/scripts/install.sh # Use the SDK's version of llvm to build the compiler-builtins for SBF -export CC="$sbf_sdk/dependencies/sbf-tools/llvm/bin/clang" -export AR="$sbf_sdk/dependencies/sbf-tools/llvm/bin/llvm-ar" -export OBJDUMP="$sbf_sdk/dependencies/sbf-tools/llvm/bin/llvm-objdump" -export OBJCOPY="$sbf_sdk/dependencies/sbf-tools/llvm/bin/llvm-objcopy" +export CC="$sbf_sdk/dependencies/platform-tools/llvm/bin/clang" +export AR="$sbf_sdk/dependencies/platform-tools/llvm/bin/llvm-ar" +export OBJDUMP="$sbf_sdk/dependencies/platform-tools/llvm/bin/llvm-objdump" +export OBJCOPY="$sbf_sdk/dependencies/platform-tools/llvm/bin/llvm-objcopy" diff --git a/sdk/sbf/scripts/dump.sh b/sdk/sbf/scripts/dump.sh index ddd776f2b5ba3a..42b511ffd63a0c 100755 --- a/sdk/sbf/scripts/dump.sh +++ b/sdk/sbf/scripts/dump.sh @@ -31,7 +31,7 @@ dump_mangled=$dump.mangled ( set -ex ls -la "$so" > "$dump_mangled" - "$sbf_sdk"/dependencies/sbf-tools/llvm/bin/llvm-readelf -aW "$so" >>"$dump_mangled" + "$sbf_sdk"/dependencies/platform-tools/llvm/bin/llvm-readelf -aW "$so" >>"$dump_mangled" "$OBJDUMP" --print-imm-hex --source --disassemble "$so" >> "$dump_mangled" sed s/://g < "$dump_mangled" | rustfilt > "$dump" ) diff --git a/sdk/sbf/scripts/install.sh b/sdk/sbf/scripts/install.sh index ad70072d5218ad..9870e28430f903 100755 --- a/sdk/sbf/scripts/install.sh +++ b/sdk/sbf/scripts/install.sh @@ -108,31 +108,31 @@ if [[ ! -e criterion-$version.md || ! -e criterion ]]; then touch criterion-$version.md fi -# Install Rust-SBF -version=v1.35 -if [[ ! -e sbf-tools-$version.md || ! -e sbf-tools ]]; then +# Install platform tools +version=v1.36 +if [[ ! -e platform-tools-$version.md || ! -e platform-tools ]]; then ( set -e - rm -rf sbf-tools* + rm -rf platform-tools* job="download \ - https://github.com/solana-labs/sbf-tools/releases/download \ + https://github.com/solana-labs/platform-tools/releases/download \ $version \ - solana-sbf-tools-${machine}-${arch}.tar.bz2 \ - sbf-tools" - get $version sbf-tools "$job" + platform-tools-${machine}-${arch}.tar.bz2 \ + platform-tools" + get $version platform-tools "$job" ) exitcode=$? if [[ $exitcode -ne 0 ]]; then exit 1 fi - touch sbf-tools-$version.md + touch platform-tools-$version.md set -ex - ./sbf-tools/rust/bin/rustc --version - ./sbf-tools/rust/bin/rustc --print sysroot + ./platform-tools/rust/bin/rustc --version + ./platform-tools/rust/bin/rustc --print sysroot set +e - rustup toolchain uninstall sbf + rustup toolchain uninstall solana set -e - rustup toolchain link sbf sbf-tools/rust + rustup toolchain link solana platform-tools/rust fi exit 0 diff --git a/sdk/sbf/scripts/objcopy.sh b/sdk/sbf/scripts/objcopy.sh index d27b606a4af7c5..b8b109030c7473 100755 --- a/sdk/sbf/scripts/objcopy.sh +++ b/sdk/sbf/scripts/objcopy.sh @@ -3,4 +3,4 @@ sbf_sdk=$(cd "$(dirname "$0")/.." && pwd) # shellcheck source=sdk/sbf/env.sh source "$sbf_sdk"/env.sh -exec "$sbf_sdk"/dependencies/sbf-tools/llvm/bin/llvm-objcopy "$@" +exec "$sbf_sdk"/dependencies/platform-tools/llvm/bin/llvm-objcopy "$@" diff --git a/sdk/sbf/scripts/strip.sh b/sdk/sbf/scripts/strip.sh index 9c20ef0f9974b0..7942654ff72d9b 100755 --- a/sdk/sbf/scripts/strip.sh +++ b/sdk/sbf/scripts/strip.sh @@ -20,4 +20,4 @@ out_dir=$(dirname "$so_stripped") if [[ ! -d $out_dir ]]; then mkdir -p "$out_dir" fi -"$sbf_sdk"/dependencies/sbf-tools/llvm/bin/llvm-objcopy --strip-all "$so" "$so_stripped" +"$sbf_sdk"/dependencies/platform-tools/llvm/bin/llvm-objcopy --strip-all "$so" "$so_stripped"