Commit Graph

64 Commits

Author SHA1 Message Date
Dmitri Makarov a9d9a5095b Bump bpf-tools to v1.23 2022-02-03 15:50:18 -08:00
Michael Vines 6d5bbca630 Pacify clippy 2022-01-21 19:12:57 -08:00
Alessandro Decina 0459f0a4c0
cargo-build-bpf: don't set -C linker on windows (#22314)
* cargo-build-bpf: don't set -C linker on windows

Since we're now linking using rust-lld
(87ba5c61a5)
which is guaranteed to always be in the sysroot, hardcoding the linker path
shouldn't be needed anymore.

* Update Cargo.lock
2022-01-07 07:41:13 +11:00
Alessandro Decina 959ea26816
Re-enable LTO (#22287)
LTO seems to work fine now. It was possibly fixed by either the LLVM13 upgrade
or by b2ed47a925,
which fixed a LTO issue with tests.
2022-01-06 09:16:50 +11:00
Jon Cinque 57986f982a
cargo-build-bpf: Add Windows support (#20276)
* cargo-build-bpf: Add Windows support

* Update error message
2021-12-28 18:37:35 -05:00
Dmitri Makarov 298c2d0f62
Display bpf-tools version in cargo-build-bpf version string (#22061)
* Display bpf-tools version in cargo-build-bpf version string

* Print cargo-build-bpf version in CI for reference in stable-bpf jobs
2021-12-22 23:10:25 +00:00
Dmitri Makarov 7cc6262b5a Bump bpf-tools to v1.21 2021-12-21 16:40:42 -08:00
Michael Vines b8837c04ec Reformat imports to a consistent style for imports
rustfmt.toml configuration:
  imports_granularity = "One"
  group_imports = "One"
2021-12-03 09:19:13 -08:00
Dmitri Makarov bae5dae61d Bump bpf-tools to v1.20
- Fix C standard library to include only reentrant versions of functions
- Use a version of solana_rbpf with fixed relocations handling
- Add a test of using C standard library functions in on-chain program
2021-11-18 20:50:58 -08:00
Dmitri Makarov 3f4f05865d
Bump bpf-tools to v1.19 (#21256)
Toolchain upgrade to rust 1.56.0 and clang 13.0.
2021-11-13 19:36:28 +00:00
Dmitri Makarov 55d19e61da
Make cargo-build-bpf clean up after failed installation of bpf-tools (#21143) 2021-11-03 21:06:14 +00:00
Dmitri Makarov b9eee66f94
Add cargo-build-bpf logic to recover from failed package downloads (#21138) 2021-11-02 22:41:06 +00:00
Dmitri Makarov 4287bf6b8b
Bump bpf-tools to v1.18 (#20991)
- added newlib standard C library to clang toolchain
- fixed BPF backend bug that accidentally deleted code, issue #20538
2021-10-26 22:51:44 +00:00
Justin Starry 76176a4620
Recover from interrupted bpf sdk installs (#19651) 2021-09-06 01:59:58 -07:00
Kenta Iwasaki 4ad7069827 cargo-build-bpf: allow sdk path to be set by environment variables
In many Linux distros such as NixOS, the directory in which packages are
installed is assumed to be read-only. To work around this, it is
expected that the filepaths which packaged CLI tools take in are able to
be freely configured through either 1) command-line flags, 2)
environment variables, or 3) a configuration file.

In this commit, environment variables 'BPF_SDK_PATH' and 'BPF_OUT_PATH',
which map respectively to command-line flags '--bpf-sdk-path' and
'--bpf-out-dir', are now handled in cargo-build-bpf.

Additionally, given that arbitrary filepaths may now be set in which the
BPF SDK is located, the requirement in which
'$BPF_SDK_PATH/dependencies/bpf-tools' must strictly be a symbolic link
to the directory '$HOME/.cache/solana/${bpf-tools.version}/bpf-tools has
been relaxed.

Ideally, the directory in which bpf-tools is expected to be downloaded
to and stored should be configurable. Though, this commit serves as a
temporary fix which enables NixOS users to now start being able to build
applications with the Solana SDK.
2021-08-30 23:11:48 +02:00
Jack May a89f180145
Allow closing upgradeable program accounts (#19319) 2021-08-24 10:05:54 -07:00
Dmitri Makarov d6a2b70438
Bump bpf-tools to v1.15 (#19117)
- update to rust 1.54.0
2021-08-10 07:21:14 +00:00
Dmitri Makarov cde1461555
Bump bpf-tools to v1.14 (#19023)
- improved memory operations performance
- minor fixes
2021-08-03 09:13:58 +00:00
Dmitri Makarov d117be6792
Reword help of generate-child-script-on-failure cargo bpf tools option (#18685) 2021-07-15 03:31:33 +00:00
Dmitri Makarov 6f72f8b1fc
Generate a script to rerun the failed sub-command in cargo-test-bpf (#18582)
* Generate a script to rerun the failed sub-command in cargo-test-bpf

* Generate a script to rerun the failed sub-command in cargo-build-bpf

* Add cargo-build-bpf test for generate-child-script-on-failure option
2021-07-15 01:02:42 +00:00
Dmitri Makarov cf9a4575ae
Prevent duplication of RUSTFLAGS settings in cargo-build-bpf subprocesses (#18576) 2021-07-11 01:24:26 +00:00
Dmitri Makarov e752299ac5 Bump bpf-tools version
Update Rust BPF to version 1.53
2021-07-07 05:08:40 -07:00
Dmitri Makarov cf25729eaa Add cargo-build-bpf integration tests 2021-07-01 06:47:25 -07:00
Dmitri Makarov e98a7504f2 Bump bpf-tools version to 1.12 2021-06-25 18:00:44 -07:00
Dmitri Makarov d6bad60c1b
Bump bpf-tools version to 1.11 (#18079)
Avoid including local paths in compiler generated ELF files
2021-06-19 01:00:59 +00:00
Alexander Meißner 6514096a67 chore: cargo +nightly clippy --fix -Z unstable-options 2021-06-18 10:42:46 -07:00
Dmitri Makarov 3570b00560 Make cargo-build-bpf pass additional options to cargo build command
Users need to be able to pass additional command line options such as
-p that are not supported by 'cargo build-bpf' but are meaningful for
the 'cargo build' command.  This change allows cargo-build-bpf to pass
all command line options specified after '--' option to 'cargo build'.
2021-06-18 10:20:35 -07:00
dependabot[bot] d99b8f10d0
chore: bump cargo_metadata from 0.12.0 to 0.13.1 (#17999)
* chore: bump cargo_metadata from 0.12.0 to 0.13.1

Bumps [cargo_metadata](https://github.com/oli-obk/cargo_metadata) from 0.12.0 to 0.13.1.
- [Release notes](https://github.com/oli-obk/cargo_metadata/releases)
- [Commits](https://github.com/oli-obk/cargo_metadata/commits)

---
updated-dependencies:
- dependency-name: cargo_metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Accommodate type change

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-06-16 17:50:22 +00:00
Dmitri Makarov 32742df1b4 Add build script to extract a list of registered syscalls
The list is used in cargo-build-bpf to check generated .so modules for
undefined symbols that are not known run-time syscalls.
2021-06-14 04:51:30 -07:00
Dmitri Makarov 3026954d71 Update RUSTFLAGS if it is set, instead of overriding in build-bpf 2021-06-11 13:19:43 -07:00
Dmitri Makarov c684e2bdc0
Check for undefined symbols in .so and warn about run-time errors (#17850) 2021-06-10 22:23:09 +00:00
Dmitri Makarov 2fe211c5e0
Remove O2 option for compiling BPF programs (#17865)
rustc default compiler optimization level is O3. This change removes
the option that overrides the default optimization level, because it
is safe to do so.  The code generation is incorrect in some cases
because of link-time optimizations, which remain disabled for
compiling BPF programs.  In addition, this commit updates the expected
instruction counts for assert_instruction_count test.
2021-06-10 05:04:17 +00:00
Dmitri Makarov d7a0fd8afa
Print commands output in cargo-build-bpf if verbose option is set (#17845) 2021-06-08 20:55:33 +00:00
Dmitri Makarov 910ac94a8c
Fix handling of stale links to bpf-tools in cargo-build-bpf (#17772) 2021-06-07 16:26:01 +00:00
Dmitri Makarov ae0bea1ad3 Bump BPF tools to v1.10 2021-06-04 19:10:23 -07:00
Dmitri Makarov 47861fc373 Bump BPF tools to v1.9 2021-06-03 17:06:49 -07:00
Dmitri Makarov 831e87c65d
Add BPF rustc option to reduce the optimizations to safer level (#17590) 2021-05-28 23:14:53 +00:00
Dmitri Makarov 2316ddb90a
Revert bpf-tools to version 1.8 because of a codegen bug suspicion (#17568) 2021-05-28 09:36:46 +00:00
Lijun Wang 54f0fc9f0f
Use type alias for DownloadProgress callback (#17518)
Convert to use type alias for the callback and cascade the changes to callers. Thanks @jeffwashington for the help making it possible.
Changed the closure for the progress update in the validator main to FnMut and modify the abort count in the closure which is more reliable.
2021-05-26 13:26:07 -07:00
Lijun Wang 4c17243157
snapshot download enhancement (#17415)
1. Allow the validator bootstrap code to specify the minimal snapshot download speed. If the snapshot download speed is detected below that, a different RPC can be retried. The default is 10MB/sec.

2. To prevent spinning on a number of sub-optimal choices and not making progress, the abort/retry logic is implemented with the following safe guards:
2.1 at maximum we do this retry for 5 times -- this number is configurable with default 5.
2.2 if the download in one notification round (5 second) is more than 2%, do not do retry -- it is not as bad anyway.
2.3 if the remaining estimate time is less than 1 minutes, do not abort retry as it will be done quickly anyway.
2.4 We do this abort/retry logic only at the first notification to avoid wasting download efforts -- the reasoning is being opportunistic and too greedy may not achieve overall shorter download time.

3. The download_snapshot and download_file is modified with the option allowing caller to notified of download progress via a callback. This allows the business logic of retrying to the place it belongs.
2021-05-25 09:32:12 -07:00
Dmitri Makarov 2ae57c172a Bump bpf-tools version to 1.9
- upgrade rustc to 1.52.1 and clang to 12.0
2021-05-20 11:35:37 +02:00
Dmitri Makarov ab871ed4b7 Bump bpf-tools version to 1.8 2021-05-18 08:10:57 +02:00
Dmitri Makarov 88626b2945
Bump bpf-tools version to 1.7 (#17176) 2021-05-11 19:51:20 +00:00
Dmitri Makarov 77272a17b3
Fix dump postprocessing in cargo-build-bpf (#17165) 2021-05-11 09:24:12 +00:00
Dmitri Makarov db3bca7edd
Add llvm feature option to compile for Solana BPF target (#16495) 2021-04-13 07:20:18 +00:00
Dmitri Makarov 78d1d59889 Augment BPF binary dumps to resolve call instruction targets 2021-04-12 18:36:41 +02:00
Jack May 878e52f0b9
Fix cargo-build/test-bpf --workspace (#16431) 2021-04-07 17:22:55 -07:00
Dmitri Makarov 1359bceb5d
Bump bpf-tools to version v1.5 (#16331)
The new version of bpf-tools eliminates the separate
rust-bpf-sysroot. The Rust standard libraries for the BPF target are
built in tree when the compiler is built.  The standard libraries code
is slightly more optimized and some reduction of compute budget can be
expected with this version of bpf-tools.
2021-04-04 13:04:22 +00:00
Dmitri Makarov 658ddd1c9c
Bump bpf-tools to version v1.4 (#16152) 2021-03-26 19:21:41 +00:00
Michael Vines 07273bfa9e Show bpf-tools download progress 2021-03-25 12:23:51 -07:00