|
GCC Middle and Back End API Reference
|
#include "config.h"#include "system.h"#include "coretypes.h"#include "target.h"#include "memmodel.h"#include "tm_p.h"#include "output.h"#include "dwarf2asm.h"#include "debug.h"#include "ctfc.h"#include "diagnostic-core.h"#include "cgraph.h"#include "varasm.h"#include "stringpool.h"#include "attribs.h"#include "dwarf2out.h"#include "gt-btfout.h"
Data Structures | |
| struct | btf_datasec_entry |
| struct | btf_datasec |
| struct | btf_fixup |
Macros | |
| #define | BTF_INFO_SECTION_NAME ".BTF" |
| #define | BTF_INFO_SECTION_FLAGS (SECTION_DEBUG) |
| #define | MAX_BTF_LABEL_BYTES 40 |
| #define | BTF_INFO_SECTION_LABEL "Lbtf" |
| #define | BTF_INVALID_TYPEID 0xFFFFFFFF |
Typedefs | |
| typedef struct btf_datasec | btf_datasec_t |
Variables | |
| static int | btf_label_num |
| static section * | btf_info_section |
| static char | btf_info_section_label [MAX_BTF_LABEL_BYTES] |
| static vec< btf_datasec_t > | datasecs |
| static vec< ctf_dtdef_ref, va_gc > * | funcs |
| static hash_map< ctf_dtdef_ref, ctf_dtdef_ref > * | func_map |
| static ctf_id_t | max_translated_id = 0 |
| static const char *const | btf_kind_names [] |
| static hash_set< ctf_dtdef_ref > * | btf_used_types |
| static vec< struct btf_fixup > | fixups |
| static vec< ctf_dtdef_ref, va_gc > * | forwards |
| #define BTF_INFO_SECTION_FLAGS (SECTION_DEBUG) |
Referenced by init_btf_sections().
| #define BTF_INFO_SECTION_LABEL "Lbtf" |
Referenced by init_btf_sections().
| #define BTF_INFO_SECTION_NAME ".BTF" |
BTF debug info section.
Referenced by init_btf_sections().
| #define BTF_INVALID_TYPEID 0xFFFFFFFF |
Referenced by btf_collect_translated_types().
| #define MAX_BTF_LABEL_BYTES 40 |
Maximum size (in bytes) for an artificially generated BTF label.
| typedef struct btf_datasec btf_datasec_t |
Internal representation of a BTF_KIND_DATASEC record.
|
static |
Workaround for 'const void' variables. These variables are sometimes used in eBPF programs to address kernel symbols. DWARF does not generate const qualifier on void type, so we would incorrectly emit these variables without the const qualifier. Find any such variables, and update them to refer to a new 'const' modifier type for void.
References btf_add_const_void(), ctf_add_reftype(), CTF_ADD_ROOT, ctf_dvd_lookup(), symtab_node::decl, ctf_dvdef::dvd_type, FOR_EACH_VARIABLE, lookup_decl_die(), NULL, TREE_TYPE, TYPE_READONLY, and VOID_TYPE_P.
Referenced by btf_add_const_void(), and btf_early_finish().
|
static |
Add datasec entries for functions to CTFC.
References btf_add_func_datasec_entries(), btf_datasec_add_func(), ctf_dtd_lookup(), symtab_node::decl, DECL_EXTERNAL, FOR_EACH_FUNCTION, func_map, lookup_decl_die(), and NULL.
Referenced by btf_add_func_datasec_entries(), and btf_finish().
|
static |
Functions actually get two type records: a BTF_KIND_FUNC_PROTO, and also a BTF_KIND_FUNC. But the CTF container only allocates one type per function, which matches closely with BTF_KIND_FUNC_PROTO. For each such function, construct a BTF_KIND_FUNC entry. This is done early, because we want FUNC records even for functions which are later inlined by optimizations.
References btf_add_func_records(), ctf_dtd_lookup(), symtab_node::decl, DECL_ATTRIBUTES, DECL_EXTERNAL, ctf_dtdef::dtd_data, ctf_dtdef::dtd_name, FOR_EACH_FUNCTION, func_map, funcs, ggc_cleared_alloc(), ctf_dtdef::linkage, lookup_attribute(), lookup_decl_die(), NULL, NULL_TREE, ctf_dtdef::ref_type, and vec_safe_push().
Referenced by btf_add_func_records(), and btf_early_finish().
|
static |
Recursively add type DTD and any types it references to the used set. Return a type that should be used for references to DTD - usually DTD itself, but may be NULL if DTD corresponds to a type which will not be emitted.
References btf_add_used_type(), and btf_add_used_type_1().
Referenced by btf_add_used_type(), btf_add_vars(), btf_collect_pruned_types(), and btf_mark_type_used().
|
static |
Implementation of btf_add_used_type. Recursively add type DTD and any types it references to the used set. Return a type that should be used for references to DTD - usually DTD itself, but may be NULL if DTD corresponds to a type which will not be emitted. CHECK_PTR is true if one of the predecessors in recursive calls is a struct or union member. SEEN_PTR is true if CHECK_PTR is true AND one of the predecessors was a pointer type. These two flags are used to avoid chasing pointers to struct/union only used from pointer members. For such types, we will emit a forward instead of the full type information, unless CREATE_FIXUPS is false.
References btf_add_used_type_1(), btf_calc_num_vbytes(), btf_dtd_kind(), btf_used_types, ctf_add_string(), ctf_dmd_list_next, ctf_farg_list_next, CTF_STRTAB, ctf_arinfo::ctr_contents, ctf_arinfo::ctr_index, ctf_dmdef::dmd_name, ctf_dmdef::dmd_name_offset, ctf_dmdef::dmd_type, ctf_func_arg::farg_type, fixups, gcc_assert, gcc_unreachable, get_btf_kind(), i, NULL, and btf_fixup::pointer_dtd.
Referenced by btf_add_used_type(), and btf_add_used_type_1().
|
static |
Add BTF_KIND_VAR records for variables.
References btf_add_used_type(), btf_add_vars(), btf_datasec_add_var(), btf_dtd_kind(), btf_emit_variable_p(), ctf_dmd_list_next, ctf_container::ctfc_vars, ctf_container::ctfc_vars_list, ctf_container::ctfc_vars_list_count, symtab_node::decl, DECL_EXTERNAL, ctf_dmdef::dmd_type, ctf_dvdef::dvd_type, ctf_dvdef::dvd_visibility, hash_table< Descriptor, Lazy, Allocator >::elements(), FOR_EACH_VARIABLE, symtab_node::get_section(), ggc_vec_alloc(), and NULL.
Referenced by btf_add_vars(), and btf_finish().
|
static |
Asm'out the variable information following a BTF_KIND_ARRAY.
References btf_asm_array(), btf_asm_type_ref(), ctf_arinfo::ctr_contents, ctf_arinfo::ctr_index, ctf_arinfo::ctr_nelems, and dw2_asm_output_data().
Referenced by btf_asm_array(), and output_asm_btf_vlen_bytes().
|
static |
Asm'out a variable entry following a BTF_KIND_DATASEC.
References btf_asm_datasec_entry(), btf_asm_type_ref(), btf_with_core_debuginfo_p(), dw2_asm_output_data(), dw2_asm_output_offset(), btf_datasec_entry::is_var, NULL, and btf_datasec_entry::size.
Referenced by btf_asm_datasec_entry(), and btf_asm_datasec_type().
|
static |
Asm'out a whole BTF_KIND_DATASEC, including its variable entries.
References btf_asm_datasec_entry(), btf_asm_datasec_type(), dw2_asm_output_data(), btf_datasec::entries, i, btf_datasec::id, btf_datasec::name, btf_datasec::name_offset, and PRIu64.
Referenced by btf_asm_datasec_type(), and output_btf_datasec_types().
|
static |
Asm'out an enum constant following a BTF_KIND_ENUM{,64}.
References btf_asm_enum_const(), ctf_dmdef::dmd_name, ctf_dmdef::dmd_name_offset, ctf_dmdef::dmd_value, and dw2_asm_output_data().
Referenced by btf_asm_enum_const(), and output_asm_btf_enum_list().
|
static |
Asm'out a function parameter description following a BTF_KIND_FUNC_PROTO.
References btf_asm_func_arg(), btf_asm_type_ref(), dw2_asm_output_data(), ctf_func_arg::farg_name, ctf_func_arg::farg_name_offset, ctf_func_arg::farg_type, and NULL.
Referenced by btf_asm_func_arg(), and output_asm_btf_func_args_list().
|
static |
Asm'out a BTF_KIND_FUNC type.
References btf_asm_func_type(), btf_asm_type_ref(), dw2_asm_output_data(), get_btf_type_name(), and PRIu64.
Referenced by btf_asm_func_type(), and output_btf_func_types().
|
static |
Asm'out a member description following a BTF_KIND_STRUCT or BTF_KIND_UNION.
References btf_asm_sou_member(), btf_asm_type_ref(), btf_dmd_representable_bitfield_p(), ctf_itype::ctti_info, ctf_dmdef::dmd_name, ctf_dmdef::dmd_name_offset, ctf_dmdef::dmd_offset, ctf_dmdef::dmd_type, ctf_dtdef::dtd_data, ctf_dtdef::dtd_u, dw2_asm_output_data(), and NULL.
Referenced by btf_asm_sou_member(), and output_asm_btf_sou_fields().
|
static |
Asm'out a BTF type. This routine is responsible for the bulk of the task of converting CTF types to their BTF representation.
References btf_asm_type(), btf_asm_type_ref(), btf_dmd_representable_bitfield_p(), btf_dtd_kind(), btf_kind_name(), ctf_dmd_list_next, ctf_dvdef::dvd_id, ctf_dvdef::dvd_name, dw2_asm_output_data(), gcc_assert, get_btf_type_name(), NULL, and PRIu64.
Referenced by btf_asm_type(), and output_asm_btf_type().
|
static |
BTF asm helper routines.
Asm'out a reference to another BTF type.
References btf_asm_type_ref(), btf_dtd_kind(), btf_emit_type_p(), btf_fwd_to_enum_p(), btf_kind_name(), dw2_asm_output_data(), get_btf_type_name(), and max_translated_id.
Referenced by btf_asm_array(), btf_asm_datasec_entry(), btf_asm_func_arg(), btf_asm_func_type(), btf_asm_sou_member(), btf_asm_type(), btf_asm_type_ref(), and btf_asm_varent().
|
static |
Asm'out a BTF_KIND_VAR.
References btf_asm_type_ref(), btf_asm_varent(), ctf_dvdef::dvd_id, ctf_dvdef::dvd_name, ctf_dvdef::dvd_name_offset, ctf_dvdef::dvd_type, ctf_dvdef::dvd_visibility, dw2_asm_output_data(), and PRIu64.
Referenced by btf_asm_varent(), and output_btf_vars().
|
static |
Assign BTF IDs for datasec records and account for their size.
References btf_assign_datasec_ids(), CTF_STRTAB, ctfc_get_strtab_len(), ctf_container::ctfc_nextid, ctf_container::ctfc_num_types, ctf_container::ctfc_num_vlen_bytes, datasecs, and i.
Referenced by btf_assign_datasec_ids(), and btf_finish().
|
static |
Assign BTF IDs for FUNC records and account for their size.
References btf_assign_func_ids(), ctf_container::ctfc_nextid, ctf_container::ctfc_num_types, FOR_EACH_VEC_ELT, funcs, and i.
Referenced by btf_assign_func_ids(), and btf_finish().
|
static |
Assign BTF IDs for type and decl tags and account for their size.
References btf_assign_tag_ids(), btf_calc_num_vbytes(), CTF_STRTAB, ctfc_get_strtab_len(), ctf_container::ctfc_nextid, ctf_container::ctfc_num_types, ctf_container::ctfc_num_vlen_bytes, ctf_container::ctfc_tags, FOR_EACH_VEC_ELT, func_map, gcc_assert, i, NULL, and vec_safe_length().
Referenced by btf_assign_tag_ids(), and btf_finish().
|
static |
Assign BTF IDs for variables and account for their size.
References btf_assign_var_ids(), ctf_container::ctfc_nextid, ctf_container::ctfc_num_types, ctf_container::ctfc_num_vlen_bytes, ctf_container::ctfc_vars_list, ctf_container::ctfc_vars_list_count, ctf_dvdef::dvd_id, gcc_assert, and i.
Referenced by btf_assign_var_ids(), and btf_finish().
|
static |
Each BTF type can be followed additional, variable-length information completing the description of the type. Calculate the number of bytes of variable information required to encode a given type.
References btf_calc_num_vbytes(), and btf_dtd_kind().
Referenced by btf_add_used_type_1(), btf_assign_tag_ids(), btf_calc_num_vbytes(), btf_collect_pruned_types(), and btf_collect_translated_types().
|
static |
Collect the set of types reachable from global variables and functions. This is the minimal set of types, used when generating pruned BTF.
References btf_add_used_type(), btf_calc_num_vbytes(), btf_collect_pruned_types(), btf_dtd_kind(), btf_used_type_list_cb(), btf_used_types, ctf_add_string(), CTF_STRTAB, ctf_container::ctfc_nextid, ctf_container::ctfc_num_types, ctf_container::ctfc_num_vlen_bytes, ctf_container::ctfc_tags, ctf_container::ctfc_types_list, ctf_container::ctfc_vars_list, ctf_container::ctfc_vars_list_count, ctf_itype::ctti_info, ctf_itype::ctti_name, ctf_dtdef::dtd_data, ctf_dtdef::dtd_name, ctf_dtdef::dtd_type, ctf_dvdef::dvd_name, ctf_dvdef::dvd_name_offset, ctf_dvdef::dvd_type, fixups, FOR_EACH_VEC_ELT, forwards, func_map, funcs, gcc_assert, ggc_cleared_alloc(), ggc_vec_alloc(), i, max_translated_id, NULL, btf_fixup::pointee_dtd, btf_fixup::pointer_dtd, ctf_dtdef::ref_type, vec_alloc(), vec_safe_length(), and vec_safe_push().
Referenced by btf_collect_pruned_types(), and btf_finish().
|
static |
Construct the initial type list and assign BTF IDs for all types translated from CTF.
References btf_calc_num_vbytes(), btf_collect_translated_types(), btf_emit_type_p(), BTF_INVALID_TYPEID, btf_type_list_cb(), ctf_container::ctfc_nextid, ctf_container::ctfc_num_types, ctf_container::ctfc_num_vlen_bytes, ctf_container::ctfc_types, ctf_container::ctfc_types_list, hash_table< Descriptor, Lazy, Allocator >::elements(), ggc_vec_alloc(), i, max_translated_id, and hash_table< Descriptor, Lazy, Allocator >::traverse().
Referenced by btf_collect_translated_types(), and btf_finish().
|
static |
Create a datasec entry for a function, and insert it into the datasec record for the appropriate section. Create the record if it does not yet exist.
References btf_datasec_add_func(), btf_datasec_push_entry(), gcc_assert, get_section_name(), btf_datasec_entry::is_var, NULL, and btf_datasec_entry::size.
Referenced by btf_add_func_datasec_entries(), and btf_datasec_add_func().
|
static |
Create a datasec entry for a variable, and insert it into the datasec record for the appropriate section. Create the record if it does not yet exist.
References btf_datasec_add_var(), btf_datasec_push_entry(), symtab_node::decl, DECL_EXTERNAL, DECL_SIZE_UNIT, gcc_assert, symtab_node::get_section(), get_section_name(), btf_datasec_entry::is_var, NULL, btf_datasec_entry::size, tree_fits_uhwi_p(), tree_to_uhwi(), TREE_TYPE, and VOID_TYPE_P.
Referenced by btf_add_vars(), and btf_datasec_add_var().
|
static |
Push a BTF datasec entry ENTRY into the datasec named SECNAME, creating the datasec record if it does not already exist.
References btf_datasec_push_entry(), ctf_add_string(), CTF_AUX_STRTAB, ctf_container::ctfc_aux_strlen, datasecs, btf_datasec::entries, i, btf_datasec::name, btf_datasec::name_offset, and NULL.
Referenced by btf_datasec_add_func(), btf_datasec_add_var(), and btf_datasec_push_entry().
|
static |
Return true iff DMD is a member description of a bit-field which can be validly represented in BTF.
References btf_dmd_representable_bitfield_p(), ctf_itype::ctti_info, ctf_dmdef::dmd_offset, ctf_dmdef::dmd_type, ctf_dtdef::dtd_data, and ctf_dtdef::dtd_u.
Referenced by btf_asm_sou_member(), btf_asm_type(), and btf_dmd_representable_bitfield_p().
| uint32_t btf_dtd_kind | ( | ctf_dtdef_ref | dtd | ) |
Convenience wrapper around get_btf_kind for the common case.
References btf_dtd_kind(), and get_btf_kind().
Referenced by btf_add_used_type_1(), btf_add_vars(), btf_asm_type(), btf_asm_type_ref(), btf_calc_num_vbytes(), btf_collect_pruned_types(), btf_dtd_kind(), btf_emit_type_p(), btf_fwd_to_enum_p(), and output_asm_btf_vlen_bytes().
| void btf_early_finish | ( | void | ) |
Initial entry point of BTF generation, called at early_finish () after CTF information has possibly been output. Translate all CTF information to BTF, and do any processing that must be done early, such as creating BTF_KIND_FUNC records.
References btf_add_const_void(), btf_add_func_records(), btf_early_finish(), btf_used_types, hash_map< KeyId, Value, Traits >::create_ggc(), hash_set< KeyId, Lazy, Traits >::create_ggc(), ctf_get_tu_ctfc(), ctfc_delete_strtab(), ctf_container::ctfc_nextid, ctf_container::ctfc_num_types, ctf_container::ctfc_num_vlen_bytes, ctf_container::ctfc_strlen, ctf_container::ctfc_strtable, ctf_container::ctfc_types, ctf_container::ctfc_vars_list_count, hash_table< Descriptor, Lazy, Allocator >::elements(), fixups, func_map, funcs, init_ctf_strtable(), tu_ctfc, and vec_alloc().
Referenced by btf_early_finish(), and ctf_debug_early_finish().
|
static |
References btf_dtd_kind(), and btf_emit_type_p().
Referenced by btf_asm_type_ref(), btf_collect_translated_types(), btf_emit_type_p(), btf_emit_variable_p(), and output_asm_btf_type().
|
static |
Helper function used to determine whether or not a BTF_KIND_VAR record for the variable VAR shall be emitted.
References btf_emit_type_p(), btf_emit_variable_p(), ctf_dvd_ignore_lookup(), ctf_dvd_lookup(), symtab_node::decl, ctf_dvdef::dvd_key, ctf_dvdef::dvd_type, lookup_decl_die(), and NULL.
Referenced by btf_add_vars(), and btf_emit_variable_p().
| void btf_finalize | ( | void | ) |
Reset all state for BTF generation so that we can rerun the compiler within the same process.
References btf_finalize(), btf_info_section, btf_used_types, ctf_get_tu_ctfc(), ctfc_delete_container(), datasecs, fixups, forwards, func_map, funcs, i, max_translated_id, NULL, and tu_ctfc.
Referenced by btf_finalize(), and btf_finish().
| void btf_finish | ( | void | ) |
Late entry point for BTF generation, called from dwarf2out_finish (). Complete and emit BTF information.
References btf_add_func_datasec_entries(), btf_add_vars(), btf_assign_datasec_ids(), btf_assign_func_ids(), btf_assign_tag_ids(), btf_assign_var_ids(), btf_collect_pruned_types(), btf_collect_translated_types(), btf_finalize(), btf_finish(), btf_output(), btf_with_core_debuginfo_p(), ctf_get_tu_ctfc(), datasecs, init_btf_sections(), and tu_ctfc.
Referenced by btf_finish(), ctf_debug_early_finish(), and ctf_debug_finish().
|
static |
Return true if DTD is a forward-declared enum. The BTF representation of forward declared enums is not formally defined.
References btf_dtd_kind(), and btf_fwd_to_enum_p().
Referenced by btf_asm_type_ref(), and btf_fwd_to_enum_p().
|
static |
Return a name string for the given BTF_KIND.
References btf_kind_name(), and btf_kind_names.
Referenced by btf_asm_type(), btf_asm_type_ref(), and btf_kind_name().
| void btf_mark_type_used | ( | tree | t | ) |
Manually mark that type T is used to ensure it will not be pruned. Used by the BPF backend when generating BPF CO-RE to mark types used in CO-RE relocations.
References btf_add_used_type(), btf_mark_type_used(), ctf_get_tu_ctfc(), ctf_lookup_tree_type(), gcc_assert, and TYPE_P.
Referenced by btf_mark_type_used().
| void btf_output | ( | ctf_container_ref | ctfc | ) |
Write out all BTF debug info.
References btf_output(), output_btf_datasec_types(), output_btf_func_types(), output_btf_header(), output_btf_strs(), output_btf_tags(), output_btf_types(), and output_btf_vars().
Referenced by btf_finish(), and btf_output().
|
static |
Callback used by btf_assign_type_ids to insert types into their initial positions in the type list.
References btf_type_list_cb(), and ctf_container::ctfc_types_list.
Referenced by btf_collect_translated_types(), and btf_type_list_cb().
|
static |
Callback used for assembling the only-used-types list. Note that this is the same as btf_type_list_cb above, but the hash_set traverse requires a different function signature.
References btf_used_type_list_cb(), and ctf_container::ctfc_types_list.
Referenced by btf_collect_pruned_types(), and btf_used_type_list_cb().
|
static |
Map a CTF type kind to the corresponding BTF type kind.
References get_btf_kind().
Referenced by btf_add_used_type_1(), btf_dtd_kind(), and get_btf_kind().
|
static |
Some BTF types, like BTF_KIND_FUNC_PROTO, are anonymous. The machinery in btfout to emit BTF, may reset dtd_data->ctti_name, but does not update the name in the ctf_dtdef_ref type object (deliberate choice). This interface helps abstract out that state of affairs, while giving access to the name of the type as intended.
References get_btf_type_name().
Referenced by btf_asm_func_type(), btf_asm_type(), btf_asm_type_ref(), and get_btf_type_name().
|
static |
Return the section name, as of interest to btf_collect_datasec, for the given symtab node. Note that this deliberately returns NULL for objects which do not go in a section btf_collect_datasec cares about.
References categorize_decl_for_section(), get_section_name(), NULL, SECCAT_BSS, SECCAT_DATA, and SECCAT_RODATA.
Referenced by btf_datasec_add_func(), btf_datasec_add_var(), and get_section_name().
| void init_btf_sections | ( | void | ) |
Initialize BTF section (.BTF) for output.
References btf_info_section, BTF_INFO_SECTION_FLAGS, BTF_INFO_SECTION_LABEL, btf_info_section_label, BTF_INFO_SECTION_NAME, btf_label_num, get_section(), init_btf_sections(), and NULL.
Referenced by btf_finish(), and init_btf_sections().
|
static |
Output all enumerator constants following a BTF_KIND_ENUM{,64}.
References btf_asm_enum_const(), ctf_dmd_list_next, NULL, and output_asm_btf_enum_list().
Referenced by output_asm_btf_enum_list(), and output_asm_btf_vlen_bytes().
|
static |
Output all function arguments following a BTF_KIND_FUNC_PROTO.
References btf_asm_func_arg(), ctf_farg_list_next, CTF_STRTAB, ctfc_get_strtab_len(), NULL, and output_asm_btf_func_args_list().
Referenced by output_asm_btf_func_args_list(), and output_asm_btf_vlen_bytes().
|
static |
Output all (representable) members of a BTF_KIND_STRUCT or BTF_KIND_UNION type.
References btf_asm_sou_member(), ctf_dmd_list_next, NULL, and output_asm_btf_sou_fields().
Referenced by output_asm_btf_sou_fields(), and output_asm_btf_vlen_bytes().
|
static |
Output a whole BTF type record for TYPE, including the fixed and variable data portions.
References btf_asm_type(), btf_emit_type_p(), output_asm_btf_type(), and output_asm_btf_vlen_bytes().
Referenced by output_asm_btf_type(), output_btf_tags(), and output_btf_types().
|
static |
Output the variable portion of a BTF type record. The information depends on the kind of the type.
References btf_asm_array(), btf_dtd_kind(), dw2_asm_output_data(), gcc_unreachable, output_asm_btf_enum_list(), output_asm_btf_func_args_list(), output_asm_btf_sou_fields(), and output_asm_btf_vlen_bytes().
Referenced by output_asm_btf_type(), and output_asm_btf_vlen_bytes().
|
static |
Output all BTF_KIND_DATASEC records.
References btf_asm_datasec_type(), datasecs, i, and output_btf_datasec_types().
Referenced by btf_output(), and output_btf_datasec_types().
|
static |
Output all BTF_KIND_FUNC type records.
References btf_asm_func_type(), FOR_EACH_VEC_ELT, funcs, i, and output_btf_func_types().
Referenced by btf_output(), and output_btf_func_types().
|
static |
Compute and output the header information for a .BTF section.
References asm_out_file, ASM_OUTPUT_LABEL, btf_info_section, btf_info_section_label, ctfc_is_empty_container(), ctf_container::ctfc_num_types, ctf_container::ctfc_num_vlen_bytes, dw2_asm_output_data(), output_btf_header(), and switch_to_section().
Referenced by btf_output(), and output_btf_header().
|
static |
Output BTF string records. The BTF strings section is a concatenation of the standard and auxiliary string tables in the ctf container.
References ctf_container::ctfc_aux_strtable, ctf_container::ctfc_strtable, ctf_string::cts_next, ctf_string::cts_str, ctf_strtable::ctstab_head, dw2_asm_output_nstring(), and output_btf_strs().
Referenced by btf_output(), and output_btf_strs().
|
static |
References ctf_container::ctfc_tags, FOR_EACH_VEC_ELT, i, output_asm_btf_type(), and output_btf_tags().
Referenced by btf_output(), and output_btf_tags().
|
static |
Output all BTF types in the container. This does not include synthesized types: BTF_KIND_VAR, BTF_KIND_FUNC, nor BTF_KIND_DATASEC.
References ctf_container::ctfc_types, ctf_container::ctfc_types_list, hash_table< Descriptor, Lazy, Allocator >::elements(), i, max_translated_id, output_asm_btf_type(), and output_btf_types().
Referenced by btf_output(), and output_btf_types().
|
static |
Output all BTF_KIND_VARs in CTFC.
References btf_asm_varent(), ctf_container::ctfc_vars_list, ctf_container::ctfc_vars_list_count, i, and output_btf_vars().
Referenced by btf_output(), and output_btf_vars().
| bool traverse_btf_func_types | ( | funcs_traverse_callback | callback, |
| void * | data ) |
Traversal function for all BTF_KIND_FUNC type records.
References FOR_EACH_VEC_ELT, funcs, i, and traverse_btf_func_types().
Referenced by traverse_btf_func_types().
|
static |
Referenced by btf_finalize(), init_btf_sections(), and output_btf_header().
|
static |
Referenced by init_btf_sections(), and output_btf_header().
|
static |
Name strings for BTF kinds. Note: the indices here must match the type defines in btf.h.
Referenced by btf_kind_name().
|
static |
Output BTF format from GCC. Copyright (C) 2021-2026 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
This file contains routines to output the BPF Type Format (BTF). The BTF debug format is very similar to CTF; as a result, the structure of this file closely resembles that of ctfout.cc, and the same CTF container objects are used.
Referenced by init_btf_sections().
|
static |
The set of types used directly in the source program, and any types manually marked as used. This is the set of types which will be emitted when flag_prune_btf is set.
Referenced by btf_add_used_type_1(), btf_collect_pruned_types(), btf_early_finish(), and btf_finalize().
|
static |
One BTF_KIND_DATASEC record is created for each output data section which will hold at least one variable.
Referenced by btf_assign_datasec_ids(), btf_datasec_push_entry(), btf_finalize(), btf_finish(), and output_btf_datasec_types().
Stores fixups while processing types.
Referenced by btf_add_used_type_1(), btf_collect_pruned_types(), btf_early_finish(), and btf_finalize().
|
static |
For fixups where the underlying type is not used in the end, a BTF_KIND_FWD is created and emitted. This vector stores them.
Referenced by btf_collect_pruned_types(), and btf_finalize().
|
static |
Maps BTF_KIND_FUNC_PROTO to the BTF_KIND_FUNC record for it. Used when creating DATASEC entries.
Referenced by btf_add_func_datasec_entries(), btf_add_func_records(), btf_assign_tag_ids(), btf_collect_pruned_types(), btf_early_finish(), and btf_finalize().
|
static |
Functions in BTF have two separate type records - one for the prototype (BTF_KIND_FUNC_PROTO), as well as a BTF_KIND_FUNC. CTF_K_FUNCTION types map closely to BTF_KIND_FUNC_PROTO, but the BTF_KIND_FUNC records must be created. This vector holds them.
Referenced by btf_add_func_records(), btf_assign_func_ids(), btf_collect_pruned_types(), btf_early_finish(), btf_finalize(), output_btf_func_types(), and traverse_btf_func_types().
|
static |
Highest BTF ID assigned to any regular type translated from CTF.
Does not include BTF_KIND_{VAR,FUNC,DATASEC} types.
Referenced by btf_asm_type_ref(), btf_collect_pruned_types(), btf_collect_translated_types(), btf_finalize(), and output_btf_types().