aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2ctf.cc
diff options
context:
space:
mode:
authorCupertino Miranda <cupertino.miranda@oracle.com>2024-02-12 17:37:37 +0000
committerCupertino Miranda <cupertino.miranda@oracle.com>2024-02-28 19:20:20 +0000
commit38d2eb337b41e9cdc5eb89ab865d74ef5304bc03 (patch)
treea01f1992e0887de5303d85c0d53a648835fc029a /gcc/dwarf2ctf.cc
parent69a3ce49bda929e1ffbc1fc1123f5f2485ec944d (diff)
downloadgcc-38d2eb337b41e9cdc5eb89ab865d74ef5304bc03.zip
gcc-38d2eb337b41e9cdc5eb89ab865d74ef5304bc03.tar.gz
gcc-38d2eb337b41e9cdc5eb89ab865d74ef5304bc03.tar.bz2
bpf: Always emit .BTF.ext section if generating BTF
BPF applications, when generating BTF information should always create a .BTF.ext section. Current implementation was only creating it when -mco-re option was used. This patch makes .BTF.ext always be generated for BPF target objects. The patch also adds conditions around btf_finalize function call such that BTF deallocation happens later for BPF target. For BPF, btf_finalize is only called after .BTF.ext is generated. gcc/ChangeLog: * config/bpf/bpf.cc (bpf_option_override): Make .BTF.ext enabled by default for BPF. (bpf_file_end): Call BTF deallocation. (bpf_asm_init_sections): Correct condition. * dwarf2ctf.cc (ctf_debug_finalize): Conditionally execute BTF deallocation. (ctf_debuf_finish): Correct condition for calling ctf_debug_finalize.
Diffstat (limited to 'gcc/dwarf2ctf.cc')
-rw-r--r--gcc/dwarf2ctf.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc
index 93e5619..dca86ed 100644
--- a/gcc/dwarf2ctf.cc
+++ b/gcc/dwarf2ctf.cc
@@ -944,7 +944,10 @@ ctf_debug_finalize (const char *filename, bool btf)
if (btf)
{
btf_output (filename);
- btf_finalize ();
+ /* btf_finalize when compiling BPF applciations gets deallocated by the
+ BPF target in bpf_file_end. */
+ if (btf_debuginfo_p () && !btf_with_core_debuginfo_p ())
+ btf_finalize ();
}
else
@@ -1027,11 +1030,8 @@ ctf_debug_finish (const char * filename)
/* Emit BTF debug info here when CO-RE relocations need to be generated.
BTF with CO-RE relocations needs to be generated when CO-RE is in effect
for the BPF target. */
- if (btf_with_core_debuginfo_p ())
- {
- gcc_assert (btf_debuginfo_p ());
- ctf_debug_finalize (filename, btf_debuginfo_p ());
- }
+ if (btf_debuginfo_p () && btf_with_core_debuginfo_p ())
+ ctf_debug_finalize (filename, btf_debuginfo_p ());
}
#include "gt-dwarf2ctf.h"