Does Rust has a way to specify where to place the binary in the section of compiled elf binary? Like attribute((section(NAME), used)) in C? One usage is: bpf_helpers.h - samples/bpf/bpf_helpers.h - Linux source code (v4.11.1) - Bootlin For example, the code that uses this would be like: tracex1_kern.c - samples/bpf/tracex1_kern.c - Linux source code (v4.11.1) - Bootlin
Yes, you need the link_section
attribute and the used
attribute. At least one or both of these require nightly if I remember correctly.