From 61be1554132ecb9299f86e874feba64f31d29a2e Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Wed, 21 Oct 2020 17:32:51 -0700 Subject: [PATCH] Remove do.sh --- programs/bpf/build.rs | 10 +- programs/bpf/rust/128bit/Cargo.toml | 1 - programs/bpf/rust/128bit_dep/Cargo.toml | 1 - programs/bpf/rust/alloc/Cargo.toml | 1 - programs/bpf/rust/call_depth/Cargo.toml | 1 - programs/bpf/rust/custom_heap/Cargo.toml | 1 - programs/bpf/rust/dep_crate/Cargo.toml | 1 - .../bpf/rust/deprecated_loader/Cargo.toml | 1 - programs/bpf/rust/do.sh | 123 ------------------ programs/bpf/rust/dup_accounts/Cargo.toml | 1 - programs/bpf/rust/error_handling/Cargo.toml | 1 - programs/bpf/rust/external_spend/Cargo.toml | 1 - .../rust/instruction_introspection/Cargo.toml | 1 - programs/bpf/rust/invoke/Cargo.toml | 1 - programs/bpf/rust/invoked/Cargo.toml | 1 - programs/bpf/rust/iter/Cargo.toml | 1 - programs/bpf/rust/many_args/Cargo.toml | 1 - programs/bpf/rust/many_args_dep/Cargo.toml | 1 - programs/bpf/rust/noop/Cargo.toml | 1 - programs/bpf/rust/panic/Cargo.toml | 1 - programs/bpf/rust/param_passing/Cargo.toml | 1 - .../bpf/rust/param_passing_dep/Cargo.toml | 1 - programs/bpf/rust/rand/Cargo.toml | 1 - programs/bpf/rust/ristretto/Cargo.toml | 1 - programs/bpf/rust/sanity/Cargo.toml | 1 - programs/bpf/rust/sha256/Cargo.toml | 1 - programs/bpf/rust/sysval/Cargo.toml | 1 - sdk/bpf/scripts/bpf-trace.py | 11 +- 28 files changed, 10 insertions(+), 159 deletions(-) delete mode 100755 programs/bpf/rust/do.sh diff --git a/programs/bpf/build.rs b/programs/bpf/build.rs index 12a4e59c2dda91..ed7fd926547927 100644 --- a/programs/bpf/build.rs +++ b/programs/bpf/build.rs @@ -94,16 +94,16 @@ fn main() { program ); assert!(Command::new("bash") - .current_dir("rust") - .args(&["./do.sh", "build", program]) + .current_dir(format!("rust/{}", program)) + .args(&["../../../../cargo-build-bpf"]) .status() - .expect("Error calling do.sh from build.rs") + .expect("Error calling cargo-build-bpf from build.rs") .success()); let src = format!( - "target/bpfel-unknown-unknown/release/solana_bpf_rust_{}.so", + "rust/{0}/solana_bpf_rust_{0}.so", program, ); - assert!(Command::new("cp") + assert!(Command::new("mv") .arg(&src) .arg(&install_dir) .status() diff --git a/programs/bpf/rust/128bit/Cargo.toml b/programs/bpf/rust/128bit/Cargo.toml index 25d40f934c688e..2652f0f3e4bdac 100644 --- a/programs/bpf/rust/128bit/Cargo.toml +++ b/programs/bpf/rust/128bit/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-128bit" diff --git a/programs/bpf/rust/128bit_dep/Cargo.toml b/programs/bpf/rust/128bit_dep/Cargo.toml index d11eef632bc293..ac9dbd206361a4 100644 --- a/programs/bpf/rust/128bit_dep/Cargo.toml +++ b/programs/bpf/rust/128bit_dep/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-128bit-dep" diff --git a/programs/bpf/rust/alloc/Cargo.toml b/programs/bpf/rust/alloc/Cargo.toml index fd0abc4f65f080..1c41b347e4d8d9 100644 --- a/programs/bpf/rust/alloc/Cargo.toml +++ b/programs/bpf/rust/alloc/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-alloc" diff --git a/programs/bpf/rust/call_depth/Cargo.toml b/programs/bpf/rust/call_depth/Cargo.toml index cd7ddd3dff8647..d9118671419a15 100644 --- a/programs/bpf/rust/call_depth/Cargo.toml +++ b/programs/bpf/rust/call_depth/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-call-depth" diff --git a/programs/bpf/rust/custom_heap/Cargo.toml b/programs/bpf/rust/custom_heap/Cargo.toml index f2c9f271aa8284..27e253f2a1ca1f 100644 --- a/programs/bpf/rust/custom_heap/Cargo.toml +++ b/programs/bpf/rust/custom_heap/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-custom-heap" diff --git a/programs/bpf/rust/dep_crate/Cargo.toml b/programs/bpf/rust/dep_crate/Cargo.toml index 0b8ae42b157f28..2284f804410b9e 100644 --- a/programs/bpf/rust/dep_crate/Cargo.toml +++ b/programs/bpf/rust/dep_crate/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-dep-crate" diff --git a/programs/bpf/rust/deprecated_loader/Cargo.toml b/programs/bpf/rust/deprecated_loader/Cargo.toml index d8d2e9d18520bf..682e23cdafd17c 100644 --- a/programs/bpf/rust/deprecated_loader/Cargo.toml +++ b/programs/bpf/rust/deprecated_loader/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-deprecated_loader" diff --git a/programs/bpf/rust/do.sh b/programs/bpf/rust/do.sh deleted file mode 100755 index 248ab573a5937c..00000000000000 --- a/programs/bpf/rust/do.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env bash - -cd "$(dirname "$0")" - -usage() { - cat < - -If relative_project_path is ommitted then action will -be performed on all projects - -Supported actions: - build - clean - test - clippy - fmt - -EOF -} - -sdkDir=../../../sdk -targetDir="$PWD"/../target -profile=bpfel-unknown-unknown/release - -perform_action() { - set -e - case "$1" in - build) - "$sdkDir"/bpf/rust/build.sh "$2" - - so_path="$targetDir/$profile/" - so_name="solana_bpf_rust_${3%/}" - if [ -f "$so_path/${so_name}.so" ]; then - cp "$so_path/${so_name}.so" "$so_path/${so_name}_debug.so" - "$sdkDir/bpf/dependencies/llvm-native/bin/llvm-objcopy" --strip-all "$so_path/${so_name}.so" "$so_path/$so_name.so" - fi - ;; - clean) - "$sdkDir"/bpf/rust/clean.sh "$2" - ;; - test) - ( - cd "$2" - echo "test $2" - cargo +nightly test - ) - ;; - clippy) - ( - cd "$2" - echo "clippy $2" - cargo +nightly clippy - ) - ;; - fmt) - ( - cd "$2" - echo "formatting $2" - cargo fmt - ) - ;; - dump) - # Dump depends on tools that are not installed by default and must be installed manually - # - greadelf - # - rustfilt - ( - pwd - "$0" build "$3" - - cd "$3" - so="$targetDir/$profile/solana_bpf_rust_${3%/}_debug.so" - dump="$targetDir/${3%/}-dump" - - if [ -f "$so" ]; then - ls \ - -la \ - "$so" \ - >"${dump}-mangled.txt" - greadelf \ - -aW \ - "$so" \ - >>"${dump}-mangled.txt" - ../"$sdkDir/bpf/dependencies/llvm-native/bin/llvm-objdump" \ - -print-imm-hex \ - --source \ - --disassemble \ - "$so" \ - >>"${dump}-mangled.txt" - sed \ - s/://g \ - < "${dump}-mangled.txt" \ - | rustfilt \ - > "${dump}.txt" - else - echo "Warning: No dump created, cannot find: $so" - fi - ) - ;; - help) - usage - exit - ;; - *) - echo "Error: Unknown command" - usage - exit - ;; - esac -} - -set -e - -if [ "$#" -ne 2 ]; then - # Build all projects - for project in */; do - perform_action "$1" "$PWD/$project" "$project" - done -else - # Build requested project - perform_action "$1" "$PWD/$2" "$2" -fi diff --git a/programs/bpf/rust/dup_accounts/Cargo.toml b/programs/bpf/rust/dup_accounts/Cargo.toml index e9adb53b586636..666717346159c1 100644 --- a/programs/bpf/rust/dup_accounts/Cargo.toml +++ b/programs/bpf/rust/dup_accounts/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-dup-accounts" diff --git a/programs/bpf/rust/error_handling/Cargo.toml b/programs/bpf/rust/error_handling/Cargo.toml index d93e4432a4619c..e91f147d59ff4f 100644 --- a/programs/bpf/rust/error_handling/Cargo.toml +++ b/programs/bpf/rust/error_handling/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-error-handling" diff --git a/programs/bpf/rust/external_spend/Cargo.toml b/programs/bpf/rust/external_spend/Cargo.toml index ab1c42987210c9..90e17ef615eb49 100644 --- a/programs/bpf/rust/external_spend/Cargo.toml +++ b/programs/bpf/rust/external_spend/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-external-spend" diff --git a/programs/bpf/rust/instruction_introspection/Cargo.toml b/programs/bpf/rust/instruction_introspection/Cargo.toml index 17b94dd0883243..e8adce8ee81192 100644 --- a/programs/bpf/rust/instruction_introspection/Cargo.toml +++ b/programs/bpf/rust/instruction_introspection/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-instruction-introspection" diff --git a/programs/bpf/rust/invoke/Cargo.toml b/programs/bpf/rust/invoke/Cargo.toml index 698cfcc9c3b0e8..029914dbea7fc2 100644 --- a/programs/bpf/rust/invoke/Cargo.toml +++ b/programs/bpf/rust/invoke/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-invoke" diff --git a/programs/bpf/rust/invoked/Cargo.toml b/programs/bpf/rust/invoked/Cargo.toml index 0fb5b8838b49b9..de37b19550eea2 100644 --- a/programs/bpf/rust/invoked/Cargo.toml +++ b/programs/bpf/rust/invoked/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-invoked" diff --git a/programs/bpf/rust/iter/Cargo.toml b/programs/bpf/rust/iter/Cargo.toml index 872c28cdfbcb3e..d6cc3ff0465f2e 100644 --- a/programs/bpf/rust/iter/Cargo.toml +++ b/programs/bpf/rust/iter/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-iter" diff --git a/programs/bpf/rust/many_args/Cargo.toml b/programs/bpf/rust/many_args/Cargo.toml index 82eb59cc27b9cf..9cd10f6f20006a 100644 --- a/programs/bpf/rust/many_args/Cargo.toml +++ b/programs/bpf/rust/many_args/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-many-args" diff --git a/programs/bpf/rust/many_args_dep/Cargo.toml b/programs/bpf/rust/many_args_dep/Cargo.toml index 251e8437375f4b..455fa1220c01a3 100644 --- a/programs/bpf/rust/many_args_dep/Cargo.toml +++ b/programs/bpf/rust/many_args_dep/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-many-args-dep" diff --git a/programs/bpf/rust/noop/Cargo.toml b/programs/bpf/rust/noop/Cargo.toml index 7726da00e3cb95..fef8b293be8316 100644 --- a/programs/bpf/rust/noop/Cargo.toml +++ b/programs/bpf/rust/noop/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-noop" diff --git a/programs/bpf/rust/panic/Cargo.toml b/programs/bpf/rust/panic/Cargo.toml index 58f992f6a59855..0fb178e1ed2d30 100644 --- a/programs/bpf/rust/panic/Cargo.toml +++ b/programs/bpf/rust/panic/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-panic" diff --git a/programs/bpf/rust/param_passing/Cargo.toml b/programs/bpf/rust/param_passing/Cargo.toml index f01238c5b91a8a..061674bdfe4e34 100644 --- a/programs/bpf/rust/param_passing/Cargo.toml +++ b/programs/bpf/rust/param_passing/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-param-passing" diff --git a/programs/bpf/rust/param_passing_dep/Cargo.toml b/programs/bpf/rust/param_passing_dep/Cargo.toml index 82cf38c9e6bd70..40bcead2a3a13a 100644 --- a/programs/bpf/rust/param_passing_dep/Cargo.toml +++ b/programs/bpf/rust/param_passing_dep/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-param-passing-dep" diff --git a/programs/bpf/rust/rand/Cargo.toml b/programs/bpf/rust/rand/Cargo.toml index 7db1ae87394f8f..41c66726a8f006 100644 --- a/programs/bpf/rust/rand/Cargo.toml +++ b/programs/bpf/rust/rand/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-rand" diff --git a/programs/bpf/rust/ristretto/Cargo.toml b/programs/bpf/rust/ristretto/Cargo.toml index b957006ad59f0a..b46547df5aa659 100644 --- a/programs/bpf/rust/ristretto/Cargo.toml +++ b/programs/bpf/rust/ristretto/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-ristretto" diff --git a/programs/bpf/rust/sanity/Cargo.toml b/programs/bpf/rust/sanity/Cargo.toml index d71c28554ecdd4..d3d3ff9196d4ee 100644 --- a/programs/bpf/rust/sanity/Cargo.toml +++ b/programs/bpf/rust/sanity/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-sanity" diff --git a/programs/bpf/rust/sha256/Cargo.toml b/programs/bpf/rust/sha256/Cargo.toml index 3261f1047415bb..560f23d7406c9c 100644 --- a/programs/bpf/rust/sha256/Cargo.toml +++ b/programs/bpf/rust/sha256/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-sha256" diff --git a/programs/bpf/rust/sysval/Cargo.toml b/programs/bpf/rust/sysval/Cargo.toml index 99898764b701b0..202d6d32033cb9 100644 --- a/programs/bpf/rust/sysval/Cargo.toml +++ b/programs/bpf/rust/sysval/Cargo.toml @@ -1,5 +1,4 @@ -# Note: This crate must be built using do.sh [package] name = "solana-bpf-rust-sysval" diff --git a/sdk/bpf/scripts/bpf-trace.py b/sdk/bpf/scripts/bpf-trace.py index d0dad61770948a..e64ff011972bc8 100755 --- a/sdk/bpf/scripts/bpf-trace.py +++ b/sdk/bpf/scripts/bpf-trace.py @@ -1,14 +1,13 @@ #!/usr/bin/env python -# +# # Prints a BPF program call trace with instruction counts for each call # # This script requires a dump file containing the instruction dump of the ELF # and a trace file that contains the trace output of the BPF VM # -# You can create the dump file with do.sh: -# $ do.sh dump -# Or directly: +# You can create the dump file by passing the --dump flag to `cargo build-bpf`, +# or directly: # $ llvm-objdump -print-imm-hex --source --disassemble # # You can create the trace file by running the program and setting RUST_LOG: @@ -53,7 +52,7 @@ def parse_line(rxs, line): sys.exit(' Usage: ' + sys.argv[0] + ' dump_file trace_file') dumppath = sys.argv[1] tracepath = sys.argv[2] - + # parse the dump file to create a map # of instruction numbers to symbols symbols = {} @@ -76,7 +75,7 @@ def parse_line(rxs, line): line = file_object.readline() if len(symbols) == 0: sys.exit("Error: No instruction dump in: " + dumppath) - + # parse the trace file to build a call list calls = [] # all the calls made with open(tracepath, 'r') as file_object: