* [PATCH v2] docs/bpf: Add constant values for linkages
@ 2024-09-11 5:50 Will Hawkins
2024-09-11 5:50 ` [Bpf] " Will Hawkins
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Will Hawkins @ 2024-09-11 5:50 UTC (permalink / raw)
To: bpf, bpf; +Cc: Will Hawkins
Make the values of the symbolic constants that define the valid linkages
for functions and variables explicit.
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
---
v1 -> v2:
- Reformat to match style in BPF ISA document
- Add information about BTF_VAR_GLOBAL_EXTERN
Documentation/bpf/btf.rst | 39 +++++++++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/Documentation/bpf/btf.rst b/Documentation/bpf/btf.rst
index 257a7e1cdf5d..93060283b6fd 100644
--- a/Documentation/bpf/btf.rst
+++ b/Documentation/bpf/btf.rst
@@ -368,7 +368,7 @@ No additional type data follow ``btf_type``.
* ``info.kind_flag``: 0
* ``info.kind``: BTF_KIND_FUNC
* ``info.vlen``: linkage information (BTF_FUNC_STATIC, BTF_FUNC_GLOBAL
- or BTF_FUNC_EXTERN)
+ or BTF_FUNC_EXTERN - see :ref:`BTF_Function_Linkage_Constants`)
* ``type``: a BTF_KIND_FUNC_PROTO type
No additional type data follow ``btf_type``.
@@ -424,9 +424,8 @@ following data::
__u32 linkage;
};
-``struct btf_var`` encoding:
- * ``linkage``: currently only static variable 0, or globally allocated
- variable in ELF sections 1
+``btf_var.linkage`` may take the values: BTF_VAR_STATIC, BTF_VAR_GLOBAL_ALLOCATED or BTF_VAR_GLOBAL_EXTERN -
+see :ref:`BTF_Var_Linkage_Constants`.
Not all type of global variables are supported by LLVM at this point.
The following is currently available:
@@ -549,6 +548,38 @@ The ``btf_enum64`` encoding:
If the original enum value is signed and the size is less than 8,
that value will be sign extended into 8 bytes.
+2.3 Constant Values
+-------------------
+
+.. _BTF_Function_Linkage_Constants:
+
+2.3.1 Function Linkage Constant Values
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. table:: Function Linkage Values and Meanings
+
+ =================== ===== ===========
+ kind value description
+ =================== ===== ===========
+ ``BTF_FUNC_STATIC`` 0x0 definition of subprogram not visible outside containing compilation unit
+ ``BTF_FUNC_GLOBAL`` 0x1 definition of subprogram visible outside containing compilation unit
+ ``BTF_FUNC_EXTERN`` 0x2 declaration of a subprogram whose definition is outside the containing compilation unit
+ =================== ===== ===========
+
+
+.. _BTF_Var_Linkage_Constants:
+
+2.3.2 Variable Linkage Constant Values
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. table:: Variable Linkage Values and Meanings
+
+ ============================ ===== ===========
+ kind value description
+ ============================ ===== ===========
+ ``BTF_VAR_STATIC`` 0x0 definition of global variable not visible outside containing compilation unit
+ ``BTF_VAR_GLOBAL_ALLOCATED`` 0x1 definition of global variable visible outside containing compilation unit
+ ``BTF_VAR_GLOBAL_EXTERN`` 0x2 declaration of global variable whose definition is outside the containing compilation unit
+ ============================ ===== ===========
+
3. BTF Kernel API
=================
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [Bpf] [PATCH v2] docs/bpf: Add constant values for linkages
2024-09-11 5:50 [PATCH v2] docs/bpf: Add constant values for linkages Will Hawkins
@ 2024-09-11 5:50 ` Will Hawkins
2024-09-11 14:30 ` Yonghong Song
2024-09-11 20:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Will Hawkins @ 2024-09-11 5:50 UTC (permalink / raw)
To: bpf, bpf; +Cc: Will Hawkins
Make the values of the symbolic constants that define the valid linkages
for functions and variables explicit.
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
---
v1 -> v2:
- Reformat to match style in BPF ISA document
- Add information about BTF_VAR_GLOBAL_EXTERN
Documentation/bpf/btf.rst | 39 +++++++++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/Documentation/bpf/btf.rst b/Documentation/bpf/btf.rst
index 257a7e1cdf5d..93060283b6fd 100644
--- a/Documentation/bpf/btf.rst
+++ b/Documentation/bpf/btf.rst
@@ -368,7 +368,7 @@ No additional type data follow ``btf_type``.
* ``info.kind_flag``: 0
* ``info.kind``: BTF_KIND_FUNC
* ``info.vlen``: linkage information (BTF_FUNC_STATIC, BTF_FUNC_GLOBAL
- or BTF_FUNC_EXTERN)
+ or BTF_FUNC_EXTERN - see :ref:`BTF_Function_Linkage_Constants`)
* ``type``: a BTF_KIND_FUNC_PROTO type
No additional type data follow ``btf_type``.
@@ -424,9 +424,8 @@ following data::
__u32 linkage;
};
-``struct btf_var`` encoding:
- * ``linkage``: currently only static variable 0, or globally allocated
- variable in ELF sections 1
+``btf_var.linkage`` may take the values: BTF_VAR_STATIC, BTF_VAR_GLOBAL_ALLOCATED or BTF_VAR_GLOBAL_EXTERN -
+see :ref:`BTF_Var_Linkage_Constants`.
Not all type of global variables are supported by LLVM at this point.
The following is currently available:
@@ -549,6 +548,38 @@ The ``btf_enum64`` encoding:
If the original enum value is signed and the size is less than 8,
that value will be sign extended into 8 bytes.
+2.3 Constant Values
+-------------------
+
+.. _BTF_Function_Linkage_Constants:
+
+2.3.1 Function Linkage Constant Values
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. table:: Function Linkage Values and Meanings
+
+ =================== ===== ===========
+ kind value description
+ =================== ===== ===========
+ ``BTF_FUNC_STATIC`` 0x0 definition of subprogram not visible outside containing compilation unit
+ ``BTF_FUNC_GLOBAL`` 0x1 definition of subprogram visible outside containing compilation unit
+ ``BTF_FUNC_EXTERN`` 0x2 declaration of a subprogram whose definition is outside the containing compilation unit
+ =================== ===== ===========
+
+
+.. _BTF_Var_Linkage_Constants:
+
+2.3.2 Variable Linkage Constant Values
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. table:: Variable Linkage Values and Meanings
+
+ ============================ ===== ===========
+ kind value description
+ ============================ ===== ===========
+ ``BTF_VAR_STATIC`` 0x0 definition of global variable not visible outside containing compilation unit
+ ``BTF_VAR_GLOBAL_ALLOCATED`` 0x1 definition of global variable visible outside containing compilation unit
+ ``BTF_VAR_GLOBAL_EXTERN`` 0x2 declaration of global variable whose definition is outside the containing compilation unit
+ ============================ ===== ===========
+
3. BTF Kernel API
=================
--
2.45.2
--
Bpf mailing list -- bpf@ietf.org
To unsubscribe send an email to bpf-leave@ietf.org
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v2] docs/bpf: Add constant values for linkages
2024-09-11 5:50 [PATCH v2] docs/bpf: Add constant values for linkages Will Hawkins
2024-09-11 5:50 ` [Bpf] " Will Hawkins
@ 2024-09-11 14:30 ` Yonghong Song
2024-09-11 14:30 ` [Bpf] " Yonghong Song
2024-09-11 20:50 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Yonghong Song @ 2024-09-11 14:30 UTC (permalink / raw)
To: Will Hawkins, bpf, bpf
On 9/10/24 10:50 PM, Will Hawkins wrote:
> Make the values of the symbolic constants that define the valid linkages
> for functions and variables explicit.
>
> Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
LGTM. Thanks!
Acked-by: Yonghong Song <yonghong.song@linux.dev>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bpf] Re: [PATCH v2] docs/bpf: Add constant values for linkages
2024-09-11 14:30 ` Yonghong Song
@ 2024-09-11 14:30 ` Yonghong Song
0 siblings, 0 replies; 5+ messages in thread
From: Yonghong Song @ 2024-09-11 14:30 UTC (permalink / raw)
To: Will Hawkins, bpf, bpf
On 9/10/24 10:50 PM, Will Hawkins wrote:
> Make the values of the symbolic constants that define the valid linkages
> for functions and variables explicit.
>
> Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
LGTM. Thanks!
Acked-by: Yonghong Song <yonghong.song@linux.dev>
--
Bpf mailing list -- bpf@ietf.org
To unsubscribe send an email to bpf-leave@ietf.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] docs/bpf: Add constant values for linkages
2024-09-11 5:50 [PATCH v2] docs/bpf: Add constant values for linkages Will Hawkins
2024-09-11 5:50 ` [Bpf] " Will Hawkins
2024-09-11 14:30 ` Yonghong Song
@ 2024-09-11 20:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-11 20:50 UTC (permalink / raw)
To: Will Hawkins; +Cc: bpf, bpf
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Wed, 11 Sep 2024 01:50:32 -0400 you wrote:
> Make the values of the symbolic constants that define the valid linkages
> for functions and variables explicit.
>
> Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
> ---
> v1 -> v2:
> - Reformat to match style in BPF ISA document
> - Add information about BTF_VAR_GLOBAL_EXTERN
>
> [...]
Here is the summary with links:
- [v2] docs/bpf: Add constant values for linkages
https://git.kernel.org/bpf/bpf-next/c/c229c17a76e9
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-11 20:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-11 5:50 [PATCH v2] docs/bpf: Add constant values for linkages Will Hawkins
2024-09-11 5:50 ` [Bpf] " Will Hawkins
2024-09-11 14:30 ` Yonghong Song
2024-09-11 14:30 ` [Bpf] " Yonghong Song
2024-09-11 20:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox