<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gcc.git/include, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/'/>
<entry>
<title>Daily bump.</title>
<updated>2025-11-14T00:20:34+00:00</updated>
<author>
<name>GCC Administrator</name>
<email>gccadmin@gcc.gnu.org</email>
</author>
<published>2025-11-14T00:20:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=890dff609d49934d3a4041acfb8ae626bc8a0624'/>
<id>890dff609d49934d3a4041acfb8ae626bc8a0624</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>openmp, nvptx: ompx_gnu_managed_mem_alloc</title>
<updated>2025-11-13T14:16:09+00:00</updated>
<author>
<name>Andrew Stubbs</name>
<email>ams@codesourcery.com</email>
</author>
<published>2024-06-28T10:24:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=62174ec27b686bb9656c62a3b53d6cc08c9addb4'/>
<id>62174ec27b686bb9656c62a3b53d6cc08c9addb4</id>
<content type='text'>
This adds support for using Cuda Managed Memory with omp_alloc.  AMD support
will be added in a future patch.

There is one new predefined allocator, "ompx_gnu_managed_mem_alloc", plus a
corresponding memory space, which can be used to allocate memory in the
"managed" space.

The nvptx plugin is modified to make the necessary Cuda calls, via two new
(optional) plugin interfaces.

gcc/fortran/ChangeLog:

	* openmp.cc (is_predefined_allocator): Use GOMP_OMP_PREDEF_ALLOC_MAX
	and GOMP_OMPX_PREDEF_ALLOC_MIN/MAX instead of hardcoded values in the
	comment.

include/ChangeLog:

	* cuda/cuda.h (cuMemAllocManaged): Add declaration and related
	CU_MEM_ATTACH_GLOBAL flag.
	* gomp-constants.h (GOMP_OMPX_PREDEF_ALLOC_MAX): Update to 201.
	(GOMP_OMP_PREDEF_MEMSPACE_MAX): New constant.
	(GOMP_OMPX_PREDEF_MEMSPACE_MIN): New constant.
	(GOMP_OMPX_PREDEF_MEMSPACE_MAX): New constant.

libgomp/ChangeLog:

	* allocator.c (ompx_gnu_max_predefined_alloc): Update to
	ompx_gnu_managed_mem_alloc.
	(_Static_assert): Fix assertion messages for allocators and add
	new assertions for memspace constants.
	(omp_max_predefined_mem_space): New define.
	(ompx_gnu_min_predefined_mem_space): New define.
	(ompx_gnu_max_predefined_mem_space): New define.
	(MEMSPACE_ALLOC): Add check for non-standard memspaces.
	(MEMSPACE_CALLOC): Likewise.
	(MEMSPACE_REALLOC): Likewise.
	(MEMSPACE_VALIDATE): Likewise.
	(predefined_ompx_gnu_alloc_mapping): Add ompx_gnu_managed_mem_space.
	(omp_init_allocator): Add ompx_gnu_managed_mem_space validation.
	* config/gcn/allocator.c (gcn_memspace_alloc): Add check for
	non-standard memspaces.
	(gcn_memspace_calloc): Likewise.
	(gcn_memspace_realloc): Likewise.
	(gcn_memspace_validate): Update to validate standard vs non-standard
	memspaces.
	* config/linux/allocator.c (linux_memspace_alloc): Add managed
	memory space handling.
	(linux_memspace_calloc): Likewise.
	(linux_memspace_free): Likewise.
	(linux_memspace_realloc): Likewise (returns NULL for fallback).
	* config/nvptx/allocator.c (nvptx_memspace_alloc): Add check for
	non-standard memspaces.
	(nvptx_memspace_calloc): Likewise.
	(nvptx_memspace_realloc): Likewise.
	(nvptx_memspace_validate): Update to validate standard vs non-standard
	memspaces.
	* env.c (parse_allocator): Add ompx_gnu_managed_mem_alloc,
	ompx_gnu_managed_mem_space, and some static asserts so I don't forget
	them again.
	* libgomp-plugin.h (GOMP_OFFLOAD_managed_alloc): New declaration.
	(GOMP_OFFLOAD_managed_free): New declaration.
	* libgomp.h (gomp_managed_alloc): New declaration.
	(gomp_managed_free): New declaration.
	(struct gomp_device_descr): Add managed_alloc_func and
	managed_free_func fields.
	* libgomp.texi: Document ompx_gnu_managed_mem_alloc and
	ompx_gnu_managed_mem_space, add C++ template documentation, and
	describe NVPTX and AMD support.
	* omp.h.in: Add ompx_gnu_managed_mem_space and
	ompx_gnu_managed_mem_alloc enumerators, and gnu_managed_mem C++
	allocator template.
	* omp_lib.f90.in: Add Fortran bindings for new allocator and
	memory space.
	* omp_lib.h.in: Likewise.
	* plugin/cuda-lib.def: Add cuMemAllocManaged.
	* plugin/plugin-nvptx.c (nvptx_alloc): Add managed parameter to
	support cuMemAllocManaged.
	(GOMP_OFFLOAD_alloc): Move contents to ...
	(cleanup_and_alloc): ... this new function, and add managed support.
	(GOMP_OFFLOAD_managed_alloc): New function.
	(GOMP_OFFLOAD_managed_free): New function.
	* target.c (gomp_managed_alloc): New function.
	(gomp_managed_free): New function.
	(gomp_load_plugin_for_device): Load optional managed_alloc
	and managed_free plugin APIs.
	* testsuite/lib/libgomp.exp: Add check_effective_target_omp_managedmem.
	* testsuite/libgomp.c++/alloc-managed-1.C: New test.
	* testsuite/libgomp.c/alloc-managed-1.c: New test.
	* testsuite/libgomp.c/alloc-managed-2.c: New test.
	* testsuite/libgomp.c/alloc-managed-3.c: New test.
	* testsuite/libgomp.c/alloc-managed-4.c: New test.
	* testsuite/libgomp.fortran/alloc-managed-1.f90: New test.

