tools/objtool/include/objtool/elf.h

Source file repositories/reference/linux-study-clean/tools/objtool/include/objtool/elf.h

File Facts

System
Linux kernel
Corpus path
tools/objtool/include/objtool/elf.h
Extension
.h
Size
15293 bytes
Lines
583
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct elf_hash_node {
	struct elf_hash_node *next;
};

struct section {
	struct list_head list;
	struct elf_hash_node hash;
	struct elf_hash_node name_hash;
	GElf_Shdr sh;
	struct rb_root_cached symbol_tree;
	struct list_head symbol_list;
	struct section *base, *rsec;
	struct symbol *sym;
	Elf_Data *data;
	const char *name;
	int idx;
	bool _changed, text, rodata, noinstr, init, truncate;
	struct reloc *relocs;
	unsigned long nr_alloc_relocs;
	struct section *twin;
};

struct symbol {
	struct list_head list;
	struct list_head global_list;
	struct rb_node node;
	struct elf_hash_node hash;
	struct elf_hash_node name_hash;
	GElf_Sym sym;
	struct section *sec;
	const char *name, *demangled_name;
	unsigned int idx, len;
	unsigned long offset;
	unsigned long __subtree_last;
	struct symbol *pfunc, *cfunc, *alias, *file;
	unsigned char bind, type;
	u8 uaccess_safe      : 1;
	u8 static_call_tramp : 1;
	u8 retpoline_thunk   : 1;
	u8 return_thunk      : 1;
	u8 fentry            : 1;
	u8 profiling_func    : 1;
	u8 warned	     : 1;
	u8 embedded_insn     : 1;
	u8 local_label       : 1;
	u8 frame_pointer     : 1;
	u8 ignore	     : 1;
	u8 nocfi             : 1;
	u8 cold		     : 1;
	u8 prefix	     : 1;
	u8 debug_checksum    : 1;
	u8 changed	     : 1;
	u8 included	     : 1;
	u8 klp		     : 1;
	u8 dont_correlate    : 1;
	struct list_head pv_target;
	struct reloc *relocs;
	struct section *group_sec;
	struct checksum csum;
	struct symbol *twin, *clone;
};

struct reloc {
	struct elf_hash_node hash;
	struct section *sec;
	struct symbol *sym;
	unsigned long _sym_next_reloc;
};

struct elf {
	Elf *elf;
	GElf_Ehdr ehdr;
	int fd;
	bool changed;
	const char *name, *tmp_name;
	unsigned int num_files;
	struct list_head sections;
	struct list_head symbols;
	unsigned long num_relocs;

	int symbol_bits;
	int symbol_name_bits;
	int section_bits;
	int section_name_bits;
	int reloc_bits;

	struct elf_hash_node **symbol_hash;
	struct elf_hash_node **symbol_name_hash;
	struct elf_hash_node **section_hash;
	struct elf_hash_node **section_name_hash;

Annotation

Implementation Notes