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
This commit is contained in:
Dmitri Makarov
2021-10-27 16:07:39 -07:00
committed by Dmitri Makarov
parent c24e30f689
commit bae5dae61d
4 changed files with 23 additions and 2 deletions

View File

@ -0,0 +1,20 @@
/**
* @brief Example C based BPF program that uses C standard
* library functions. The test fails if the C standard
* library is not available.
*
* Only re-entrant versions of standard C library functions are
* available. We have to use the _reent structure and pass a pointer
* to it as a parameter to a re-entrant function. In this test
* _atoi_r is a re-entrant version of the standard atoi function.
*/
#include <sol/assert.h>
#include <stdlib.h>
extern uint64_t entrypoint(const uint8_t *input) {
struct _reent reent;
int value = _atoi_r(&reent, "137");
sol_assert(value == 137);
return SUCCESS;
}

View File

@ -441,6 +441,7 @@ fn test_program_bpf_sanity() {
("sanity++", true),
("secp256k1_recover", true),
("sha", true),
("stdlib", true),
("struct_pass", true),
("struct_ret", true),
]);