solana/sdk/bpf/env.sh
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

19 lines
509 B
Bash

#
# Configures the BPF SDK environment
#
if [ -z "$bpf_sdk" ]; then
bpf_sdk=.
fi
# Ensure the sdk is installed
"$bpf_sdk"/scripts/install.sh
# Use the SDK's version of llvm to build the compiler-builtins for BPF
export CC="$bpf_sdk/dependencies/bpf-tools/llvm/bin/clang"
export AR="$bpf_sdk/dependencies/bpf-tools/llvm/bin/llvm-ar"
export OBJDUMP="$bpf_sdk/dependencies/bpf-tools/llvm/bin/llvm-objdump"
export OBJCOPY="$bpf_sdk/dependencies/bpf-tools/llvm/bin/llvm-objcopy"
export RUSTFLAGS="-C lto=no"