Co-authored-by: Kwok Cheung Yeung &lt;kcyeung@baylibre.com&gt;
Co-authored-by: Thomas Schwinge &lt;tschwinge@baylibre.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds support for using Cuda Managed Memory with omp_alloc.  AMD support
will be added in a future patch.

There is one new predefined allocator, "ompx_gnu_managed_mem_alloc", plus a
corresponding memory space, which can be used to allocate memory in the
"managed" space.

The nvptx plugin is modified to make the necessary Cuda calls, via two new
(optional) plugin interfaces.

gcc/fortran/ChangeLog:

	* openmp.cc (is_predefined_allocator): Use GOMP_OMP_PREDEF_ALLOC_MAX
	and GOMP_OMPX_PREDEF_ALLOC_MIN/MAX instead of hardcoded values in the
	comment.

include/ChangeLog:

	* cuda/cuda.h (cuMemAllocManaged): Add declaration and related
	CU_MEM_ATTACH_GLOBAL flag.
	* gomp-constants.h (GOMP_OMPX_PREDEF_ALLOC_MAX): Update to 201.
	(GOMP_OMP_PREDEF_MEMSPACE_MAX): New constant.
	(GOMP_OMPX_PREDEF_MEMSPACE_MIN): New constant.
	(GOMP_OMPX_PREDEF_MEMSPACE_MAX): New constant.

