]> gcc.gnu.org Git - gcc.git/commit
btf: add 'extern' linkage for variables [PR106773]
authorDavid Faust <david.faust@oracle.com>
Wed, 7 Dec 2022 19:44:28 +0000 (11:44 -0800)
committerDavid Faust <david.faust@oracle.com>
Wed, 14 Dec 2022 18:20:52 +0000 (10:20 -0800)
commit2bce22e88e1c8486a0f2d42311506a8d3da20fb7
tree911e7df680b0a6f1ea5ccd4ecfe80cf1ea5a3efa
parent0e9495303db062cf118869b7526132b5821833e9
btf: add 'extern' linkage for variables [PR106773]

Add support for the 'extern' linkage value for BTF_KIND_VAR records,
which is used for variables declared as extern in the source file.

This also fixes a bug with BTF generation for extern variables which
have both a non-defining declaration and a defining declaration in the
same CU.

PR target/106773

gcc/

* btfout.cc (btf_collect_datasec): Mark extern variables as such.
(btf_dvd_emit_preprocess_cb): Skip non-defining extern variable decl
if there is a defining decl for the same variable.
(btf_asm_varent): Accomodate 'extern' linkage.

gcc/testsuite/

* gcc.dg/debug/btf/btf-variables-4.c: New test.
* gcc.dg/debug/btf/btf-variables-5.c: New test.

include/

* btf.h (enum btf_var_linkage): New.
(struct btf_var): Update comment to note 'extern' linkage.
gcc/btfout.cc
gcc/testsuite/gcc.dg/debug/btf/btf-variables-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/debug/btf/btf-variables-5.c [new file with mode: 0644]
include/btf.h
This page took 0.060156 seconds and 5 git commands to generate.