diff mbox series

[4/7] btf: expose get_btf_id

Message ID 20210804175411.6783-5-david.faust@oracle.com
State New
Headers show
Series BPF CO-RE Support | expand

Commit Message

David Faust Aug. 4, 2021, 5:54 p.m. UTC
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.
---
 gcc/btfout.c | 2 +-
 gcc/ctfc.h   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Richard Biener Aug. 26, 2021, 10:01 a.m. UTC | #1
On Wed, Aug 4, 2021 at 7:57 PM David Faust via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> 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

Patches 2-4 are OK.

> gcc/ChangeLog:
>
>         * btfout.c (get_btf_id): Function is no longer static.
>         * ctfc.h: Expose it here.
> ---
>  gcc/btfout.c | 2 +-
>  gcc/ctfc.h   | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/btfout.c b/gcc/btfout.c
> index 8cdd9905fb6..cdc6c6378c0 100644
> --- a/gcc/btfout.c
> +++ b/gcc/btfout.c
> @@ -156,7 +156,7 @@ init_btf_id_map (size_t len)
>  /* Return the BTF type ID of CTF type ID KEY, or BTF_INVALID_TYPEID if the CTF
>     type with ID KEY does not map to a BTF type.  */
>
> -static inline ctf_id_t
> +ctf_id_t
>  get_btf_id (ctf_id_t key)
>  {
>    return btf_id_map[key];
> diff --git a/gcc/ctfc.h b/gcc/ctfc.h
> index 14180c1e5de..a0b7e4105a8 100644
> --- a/gcc/ctfc.h
> +++ b/gcc/ctfc.h
> @@ -431,6 +431,7 @@ extern int ctf_add_variable (ctf_container_ref, const char *, ctf_id_t,
>                              dw_die_ref, unsigned int);
>
>  extern ctf_id_t ctf_lookup_tree_type (ctf_container_ref, const tree);
> +extern ctf_id_t get_btf_id (ctf_id_t);
>
>  /* CTF section does not emit location information; at this time, location
>     information is needed for BTF CO-RE use-cases.  */
> --
> 2.32.0
>
diff mbox series

Patch

diff --git a/gcc/btfout.c b/gcc/btfout.c
index 8cdd9905fb6..cdc6c6378c0 100644
--- a/gcc/btfout.c
+++ b/gcc/btfout.c
@@ -156,7 +156,7 @@  init_btf_id_map (size_t len)
 /* Return the BTF type ID of CTF type ID KEY, or BTF_INVALID_TYPEID if the CTF
    type with ID KEY does not map to a BTF type.  */
 
-static inline ctf_id_t
+ctf_id_t
 get_btf_id (ctf_id_t key)
 {
   return btf_id_map[key];
diff --git a/gcc/ctfc.h b/gcc/ctfc.h
index 14180c1e5de..a0b7e4105a8 100644
--- a/gcc/ctfc.h
+++ b/gcc/ctfc.h
@@ -431,6 +431,7 @@  extern int ctf_add_variable (ctf_container_ref, const char *, ctf_id_t,
 			     dw_die_ref, unsigned int);
 
 extern ctf_id_t ctf_lookup_tree_type (ctf_container_ref, const tree);
+extern ctf_id_t get_btf_id (ctf_id_t);
 
 /* CTF section does not emit location information; at this time, location
    information is needed for BTF CO-RE use-cases.  */