libgomp/ChangeLog:

	* allocator.c (ompx_gnu_max_predefined_alloc): Update to
	ompx_gnu_managed_mem_alloc.
	(_Static_assert): Fix assertion messages for allocators and add
	new assertions for memspace constants.
	(omp_max_predefined_mem_space): New define.
	(ompx_gnu_min_predefined_mem_space): New define.
	(ompx_gnu_max_predefined_mem_space): New define.
	(MEMSPACE_ALLOC): Add check for non-standard memspaces.
	(MEMSPACE_CALLOC): Likewise.
	(MEMSPACE_REALLOC): Likewise.
	(MEMSPACE_VALIDATE): Likewise.
	(predefined_ompx_gnu_alloc_mapping): Add ompx_gnu_managed_mem_space.
	(omp_init_allocator): Add ompx_gnu_managed_mem_space validation.
	* config/gcn/allocator.c (gcn_memspace_alloc): Add check for
	non-standard memspaces.
	(gcn_memspace_calloc): Likewise.
	(gcn_memspace_realloc): Likewise.
	(gcn_memspace_validate): Update to validate standard vs non-standard
	memspaces.
	* config/linux/allocator.c (linux_memspace_alloc): Add managed
	memory space handling.
	(linux_memspace_calloc): Likewise.
	(linux_memspace_free): Likewise.
	(linux_memspace_realloc): Likewise (returns NULL for fallback).
	* config/nvptx/allocator.c (nvptx_memspace_alloc): Add check for
	non-standard memspaces.
	(nvptx_memspace_calloc): Likewise.
	(nvptx_memspace_realloc): Likewise.
	(nvptx_memspace_validate): Update to validate standard vs non-standard
	memspaces.
	* env.c (parse_allocator): Add ompx_gnu_managed_mem_alloc,
	ompx_gnu_managed_mem_space, and some static asserts so I don't forget
	them again.
	* libgomp-plugin.h (GOMP_OFFLOAD_managed_alloc): New declaration.
	(GOMP_OFFLOAD_managed_free): New declaration.
	* libgomp.h (gomp_managed_alloc): New declaration.
	(gomp_managed_free): New declaration.
	(struct gomp_device_descr): Add managed_alloc_func and
	managed_free_func fields.
	* libgomp.texi: Document ompx_gnu_managed_mem_alloc and
	ompx_gnu_managed_mem_space, add C++ template documentation, and
	describe NVPTX and AMD support.
	* omp.h.in: Add ompx_gnu_managed_mem_space and
	ompx_gnu_managed_mem_alloc enumerators, and gnu_managed_mem C++
	allocator template.
	* omp_lib.f90.in: Add Fortran bindings for new allocator and
	memory space.
	* omp_lib.h.in: Likewise.
	* plugin/cuda-lib.def: Add cuMemAllocManaged.
	* plugin/plugin-nvptx.c (nvptx_alloc): Add managed parameter to
	support cuMemAllocManaged.
	(GOMP_OFFLOAD_alloc): Move contents to ...
	(cleanup_and_alloc): ... this new function, and add managed support.
	(GOMP_OFFLOAD_managed_alloc): New function.
	(GOMP_OFFLOAD_managed_free): New function.
	* target.c (gomp_managed_alloc): New function.
	(gomp_managed_free): New function.
	(gomp_load_plugin_for_device): Load optional managed_alloc
	and managed_free plugin APIs.
	* testsuite/lib/libgomp.exp: Add check_effective_target_omp_managedmem.
	* testsuite/libgomp.c++/alloc-managed-1.C: New test.
	* testsuite/libgomp.c/alloc-managed-1.c: New test.
	* testsuite/libgomp.c/alloc-managed-2.c: New test.
	* testsuite/libgomp.c/alloc-managed-3.c: New test.
	* testsuite/libgomp.c/alloc-managed-4.c: New test.
	* testsuite/libgomp.fortran/alloc-managed-1.f90: New test.

Co-authored-by: Kwok Cheung Yeung &lt;kcyeung@baylibre.com&gt;
Co-authored-by: Thomas Schwinge &lt;tschwinge@baylibre.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Daily bump.</title>
<updated>2025-10-17T00:18:48+00:00</updated>
<author>
<name>GCC Administrator</name>
<email>gccadmin@gcc.gnu.org</email>
</author>
<published>2025-10-17T00:18:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=03fed2a80b3285d5a1a509492cbc2ce9b7242307'/>
<id>03fed2a80b3285d5a1a509492cbc2ce9b7242307</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>dwarf: add wiki link for DWARF GNU_annotation extensions</title>
<updated>2025-10-16T18:08:30+00:00</updated>
<author>
<name>David Faust</name>
<email>david.faust@oracle.com</email>
</author>
<published>2025-10-16T17:39:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=822a139e7d3bd90c28a6fa110c7e8de064cd7cd4'/>
<id>822a139e7d3bd90c28a6fa110c7e8de064cd7cd4</id>
<content type='text'>
include/

	* dwarf2.def (DW_TAG_GNU_annotation): Add link to wiki page
	documenting the extension.
	(DW_AT_GNU_annotation): Likewise.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
include/

	* dwarf2.def (DW_TAG_GNU_annotation): Add link to wiki page
	documenting the extension.
	(DW_AT_GNU_annotation): Likewise.
