Re: [RFC PATCH 23/77] dtc: Introduce mark_local_exports()
From: David Gibson <hidden>
Date: 2026-01-15 06:11:06
Also in:
lkml
On Mon, Jan 12, 2026 at 03:19:13PM +0100, Herve Codina wrote:
In order to have correct tags set in dtb, an export symbol has to be identified as a "local" export symbol when it references a local node. This is done for phandles used by properties in mark_local_phandles(). The same operation is needed for export symbols. This is the purpose of mark_local_exports().
Again, I don't like caching this information. Can you determine this just at the time you specifically use it?
quoted hunk ↗ jump to hunk
Signed-off-by: Herve Codina <herve.codina@bootlin.com> --- dtc.c | 2 ++ dtc.h | 2 ++ livetree.c | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+)diff --git a/dtc.c b/dtc.c index fe8e8e4..030bfa2 100644 --- a/dtc.c +++ b/dtc.c@@ -336,6 +336,8 @@ int main(int argc, char *argv[]) update_phandles_ref(dti); mark_local_phandles(dti); + mark_local_exports(dti); + /* * With FDT_REF_PHANDLE added in dtbs, we need to identified * if some unresolved phandle references are allowed in the dtbdiff --git a/dtc.h b/dtc.h index 0bf5ba5..ea073c2 100644 --- a/dtc.h +++ b/dtc.h@@ -368,6 +368,8 @@ void generate_local_fixups_tree(struct dt_info *dti, const char *name); void update_phandles_ref(struct dt_info *dti); void mark_local_phandles(struct dt_info *dti); +void mark_local_exports(struct dt_info *dti); + /* Checks */ void parse_checks_option(bool warn, bool error, const char *arg);diff --git a/livetree.c b/livetree.c index 4458437..0e756b8 100644 --- a/livetree.c +++ b/livetree.c@@ -1303,3 +1303,26 @@ void mark_local_phandles(struct dt_info *dti) { mark_local_phandles_internal(dti, dti->dt); } + +static void mark_local_exports_internal(struct dt_info *dti, + struct node *node) +{ + struct node *c; + struct symbol *exportsym; + struct node *refnode; + + for_each_symbol(node->exportsymlist, exportsym) { + refnode = get_node_by_ref(dti->dt, exportsym->ref); + if (refnode) + exportsym->is_local = true; + } + + for_each_child(node, c) + mark_local_exports_internal(dti, c); +} + +void mark_local_exports(struct dt_info *dti) +{ + mark_local_exports_internal(dti, dti->dt); + +}-- 2.52.0
-- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson
Attachments
- signature.asc [application/pgp-signature] 833 bytes