aboutsummaryrefslogtreecommitdiff
path: root/gcc/btfout.c
AgeCommit message (Collapse)AuthorFilesLines
2021-09-29debug/102507: ICE in btf_finalize when compiling with -gbtfIndu Bhagat1-4/+4
Fix the free up of btf_var_ids hash_map in btf_finalize (). gcc/ChangeLog: PR debug/102507 * btfout.c (GTY): Add GTY (()) albeit for cosmetic only purpose. (btf_finalize): Empty the hash_map btf_var_ids.
2021-09-07btf: expose get_btf_idDavid Faust1-1/+1
Expose the function get_btf_id, so that it may be used by the BPF backend. This enables the BPF CO-RE machinery in the BPF backend to lookup BTF type IDs, in order to create CO-RE relocation records. A prototype is added in ctfc.h gcc/ChangeLog: * btfout.c (get_btf_id): Function is no longer static. * ctfc.h: Expose it here.
2021-07-02BTF: Support for BTF_KIND_FLOATDavid Faust1-0/+2
Add BTF_KIND_FLOAT, a new BTF type kind which has recently stabilized in the linux kernel [1]. This kind is used for encoding floating point types, and is of particular use when generating BTF for some s390 arch-specific kernel headers. Also update some BTF tests which previously used floating point types to check correct behavior for types with no BTF representation. [1]: https://github.com/torvalds/linux/commit/b1828f0b04828aa8cccadf00a702f459caefeed9 include/ChangeLog: * btf.h (struct btf_type): Update bit usage comment. (BTF_INFO_KIND): Update bit mask. (BTF_KIND_FLOAT): New define. (BTF_KIND_MAX): Update. gcc/ChangeLog: * btfout.c (get_btf_kind): Support BTF_KIND_FLOAT. (btf_asm_type): Likewise. gcc/testsuite/ChangeLog: * gcc.dg/debug/btf/btf-float-1.c: New test. * gcc.dg/debug/btf/btf-function-3.c: Use different unrepresentable type. * gcc.dg/debug/btf/btf-struct-2.c: Likewise. * gcc.dg/debug/btf/btf-variables-2.c: Likewise.
2021-06-29bootstrap: Include memmodel.h in btfout.c and ctfout.c before tm_p.hJoseph Myers1-0/+1
This fixes a "use of enum 'memmodel' without previous declaration" error in sparc-protos.h. Minimally tested that this fixes the build-many-glibcs.py compilers build for sparc64-linux-gnu. * btfout.c, ctfout.c: Include "memmodel.h".
2021-06-28bootstrap: Include tm_p.h in btfout.c and ctfout.c.David Edelsohn1-0/+1
btfout.c and ctfout.c reference target-specific macros that may reference target-specific functions that are declared in a target-specific header. tm_p.h must be included to provide the target-specific header. gcc/ChangeLog: * btfout.c: Include tm_p.h. * ctfout.c: Same.
2021-06-28CTF/BTF debug formatsIndu Bhagat1-0/+1129
This commit introduces support for generating CTF debugging information and BTF debugging information from GCC. 2021-06-28 Indu Bhagat <indu.bhagat@oracle.com> David Faust <david.faust@oracle.com> Jose E. Marchesi <jose.marchesi@oracle.com> Weimin Pan <weimin.pan@oracle.com> gcc/ * Makefile.in: Add ctfc.*, ctfout.c and btfout.c files to GTFILES. Add new object files. * common.opt: Add CTF and BTF debug info options. * btfout.c: New file. * ctfc.c: Likewise. * ctfc.h: Likewise. * ctfout.c: Likewise. * dwarf2ctf.c: Likewise. * dwarf2ctf.h: Likewise. * dwarf2cfi.c (dwarf2out_do_frame): Acknowledge CTF_DEBUG and BTF_DEBUG. * dwarf2out.c (dwarf2out_source_line): Likewise. (dwarf2out_finish): Skip emitting DWARF if CTF or BTF are to be generated. (debug_format_do_cu): New function. (dwarf2out_early_finish): Traverse DIEs and emit CTF/BTF for them if requested. Include dwarf2ctf.c. * final.c (dwarf2_debug_info_emitted_p): Acknowledge DWARF-based debug formats. * flag-types.h (enum debug_info_type): Add CTF_DEBUG and BTF_DEBUG. (CTF_DEBUG): New bitmask. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): New enum. * gengtype.c (open_base_files): Handle ctfc.h. (main): Handle uint32_t type. * flags.h (btf_debuginfo_p): New definition. (dwarf_based_debuginfo_p): Likewise. * opts.c (debug_type_names): Add entries for CTF and BTF. (btf_debuginfo_p): New function. (dwarf_based_debuginfo_p): Likewise. (common_handle_option): Handle -gctfN and -gbtf options. (set_debug_level): Set CTF_DEBUG, BTF_DEBUG whenever appropriate. * toplev.c (process_options): Inform the user and ignore -gctfLEVEL if frontend is not C. include/ * ctf.h: New file. * btf.h: Likewise. libiberty/ * simple-object.c (handle_lto_debug_sections): Copy over .ctf sections.