</pre>
</div>
</content>
</entry>
<entry>
<title>Daily bump.</title>
<updated>2025-10-11T00:21:09+00:00</updated>
<author>
<name>GCC Administrator</name>
<email>gccadmin@gcc.gnu.org</email>
</author>
<published>2025-10-11T00:21:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=ddd6dff0babb97fce00e68bb329cdfdff4bf6d13'/>
<id>ddd6dff0babb97fce00e68bb329cdfdff4bf6d13</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>libgomp: Add is_integrated_apu function to plugin/plugin-{gcn,nvptx}.c</title>
<updated>2025-10-10T07:48:37+00:00</updated>
<author>
<name>Tobias Burnus</name>
<email>tburnus@baylibre.com</email>
</author>
<published>2025-10-10T07:48:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=d2ad7e90834d9c18e0c7104796f3131594e7bbfb'/>
<id>d2ad7e90834d9c18e0c7104796f3131594e7bbfb</id>
<content type='text'>
The added function is currently '#if 0' but is planned to be used to enable
self mapping automatically. Prerequisite for auto self maps is still mapping
'declare target' variables (if any, in libgomp) or converting all
'declare target' variables to 'declare target link' in the compiler
(as required for 'omp requires self_maps').

include/ChangeLog:

	* hsa_ext_amd.h (enum hsa_amd_agent_info_s): Add
	HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES.
	(enum): Add HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU.

libgomp/ChangeLog:

	* plugin/plugin-gcn.c (is_integrated_apu): New; currently '#if 0'.
	* plugin/plugin-nvptx.c (is_integrated_apu): Likewise.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The added function is currently '#if 0' but is planned to be used to enable
self mapping automatically. Prerequisite for auto self maps is still mapping
'declare target' variables (if any, in libgomp) or converting all
'declare target' variables to 'declare target link' in the compiler
(as required for 'omp requires self_maps').

include/ChangeLog:

	* hsa_ext_amd.h (enum hsa_amd_agent_info_s): Add
	HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES.
	(enum): Add HSA_AMD_MEMORY_PROPERTY_AGENT_IS_APU.

libgomp/ChangeLog:

	* plugin/plugin-gcn.c (is_integrated_apu): New; currently '#if 0'.
	* plugin/plugin-nvptx.c (is_integrated_apu): Likewise.
</pre>
</div>
</content>
</entry>
<entry>
<title>Daily bump.</title>
<updated>2025-10-10T00:21:51+00:00</updated>
<author>
<name>GCC Administrator</name>
<email>gccadmin@gcc.gnu.org</email>
</author>
<published>2025-10-10T00:21:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=ea7fa6bf4876ad0b66a7cb92324f6f8f9b646038'/>
<id>ea7fa6bf4876ad0b66a7cb92324f6f8f9b646038</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>btf: generate and output DECL_TAG and TYPE_TAG records</title>
<updated>2025-10-09T21:13:23+00:00</updated>
<author>
<name>David Faust</name>
<email>david.faust@oracle.com</email>
</author>
<published>2025-02-05T18:41:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=43dcea48b8c701138335518b6f2853ab9af0eda2'/>
<id>43dcea48b8c701138335518b6f2853ab9af0eda2</id>
<content type='text'>
Support the btf_decl_tag and btf_type_tag attributes in BTF by creating
and emitting BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG records,
respectively, for them.

Some care is required when -gprune-btf is in effect to avoid emitting
decl or type tags for declarations or types which have been pruned and
will not be emitted in BTF.

gcc/
	* btfout.cc (get_btf_kind): Handle DECL_TAG and TYPE_TAG kinds.
	(btf_calc_num_vbytes): Likewise.
	(btf_asm_type): Likewise.
	(output_asm_btf_vlen_bytes): Likewise.
	(output_btf_tags): New.
	(btf_output): Call it here.
	(btf_add_used_type): Replace with simple wrapper around...
	(btf_add_used_type_1): ...the implementation.  Handle
	BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG.
	(btf_add_vars): Update btf_add_used_type call.
	(btf_assign_tag_ids): New.
	(btf_mark_type_used): Update btf_add_used_type call.
	(btf_collect_pruned_types): Likewise.  Handle type and decl tags.
	(btf_finish): Call btf_assign_tag_ids.

gcc/testsuite/
	* gcc.dg/debug/btf/btf-decl-tag-1.c: New test.
	* gcc.dg/debug/btf/btf-decl-tag-2.c: New test.
	* gcc.dg/debug/btf/btf-decl-tag-3.c: New test.
	* gcc.dg/debug/btf/btf-decl-tag-4.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-1.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-2.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-3.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-4.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-c2x-1.c: New test.

include/
	* btf.h (BTF_KIND_DECL_TAG, BTF_KIND_TYPE_TAG) New defines.
	(struct btf_decl_tag): New.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Support the btf_decl_tag and btf_type_tag attributes in BTF by creating
and emitting BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG records,
respectively, for them.

