github.com/cilium/ebpf@v0.15.1-0.20240517100537-8079b37aa138/testdata/constants.c (about)

     1  /* This file exercises the ELF loader. It is not a valid BPF program. */
     2  
     3  #include "common.h"
     4  
     5  char __license[] __section("license") = "MIT";
     6  
     7  /*
     8   * Maps with the Freeze flag set (like .rodata) must be frozen before sending
     9   * programs to the verifier so constants can be used during verification. If
    10   * done incorrectly, the following sk_lookup program will fail to verify since
    11   * the only valid return code is 1. See bpf/verifier.c:check_return_code().
    12   */
    13  volatile const uint32_t ret = -1;
    14  __section("sk_lookup/") int freeze_rodata() {
    15  	return ret;
    16  }