summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2019-03-27 11:53:52 +0800
committerDavid Gibson <david@gibson.dropbear.id.au>2019-03-27 17:02:54 +1100
commitae795b2db7a43f8f076a8b688761244ed0f93128 (patch)
treeec2f40cad3f83a4654c8cb596d1a5f30a96a11c2
parenteac2ad495b29f15d78daa2a7226653f36515cd7a (diff)
downloaddevice-tree-compiler-ae795b2db7a43f8f076a8b688761244ed0f93128.tar.gz
checks: Do not omit nodes with labels if symbol generation is requested
Commit 4038fd90056e ("dtc: add ability to make nodes conditional on them being referenced") added the new /omit-if-no-ref/ directive to mark nodes as eligible to be discarded if not referenced. The mechanism to process this happens before the symbol generation phase. This means even if symbol generation is requested and the node has a label, it will be discarded if there are no references to it within the same file. This is probably not what people expect. When using symbol generation to compile base device trees for applying overlays, nodes with labels could be referenced by the overlays, and therefore should be preserved. Check if the node has a label and symbol generation was requested before dropping the node. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Message-Id: <20190327035352.24036-1-wens@csie.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--checks.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/checks.c b/checks.c
index 5865234..0524d41 100644
--- a/checks.c
+++ b/checks.c
@@ -660,6 +660,8 @@ ERROR(path_references, fixup_path_references, NULL, &duplicate_node_names);
static void fixup_omit_unused_nodes(struct check *c, struct dt_info *dti,
struct node *node)
{
+ if (generate_symbols && node->labels)
+ return;
if (node->omit_if_unused && !node->is_referenced)
delete_node(node);
}