Some care is required when -gprune-btf is in effect to avoid emitting
decl or type tags for declarations or types which have been pruned and
will not be emitted in BTF.

gcc/
	* btfout.cc (get_btf_kind): Handle DECL_TAG and TYPE_TAG kinds.
	(btf_calc_num_vbytes): Likewise.
	(btf_asm_type): Likewise.
	(output_asm_btf_vlen_bytes): Likewise.
	(output_btf_tags): New.
	(btf_output): Call it here.
	(btf_add_used_type): Replace with simple wrapper around...
	(btf_add_used_type_1): ...the implementation.  Handle
	BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG.
	(btf_add_vars): Update btf_add_used_type call.
	(btf_assign_tag_ids): New.
	(btf_mark_type_used): Update btf_add_used_type call.
	(btf_collect_pruned_types): Likewise.  Handle type and decl tags.
	(btf_finish): Call btf_assign_tag_ids.

gcc/testsuite/
	* gcc.dg/debug/btf/btf-decl-tag-1.c: New test.
	* gcc.dg/debug/btf/btf-decl-tag-2.c: New test.
	* gcc.dg/debug/btf/btf-decl-tag-3.c: New test.
	* gcc.dg/debug/btf/btf-decl-tag-4.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-1.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-2.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-3.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-4.c: New test.
	* gcc.dg/debug/btf/btf-type-tag-c2x-1.c: New test.

include/
	* btf.h (BTF_KIND_DECL_TAG, BTF_KIND_TYPE_TAG) New defines.
	(struct btf_decl_tag): New.
</pre>
</div>
</content>
</entry>
<entry>
<title>ctf: translate annotation DIEs to internal ctf</title>
<updated>2025-10-09T21:13:23+00:00</updated>
<author>
<name>David Faust</name>
<email>david.faust@oracle.com</email>
</author>
<published>2025-02-05T18:40:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=9c862a593bcaa21bfca32c25bc01081bc33227a2'/>
<id>9c862a593bcaa21bfca32c25bc01081bc33227a2</id>
<content type='text'>
Translate DW_TAG_GNU_annotation DIEs created for C attributes
btf_decl_tag and btf_type_tag into an in-memory representation in the
CTF/BTF container.  They will be output in BTF as BTF_KIND_DECL_TAG and
BTF_KIND_TYPE_TAG records.

The new CTF kinds used to represent these annotations, CTF_K_DECL_TAG
and CTF_K_TYPE_TAG, are expected to be formalized in the next version of
the CTF specification.  For now they only exist in memory as a
translation step to BTF, and are not emitted when generating CTF
information.

gcc/
	* ctfc.cc (ctf_dtu_d_union_selector): Handle CTF_K_DECL_TAG and
	CTF_K_TYPE_TAG.
	(ctf_add_type_tag, ctf_add_decl_tag): New.
	(ctf_add_variable): Return the new ctf_dvdef_ref rather than zero.
	(new_ctf_container): Initialize new members.
	(ctfc_delete_container): Deallocate new members.
	* ctfc.h (ctf_dvdef, ctf_dvdef_t, ctf_dvdef_ref): Move forward
	declarations earlier in file.
	(ctf_decl_tag_t): New typedef.
	(ctf_dtdef): Add ctf_decl_tag_t member to dtd_u union.
	(ctf_dtu_d_union_enum): Add new CTF_DTU_D_TAG enumerator.
	(ctf_container): Add ctfc_tags vector and ctfc_type_tags_map hash_map
	members.
	(ctf_add_type_tag, ctf_add_decl_tag): New function protos.
	(ctf_add_variable): Change prototype return type to ctf_dvdef_ref.
	* dwarf2ctf.cc (gen_ctf_type_tags, gen_ctf_decl_tags)
	(gen_ctf_decl_tags_for_var): New static functions.
	(gen_ctf_pointer_type): Handle type tags.
	(gen_ctf_sou_type): Handle decl tags.
	(gen_ctf_function_type): Likewise.
	(gen_ctf_variable): Likewise.
	(gen_ctf_function): Likewise.
	(gen_ctf_type): Handle TAG_GNU_annotation DIEs.

gcc/testsuite/
	* gcc.dg/debug/ctf/ctf-decl-tag-1.c: New test.
	* gcc.dg/debug/ctf/ctf-type-tag-1.c: New test.

