Fix missing builtins in C programs linking with compiler_builtins (#17475)

This commit is contained in:
Dmitri Makarov
2021-05-25 19:11:02 +02:00
committed by GitHub
parent a03230338a
commit 3ae4806dae
3 changed files with 23 additions and 2 deletions

View File

@ -0,0 +1,19 @@
/**
* @brief Example C based BPF program that performs operations
* on floating point values. The test fails if floating point
* emulation functions were not linked to the module.
*/
#include <solana_sdk.h>
extern uint64_t entrypoint(const uint8_t *input) {
SolAccountInfo ka[1];
SolParameters params = (SolParameters) { .ka = ka };
if (!sol_deserialize(input, &params, SOL_ARRAY_SIZE(ka))) {
return ERROR_INVALID_ARGUMENT;
}
uint32_t *data = (uint32_t *)(params.ka[0].data);
*data += 1.5;
return SUCCESS;
}