[DTrace-devel] [PATCH] Remove list of pre-populated BPF function symbols
Kris Van Hees
kris.van.hees at oracle.com
Wed Feb 16 20:49:26 UTC 2022
The list of pre-defined BPF function symbols is no longer needed because
it gets populated by loading the BPF dlib.
Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
libdtrace/dt_as.c | 20 ++------------------
libdtrace/dt_dlibs.c | 29 +++++++----------------------
2 files changed, 9 insertions(+), 40 deletions(-)
diff --git a/libdtrace/dt_as.c b/libdtrace/dt_as.c
index d88fe65c..8ae7bd96 100644
--- a/libdtrace/dt_as.c
+++ b/libdtrace/dt_as.c
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
@@ -521,23 +521,7 @@ fail:
*/
rp->dofr_name = (dof_stridx_t)soff;
rp->dofr_offset = (i - 1) * sizeof(uint64_t);
-
- /*
- * BPF built-in functions (predicate and
- * program) are special because they are part
- * of the executable code we are processing
- * here. Set the value in the relocation entry
- * to be the instruction offset of the function
- * *and* update the call instruction with the
- * correct offset delta.
- */
- if (idp->di_kind == DT_IDENT_FUNC) {
- assert(idp->di_id < dlp->dl_label);
- rp->dofr_data = labels[idp->di_id];
- dp->dtdo_buf[i - 1].imm =
- labels[idp->di_id] - i;
- } else
- rp->dofr_data = idp->di_id;
+ rp->dofr_data = idp->di_id;
} else {
/*
* Relocation for a regular external symbol.
diff --git a/libdtrace/dt_dlibs.c b/libdtrace/dt_dlibs.c
index a15b8269..ebed0509 100644
--- a/libdtrace/dt_dlibs.c
+++ b/libdtrace/dt_dlibs.c
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
@@ -50,28 +50,11 @@ static dtrace_attribute_t dt_bpf_attr = DT_ATTR_STABCMN;
static const dt_ident_t dt_bpf_symbols[] = {
/* BPF built-in functions */
- DT_BPF_SYMBOL(dt_program, DT_IDENT_FUNC),
- /* BPF library (external) functions */
- DT_BPF_SYMBOL(dt_agg_lqbin, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_agg_qbin, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_basename, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_dirname, DT_IDENT_SYMBOL),
DT_BPF_SYMBOL(dt_error, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_get_bvar, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_get_tvar, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_index, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_lltostr, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_rindex, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_strchr, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_strcmp, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_strjoin, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_strrchr, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_strtok, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_substr, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_speculation, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_speculation_speculate, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_speculation_set_drainable, DT_IDENT_SYMBOL),
- DT_BPF_SYMBOL(dt_strnlen, DT_IDENT_SYMBOL),
+
+ /* BPF library (external) functions */
+ /* not pre-populated (identifier type DT_IDENT_SYMBOL) */
+
/* BPF maps */
DT_BPF_SYMBOL(aggs, DT_IDENT_PTR),
DT_BPF_SYMBOL(buffers, DT_IDENT_PTR),
@@ -84,6 +67,7 @@ static const dt_ident_t dt_bpf_symbols[] = {
DT_BPF_SYMBOL(specs, DT_IDENT_PTR),
DT_BPF_SYMBOL(state, DT_IDENT_PTR),
DT_BPF_SYMBOL(strtab, DT_IDENT_PTR),
+
/* BPF internal identifiers */
DT_BPF_SYMBOL_ID(EPID, DT_IDENT_SCALAR, DT_CONST_EPID),
DT_BPF_SYMBOL_ID(PRID, DT_IDENT_SCALAR, DT_CONST_PRID),
@@ -95,6 +79,7 @@ static const dt_ident_t dt_bpf_symbols[] = {
DT_BPF_SYMBOL_ID(BOOTTM, DT_IDENT_SCALAR, DT_CONST_BOOTTM),
DT_BPF_SYMBOL_ID(NSPEC, DT_IDENT_SCALAR, DT_CONST_NSPEC),
DT_BPF_SYMBOL_ID(NCPUS, DT_IDENT_SCALAR, DT_CONST_NCPUS),
+
/* End-of-list marker */
{ NULL, }
};
--
2.34.1
More information about the DTrace-devel
mailing list