include/
	* ctf.h (CTF_K_DECL_TAG, CTF_K_TYPE_TAG): New defines.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Translate DW_TAG_GNU_annotation DIEs created for C attributes
btf_decl_tag and btf_type_tag into an in-memory representation in the
CTF/BTF container.  They will be output in BTF as BTF_KIND_DECL_TAG and
BTF_KIND_TYPE_TAG records.

The new CTF kinds used to represent these annotations, CTF_K_DECL_TAG
and CTF_K_TYPE_TAG, are expected to be formalized in the next version of
the CTF specification.  For now they only exist in memory as a
translation step to BTF, and are not emitted when generating CTF
information.

gcc/
	* ctfc.cc (ctf_dtu_d_union_selector): Handle CTF_K_DECL_TAG and
	CTF_K_TYPE_TAG.
	(ctf_add_type_tag, ctf_add_decl_tag): New.
	(ctf_add_variable): Return the new ctf_dvdef_ref rather than zero.
	(new_ctf_container): Initialize new members.
	(ctfc_delete_container): Deallocate new members.
	* ctfc.h (ctf_dvdef, ctf_dvdef_t, ctf_dvdef_ref): Move forward
	declarations earlier in file.
	(ctf_decl_tag_t): New typedef.
	(ctf_dtdef): Add ctf_decl_tag_t member to dtd_u union.
	(ctf_dtu_d_union_enum): Add new CTF_DTU_D_TAG enumerator.
	(ctf_container): Add ctfc_tags vector and ctfc_type_tags_map hash_map
	members.
	(ctf_add_type_tag, ctf_add_decl_tag): New function protos.
	(ctf_add_variable): Change prototype return type to ctf_dvdef_ref.
	* dwarf2ctf.cc (gen_ctf_type_tags, gen_ctf_decl_tags)
	(gen_ctf_decl_tags_for_var): New static functions.
	(gen_ctf_pointer_type): Handle type tags.
	(gen_ctf_sou_type): Handle decl tags.
	(gen_ctf_function_type): Likewise.
	(gen_ctf_variable): Likewise.
	(gen_ctf_function): Likewise.
	(gen_ctf_type): Handle TAG_GNU_annotation DIEs.

gcc/testsuite/
	* gcc.dg/debug/ctf/ctf-decl-tag-1.c: New test.
	* gcc.dg/debug/ctf/ctf-type-tag-1.c: New test.

include/
	* ctf.h (CTF_K_DECL_TAG, CTF_K_TYPE_TAG): New defines.
</pre>
</div>
</content>
</entry>
<entry>
<title>dwarf: create annotation DIEs for btf tags</title>
<updated>2025-10-09T21:13:23+00:00</updated>
<author>
<name>David Faust</name>
<email>david.faust@oracle.com</email>
</author>
<published>2025-02-05T18:37:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=ac7027f180b8ca4ebf29dfe4906daba4320f4edc'/>
<id>ac7027f180b8ca4ebf29dfe4906daba4320f4edc</id>
<content type='text'>
The btf_decl_tag and btf_type_tag attributes provide a means to annotate
declarations and types respectively with arbitrary user provided
strings.  These strings are recorded in debug information for
post-compilation uses, and despite the name they are meant to be
recorded in DWARF as well as BTF.  New DWARF extensions
DW_TAG_GNU_annotation and DW_AT_GNU_annotation are used to represent
these user annotations in DWARF.

This patch introduces the new DWARF extension DIE and attribute, and
generates them as necessary to represent user annotations from
btf_decl_tag and btf_type_tag.

The format of the new DIE is as follows:

    DW_TAG_GNU_annotation
        DW_AT_name: "btf_decl_tag" or "btf_type_tag"
        DW_AT_const_value: &lt;arbitrary user-supplied string&gt;
        DW_AT_GNU_annotation: &lt;reference to another TAG_GNU_annotation DIE&gt;

DW_AT_GNU_annotation is a new attribute extension used to refer to these
new annotation DIEs.  If non-null in any given declaration or type DIE,
it is a reference to a DW_TAG_GNU_annotation DIE holding an annotation
for that declaration or type.  In addition, the DW_TAG_GNU_annotation
DIEs may also have a non-null DW_AT_GNU_annotation, referring to another
annotation DIE.  This allows chains of annotation DIEs to be formed,
such as in the case where a single declaration has multiple instances of
btf_decl_tag with different string annotations.

