LLVM 17.0.0git
Classes | Namespaces | Macros | Enumerations
BTF.h File Reference

This file contains the layout of .BTF and .BTF.ext ELF sections. More...

#include <cstdint>
#include "BTF.def"

Go to the source code of this file.

Classes

struct  llvm::BTF::Header
 The .BTF section header definition. More...
 
struct  llvm::BTF::CommonType
 The BTF common type definition. More...
 
struct  llvm::BTF::BTFEnum
 BTF_KIND_ENUM is followed by multiple "struct BTFEnum". More...
 
struct  llvm::BTF::BTFEnum64
 BTF_KIND_ENUM64 is followed by multiple "struct BTFEnum64". More...
 
struct  llvm::BTF::BTFArray
 BTF_KIND_ARRAY is followed by one "struct BTFArray". More...
 
struct  llvm::BTF::BTFMember
 BTF_KIND_STRUCT and BTF_KIND_UNION are followed by multiple "struct BTFMember". More...
 
struct  llvm::BTF::BTFParam
 BTF_KIND_FUNC_PROTO are followed by multiple "struct BTFParam". More...
 
struct  llvm::BTF::BTFDataSec
 BTF_KIND_DATASEC are followed by multiple "struct BTFDataSecVar". More...
 
struct  llvm::BTF::ExtHeader
 The .BTF.ext section header definition. More...
 
struct  llvm::BTF::BPFFuncInfo
 Specifying one function info. More...
 
struct  llvm::BTF::SecFuncInfo
 Specifying function info's in one section. More...
 
struct  llvm::BTF::BPFLineInfo
 Specifying one line info. More...
 
struct  llvm::BTF::SecLineInfo
 Specifying line info's in one section. More...
 
struct  llvm::BTF::BPFFieldReloc
 Specifying one offset relocation. More...
 
struct  llvm::BTF::SecFieldReloc
 Specifying offset relocation's in one section. More...
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 
namespace  llvm::BTF
 

Macros

#define HANDLE_BTF_KIND(ID, NAME)   BTF_KIND_##NAME = ID,
 

Enumerations

enum  : uint32_t { llvm::BTF::MAGIC = 0xeB9F , llvm::BTF::VERSION = 1 }
 
enum  {
  llvm::BTF::HeaderSize = 24 , llvm::BTF::ExtHeaderSize = 32 , llvm::BTF::CommonTypeSize = 12 , llvm::BTF::BTFArraySize = 12 ,
  llvm::BTF::BTFEnumSize = 8 , llvm::BTF::BTFEnum64Size = 12 , llvm::BTF::BTFMemberSize = 12 , llvm::BTF::BTFParamSize = 8 ,
  llvm::BTF::BTFDataSecVarSize = 12 , llvm::BTF::SecFuncInfoSize = 8 , llvm::BTF::SecLineInfoSize = 8 , llvm::BTF::SecFieldRelocSize = 8 ,
  llvm::BTF::BPFFuncInfoSize = 8 , llvm::BTF::BPFLineInfoSize = 16 , llvm::BTF::BPFFieldRelocSize = 16
}
 Sizes in bytes of various things in the BTF format. More...
 
enum  : uint32_t { llvm::BTF::MAX_VLEN = 0xffff }
 
enum  llvm::BTF::TypeKinds : uint8_t
 
enum  : uint8_t { llvm::BTF::INT_SIGNED = (1 << 0) , llvm::BTF::INT_CHAR = (1 << 1) , llvm::BTF::INT_BOOL = (1 << 2) }
 Attributes stored in the INT_ENCODING. More...
 
enum  : uint8_t { llvm::BTF::FUNC_STATIC = 0 , llvm::BTF::FUNC_GLOBAL = 1 , llvm::BTF::FUNC_EXTERN = 2 }
 BTF_KIND_FUNC can be global, static or extern. More...
 
enum  : uint8_t { llvm::BTF::VAR_STATIC = 0 , llvm::BTF::VAR_GLOBAL_ALLOCATED = 1 , llvm::BTF::VAR_GLOBAL_EXTERNAL = 2 }
 Variable scoping information. More...
 

Detailed Description

This file contains the layout of .BTF and .BTF.ext ELF sections.

The binary layout for .BTF section: struct Header Type and Str subsections The Type subsection is a collection of types with type id starting with 1. The Str subsection is simply a collection of strings.

The binary layout for .BTF.ext section: struct ExtHeader FuncInfo, LineInfo, FieldReloc and ExternReloc subsections The FuncInfo subsection is defined as below: BTFFuncInfo Size struct SecFuncInfo for ELF section #1 A number of struct BPFFuncInfo for ELF section #1 struct SecFuncInfo for ELF section #2 A number of struct BPFFuncInfo for ELF section #2 ... The LineInfo subsection is defined as below: BPFLineInfo Size struct SecLineInfo for ELF section #1 A number of struct BPFLineInfo for ELF section #1 struct SecLineInfo for ELF section #2 A number of struct BPFLineInfo for ELF section #2 ... The FieldReloc subsection is defined as below: BPFFieldReloc Size struct SecFieldReloc for ELF section #1 A number of struct BPFFieldReloc for ELF section #1 struct SecFieldReloc for ELF section #2 A number of struct BPFFieldReloc for ELF section #2 ...

The section formats are also defined at https://github.com/torvalds/linux/blob/master/include/uapi/linux/btf.h

Definition in file BTF.h.

Macro Definition Documentation

◆ HANDLE_BTF_KIND

#define HANDLE_BTF_KIND (   ID,
  NAME 
)    BTF_KIND_##NAME = ID,

Definition at line 96 of file BTF.h.