gcc/
	* dwarf2out.cc (struct annotation_node, struct annotation_node_hasher)
	(btf_tag_htab): New ancillary structures and hash table.
	(annotation_node_hasher::hash, annotation_node_hasher::equal): New.
	(hash_btf_tag, gen_btf_tag_dies, maybe_gen_btf_type_tag_dies)
	(maybe_gen_btf_decl_tag_dies): New functions.
	(modified_type_die): Add new argument to pass type attributes.
	Handle btf_type_tag, and update recursive calls.
	(base_type_for_mode): Add new arg for modified_type_die call.
	(add_type_attribute): Likewise.
	(gen_array_type_die): Call maybe_gen_btf_type_tag_dies for the type.
	(gen_formal_parameter_die): Call maybe_gen_btf_decl_tag_dies for the
	parameter.
	(override_type_for_decl_p): Add new arg for modified_type_die call.
	(force_type_die): Likewise.
	(gen_tagged_type_die): Call maybe_gen_btf_type_tag_dies for the type.
	(gen_decl_die): Call maybe_gen_btf_decl_tag_dies for the decl.
	(dwarf2out_finish): Empty btf_tag_htab.
	(dwarf2out_cc_finalize): Delete btf_tag_htab hash table.

include/
	* dwarf2.def (DW_TAG_GNU_annotation): New DWARF extension.
	(DW_AT_GNU_annotation): Likewise.

gcc/testsuite/
	* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-2.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-3.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-3.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-6.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-7.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-8.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-9.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c: New test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The btf_decl_tag and btf_type_tag attributes provide a means to annotate
declarations and types respectively with arbitrary user provided
strings.  These strings are recorded in debug information for
post-compilation uses, and despite the name they are meant to be
recorded in DWARF as well as BTF.  New DWARF extensions
DW_TAG_GNU_annotation and DW_AT_GNU_annotation are used to represent
these user annotations in DWARF.

This patch introduces the new DWARF extension DIE and attribute, and
generates them as necessary to represent user annotations from
btf_decl_tag and btf_type_tag.

The format of the new DIE is as follows:

    DW_TAG_GNU_annotation
        DW_AT_name: "btf_decl_tag" or "btf_type_tag"
        DW_AT_const_value: &lt;arbitrary user-supplied string&gt;
        DW_AT_GNU_annotation: &lt;reference to another TAG_GNU_annotation DIE&gt;

DW_AT_GNU_annotation is a new attribute extension used to refer to these
new annotation DIEs.  If non-null in any given declaration or type DIE,
it is a reference to a DW_TAG_GNU_annotation DIE holding an annotation
for that declaration or type.  In addition, the DW_TAG_GNU_annotation
DIEs may also have a non-null DW_AT_GNU_annotation, referring to another
annotation DIE.  This allows chains of annotation DIEs to be formed,
such as in the case where a single declaration has multiple instances of
btf_decl_tag with different string annotations.

gcc/
	* dwarf2out.cc (struct annotation_node, struct annotation_node_hasher)
	(btf_tag_htab): New ancillary structures and hash table.
	(annotation_node_hasher::hash, annotation_node_hasher::equal): New.
	(hash_btf_tag, gen_btf_tag_dies, maybe_gen_btf_type_tag_dies)
	(maybe_gen_btf_decl_tag_dies): New functions.
	(modified_type_die): Add new argument to pass type attributes.
	Handle btf_type_tag, and update recursive calls.
	(base_type_for_mode): Add new arg for modified_type_die call.
	(add_type_attribute): Likewise.
	(gen_array_type_die): Call maybe_gen_btf_type_tag_dies for the type.
	(gen_formal_parameter_die): Call maybe_gen_btf_decl_tag_dies for the
	parameter.
	(override_type_for_decl_p): Add new arg for modified_type_die call.
	(force_type_die): Likewise.
	(gen_tagged_type_die): Call maybe_gen_btf_type_tag_dies for the type.
	(gen_decl_die): Call maybe_gen_btf_decl_tag_dies for the decl.
	(dwarf2out_finish): Empty btf_tag_htab.
	(dwarf2out_cc_finalize): Delete btf_tag_htab hash table.

include/
	* dwarf2.def (DW_TAG_GNU_annotation): New DWARF extension.
	(DW_AT_GNU_annotation): Likewise.

gcc/testsuite/
	* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-2.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-3.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-3.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-6.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-7.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-8.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-9.c: New test.
	* gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c: New test.
</pre>
</div>
</content>
</entry>
</feed>
