[RFC PATCH 29/77] Add support for FDT_EXPORT_SYM_REF dtb tag

Herve Codina posted 77 patches 3 weeks, 5 days ago
[RFC PATCH 29/77] Add support for FDT_EXPORT_SYM_REF dtb tag
Posted by Herve Codina 3 weeks, 5 days ago
The FDT_EXPORT_SYM_REF dtb tag is similar to the FDT_EXPORT_SYM tag
except that it identifies a reference to an external phandle. The node
referenced by the phandle is not present in the device-tree blob.

The FDT_EXPORT_SYM_REF dtb tag is a meta-data tag defining an exported
symbol. It can be present in a node bloc meaning that a symbol is
exported at this node level. The node pointed to by this symbol is not a
local node (i.e. the node is not present in the device-tree blob.). This
tag can be available only in overlay or addon device-tree blobs. The
symbol has to be resolved when the device-tree blob is applied on top of
a base device-tree.

It is followed by three values and a possible alignment padding:
  - name (string including \0)
      The export symbol name. I.e. the name used to reference this
      exported symbol.
  - padding:
      Padding (0x00) added to have the next value aligned on 32bit.
  - phandle (32bit)
      A placeholder for a phandle value.
      This placeholder can be used during some dtb manipulation to store
      a temporary phandle value.
      In terms of FDT_EXPORT_SYM_REF definition, it has no meaningful
      signification and will be probably set to 0xffffffff, the
      unresolved phandle value.
  - label (string including \0):
      The label to use to resolve this symbol. This label is the
      reference to the external phandle.
  - padding:
      Padding (0x00) added to have the next value aligned on 32bit.

Example:
  FDT_EXPORT_SYM_REF 'foo1' 0x00 0x00 0x00 0xffffffff 'foo_a' 0x00 0x00

  This means that 'foo1' is an exported symbol and the node referenced
  by this symbol is external to the dtb (unresolved symbol). This
  external node is referenced by the "foo_a" label.

  This is what is encoded in the dtb when the related dts has the
  following exported symbol defined:
    /export/ foo1: &foo_a;
  with 'foo_a' a reference to a non local node.

If several non local symbols are exported at a given node level, several
FDT_EXPORT_SYM_REF are present. Each of them defining one symbol.

For instance, exporting 'foo1' pointing the node referenced by 'foo_a'
and exporting 'bar1' pointing to the node referenced by 'bar_b' leads to
the following sequence:
  FDT_EXPORT_SYM_REF 'foo1' 0x00 0x00 0x00 'foo_a' 0x00 0x00
  FDT_EXPORT_SYM_REF 'bar1' 0x00 0x00 0x00 'bar_b' 0x00 0x00

Add support for this new dtb tag.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 fdtdump.c    | 12 ++++++++++++
 flattree.c   | 40 ++++++++++++++++++++++++++++++++++++++++
 libfdt/fdt.c | 24 ++++++++++++++++++++++++
 libfdt/fdt.h |  2 ++
 4 files changed, 78 insertions(+)

diff --git a/fdtdump.c b/fdtdump.c
index d1af5b6..8baadc4 100644
--- a/fdtdump.c
+++ b/fdtdump.c
@@ -186,6 +186,18 @@ static void dump_blob(void *blob, bool debug)
 			continue;
 		}
 
+		if (tag == FDT_EXPORT_SYM_REF) {
+			s = p;
+			p = PALIGN(p + strlen(s) + 1, 4);
+			val32 = fdt32_to_cpu(GET_CELL(p));
+			t = p;
+			p = PALIGN(p + strlen(t) + 1, 4);
+
+			printf("%*s// [FDT_EXPORT_SYM_REF] '%s' -> '%s'\n", depth * shift, "",
+				s, t);
+			continue;
+		}
+
 		fprintf(stderr, "%*s ** Unknown tag 0x%08"PRIx32"\n", depth * shift, "", tag);
 		break;
 	}
diff --git a/flattree.c b/flattree.c
index bd52e81..d970259 100644
--- a/flattree.c
+++ b/flattree.c
@@ -49,6 +49,7 @@ struct emitter {
 	void (*ref_local)(void *);
 	void (*ref_phandle)(void *);
 	void (*export_sym)(void *);
+	void (*export_sym_ref)(void *);
 };
 
 static void bin_emit_cell(void *e, cell_t val)
@@ -113,6 +114,11 @@ static void bin_emit_export_sym(void *e)
 	bin_emit_cell(e, FDT_EXPORT_SYM);
 }
 
+static void bin_emit_export_sym_ref(void *e)
+{
+	bin_emit_cell(e, FDT_EXPORT_SYM_REF);
+}
+
 static struct emitter bin_emitter = {
 	.cell = bin_emit_cell,
 	.string = bin_emit_string,
@@ -124,6 +130,7 @@ static struct emitter bin_emitter = {
 	.ref_local = bin_emit_ref_local,
 	.ref_phandle = bin_emit_ref_phandle,
 	.export_sym = bin_emit_export_sym,
+	.export_sym_ref = bin_emit_export_sym_ref,
 };
 
 static void emit_label(FILE *f, const char *prefix, const char *label)
@@ -259,6 +266,14 @@ static void asm_emit_export_sym(void *e)
 	asm_emit_cell(e, FDT_EXPORT_SYM);
 }
 
+static void asm_emit_export_sym_ref(void *e)
+{
+	FILE *f = e;
+
+	fprintf(f, "\t/* FDT_EXPORT_SYM_REF */\n");
+	asm_emit_cell(e, FDT_EXPORT_SYM_REF);
+}
+
 static struct emitter asm_emitter = {
 	.cell = asm_emit_cell,
 	.string = asm_emit_string,
@@ -270,6 +285,7 @@ static struct emitter asm_emitter = {
 	.ref_local = asm_emit_ref_local,
 	.ref_phandle = asm_emit_ref_phandle,
 	.export_sym = asm_emit_export_sym,
+	.export_sym = asm_emit_export_sym_ref,
 };
 
 static int stringtable_insert(struct data *d, const char *str)
@@ -369,6 +385,18 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
 				emit->cell(etarget, exportsym->phandle);
 				continue;
 			}
+
+			if (exportsym->ref[0] == '/')
+				die("Export symbol uses a non local reference by path (%s)\n",
+				    m->ref);
+
+			emit->export_sym_ref(etarget);
+			emit->string(etarget, exportsym->name, 0);
+			emit->align(etarget, sizeof(cell_t));
+			/* Placeholder for the phandle */
+			emit->cell(etarget, exportsym->phandle);
+			emit->string(etarget, exportsym->ref, 0);
+			emit->align(etarget, sizeof(cell_t));
 		}
 	}
 
@@ -838,6 +866,7 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
 	uint32_t val;
 	uint32_t offset;
 	const char *str;
+	const char *str2;
 
 	node = build_node(NULL, NULL, NULL, NULL);
 
@@ -919,6 +948,17 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
 			add_symbol(&node->exportsymlist, exportsym);
 			break;
 
+		case FDT_EXPORT_SYM_REF:
+			if (!(flags & FTF_EXPORT_IMPORT_SYM))
+				die("FDT_EXPORT_SYM_REF tag found in flat tree"
+					" version <18\n");
+			str = flat_read_string(dtbuf); /* Name */
+			phandle = flat_read_word(dtbuf); /* Phandle */
+			str2 = flat_read_string(dtbuf); /* Ref */
+			exportsym = build_exportsym(str, str2, phandle, NULL);
+			add_symbol(&node->exportsymlist, exportsym);
+			break;
+
 		default:
 			die("Invalid opcode word %08x in device tree blob\n",
 			    val);
diff --git a/libfdt/fdt.c b/libfdt/fdt.c
index 44d7399..febfa71 100644
--- a/libfdt/fdt.c
+++ b/libfdt/fdt.c
@@ -248,6 +248,29 @@ uint32_t fdt_next_tag_full(const void *fdt, int startoffset, int *nextoffset)
 		offset += sizeof(fdt32_t);
 		break;
 
+	case FDT_EXPORT_SYM_REF:
+		/* Skip name */
+		do {
+			p = fdt_offset_ptr(fdt, offset++, 1);
+		} while (p && (*p != '\0'));
+		if (!can_assume(VALID_DTB) && !p)
+			return FDT_END; /* premature end */
+		offset = FDT_CELLALIGN(offset);
+
+		/* Skip phandle */
+		tmp32p = fdt_offset_ptr(fdt, offset, sizeof(*tmp32p));
+		if (!can_assume(VALID_DTB) && !tmp32p)
+			return FDT_END; /* premature end */
+		offset += sizeof(fdt32_t);
+
+		/* Skip external name */
+		do {
+			p = fdt_offset_ptr(fdt, offset++, 1);
+		} while (p && (*p != '\0'));
+		if (!can_assume(VALID_DTB) && !p)
+			return FDT_END; /* premature end */
+		break;
+
 	default:
 		return FDT_END;
 	}
@@ -290,6 +313,7 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset)
 		case FDT_REF_LOCAL:
 		case FDT_REF_PHANDLE:
 		case FDT_EXPORT_SYM:
+		case FDT_EXPORT_SYM_REF:
 			/*
 			 * Next tag is a meta-data tag present in the middle
 			 * of the structure -> Skip it and look at next one
diff --git a/libfdt/fdt.h b/libfdt/fdt.h
index e85bc07..c23723b 100644
--- a/libfdt/fdt.h
+++ b/libfdt/fdt.h
@@ -65,6 +65,8 @@ struct fdt_property {
 					   external label */
 #define FDT_END		0x9
 #define FDT_EXPORT_SYM	0xa		/* export symbol: name, phandle value */
+#define FDT_EXPORT_SYM_REF 0xb		/* export symbol: name, phandle value (maybe
+					   unresolved), external label */
 
 #define FDT_V1_SIZE	(7*sizeof(fdt32_t))
 #define FDT_V2_SIZE	(FDT_V1_SIZE + sizeof(fdt32_t))
-- 
2.52.0
Re: [RFC PATCH 29/77] Add support for FDT_EXPORT_SYM_REF dtb tag
Posted by David Gibson 3 weeks, 3 days ago
On Mon, Jan 12, 2026 at 03:19:19PM +0100, Herve Codina wrote:
> The FDT_EXPORT_SYM_REF dtb tag is similar to the FDT_EXPORT_SYM tag
> except that it identifies a reference to an external phandle. The node
> referenced by the phandle is not present in the device-tree blob.
> 
> The FDT_EXPORT_SYM_REF dtb tag is a meta-data tag defining an exported
> symbol. It can be present in a node bloc meaning that a symbol is
> exported at this node level. The node pointed to by this symbol is not a
> local node (i.e. the node is not present in the device-tree blob.). This
> tag can be available only in overlay or addon device-tree blobs. The
> symbol has to be resolved when the device-tree blob is applied on top of
> a base device-tree.
> 
> It is followed by three values and a possible alignment padding:
>   - name (string including \0)
>       The export symbol name. I.e. the name used to reference this
>       exported symbol.
>   - padding:
>       Padding (0x00) added to have the next value aligned on 32bit.
>   - phandle (32bit)
>       A placeholder for a phandle value.
>       This placeholder can be used during some dtb manipulation to store
>       a temporary phandle value.

Yuck.

>       In terms of FDT_EXPORT_SYM_REF definition, it has no meaningful
>       signification and will be probably set to 0xffffffff, the
>       unresolved phandle value.
>   - label (string including \0):
>       The label to use to resolve this symbol. This label is the
>       reference to the external phandle.
>   - padding:
>       Padding (0x00) added to have the next value aligned on 32bit.
> 
> Example:
>   FDT_EXPORT_SYM_REF 'foo1' 0x00 0x00 0x00 0xffffffff 'foo_a' 0x00 0x00
> 
>   This means that 'foo1' is an exported symbol and the node referenced
>   by this symbol is external to the dtb (unresolved symbol). This
>   external node is referenced by the "foo_a" label.
> 
>   This is what is encoded in the dtb when the related dts has the
>   following exported symbol defined:
>     /export/ foo1: &foo_a;
>   with 'foo_a' a reference to a non local node.
> 
> If several non local symbols are exported at a given node level, several
> FDT_EXPORT_SYM_REF are present. Each of them defining one symbol.
> 
> For instance, exporting 'foo1' pointing the node referenced by 'foo_a'
> and exporting 'bar1' pointing to the node referenced by 'bar_b' leads to
> the following sequence:
>   FDT_EXPORT_SYM_REF 'foo1' 0x00 0x00 0x00 'foo_a' 0x00 0x00
>   FDT_EXPORT_SYM_REF 'bar1' 0x00 0x00 0x00 'bar_b' 0x00 0x00
> 
> Add support for this new dtb tag.
> 
> Signed-off-by: Herve Codina <herve.codina@bootlin.com>
> ---
>  fdtdump.c    | 12 ++++++++++++
>  flattree.c   | 40 ++++++++++++++++++++++++++++++++++++++++
>  libfdt/fdt.c | 24 ++++++++++++++++++++++++
>  libfdt/fdt.h |  2 ++
>  4 files changed, 78 insertions(+)
> 
> diff --git a/fdtdump.c b/fdtdump.c
> index d1af5b6..8baadc4 100644
> --- a/fdtdump.c
> +++ b/fdtdump.c
> @@ -186,6 +186,18 @@ static void dump_blob(void *blob, bool debug)
>  			continue;
>  		}
>  
> +		if (tag == FDT_EXPORT_SYM_REF) {
> +			s = p;
> +			p = PALIGN(p + strlen(s) + 1, 4);
> +			val32 = fdt32_to_cpu(GET_CELL(p));
> +			t = p;
> +			p = PALIGN(p + strlen(t) + 1, 4);
> +
> +			printf("%*s// [FDT_EXPORT_SYM_REF] '%s' -> '%s'\n", depth * shift, "",
> +				s, t);
> +			continue;
> +		}
> +
>  		fprintf(stderr, "%*s ** Unknown tag 0x%08"PRIx32"\n", depth * shift, "", tag);
>  		break;
>  	}
> diff --git a/flattree.c b/flattree.c
> index bd52e81..d970259 100644
> --- a/flattree.c
> +++ b/flattree.c
> @@ -49,6 +49,7 @@ struct emitter {
>  	void (*ref_local)(void *);
>  	void (*ref_phandle)(void *);
>  	void (*export_sym)(void *);
> +	void (*export_sym_ref)(void *);
>  };
>  
>  static void bin_emit_cell(void *e, cell_t val)
> @@ -113,6 +114,11 @@ static void bin_emit_export_sym(void *e)
>  	bin_emit_cell(e, FDT_EXPORT_SYM);
>  }
>  
> +static void bin_emit_export_sym_ref(void *e)
> +{
> +	bin_emit_cell(e, FDT_EXPORT_SYM_REF);
> +}
> +
>  static struct emitter bin_emitter = {
>  	.cell = bin_emit_cell,
>  	.string = bin_emit_string,
> @@ -124,6 +130,7 @@ static struct emitter bin_emitter = {
>  	.ref_local = bin_emit_ref_local,
>  	.ref_phandle = bin_emit_ref_phandle,
>  	.export_sym = bin_emit_export_sym,
> +	.export_sym_ref = bin_emit_export_sym_ref,
>  };
>  
>  static void emit_label(FILE *f, const char *prefix, const char *label)
> @@ -259,6 +266,14 @@ static void asm_emit_export_sym(void *e)
>  	asm_emit_cell(e, FDT_EXPORT_SYM);
>  }
>  
> +static void asm_emit_export_sym_ref(void *e)
> +{
> +	FILE *f = e;
> +
> +	fprintf(f, "\t/* FDT_EXPORT_SYM_REF */\n");
> +	asm_emit_cell(e, FDT_EXPORT_SYM_REF);
> +}
> +
>  static struct emitter asm_emitter = {
>  	.cell = asm_emit_cell,
>  	.string = asm_emit_string,
> @@ -270,6 +285,7 @@ static struct emitter asm_emitter = {
>  	.ref_local = asm_emit_ref_local,
>  	.ref_phandle = asm_emit_ref_phandle,
>  	.export_sym = asm_emit_export_sym,
> +	.export_sym = asm_emit_export_sym_ref,
>  };
>  
>  static int stringtable_insert(struct data *d, const char *str)
> @@ -369,6 +385,18 @@ static void flatten_tree(struct node *tree, struct emitter *emit,
>  				emit->cell(etarget, exportsym->phandle);
>  				continue;
>  			}
> +
> +			if (exportsym->ref[0] == '/')
> +				die("Export symbol uses a non local reference by path (%s)\n",
> +				    m->ref);
> +
> +			emit->export_sym_ref(etarget);
> +			emit->string(etarget, exportsym->name, 0);
> +			emit->align(etarget, sizeof(cell_t));
> +			/* Placeholder for the phandle */
> +			emit->cell(etarget, exportsym->phandle);
> +			emit->string(etarget, exportsym->ref, 0);
> +			emit->align(etarget, sizeof(cell_t));
>  		}
>  	}
>  
> @@ -838,6 +866,7 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
>  	uint32_t val;
>  	uint32_t offset;
>  	const char *str;
> +	const char *str2;
>  
>  	node = build_node(NULL, NULL, NULL, NULL);
>  
> @@ -919,6 +948,17 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
>  			add_symbol(&node->exportsymlist, exportsym);
>  			break;
>  
> +		case FDT_EXPORT_SYM_REF:
> +			if (!(flags & FTF_EXPORT_IMPORT_SYM))
> +				die("FDT_EXPORT_SYM_REF tag found in flat tree"
> +					" version <18\n");
> +			str = flat_read_string(dtbuf); /* Name */
> +			phandle = flat_read_word(dtbuf); /* Phandle */
> +			str2 = flat_read_string(dtbuf); /* Ref */
> +			exportsym = build_exportsym(str, str2, phandle, NULL);
> +			add_symbol(&node->exportsymlist, exportsym);
> +			break;
> +
>  		default:
>  			die("Invalid opcode word %08x in device tree blob\n",
>  			    val);
> diff --git a/libfdt/fdt.c b/libfdt/fdt.c
> index 44d7399..febfa71 100644
> --- a/libfdt/fdt.c
> +++ b/libfdt/fdt.c
> @@ -248,6 +248,29 @@ uint32_t fdt_next_tag_full(const void *fdt, int startoffset, int *nextoffset)
>  		offset += sizeof(fdt32_t);
>  		break;
>  
> +	case FDT_EXPORT_SYM_REF:
> +		/* Skip name */
> +		do {
> +			p = fdt_offset_ptr(fdt, offset++, 1);
> +		} while (p && (*p != '\0'));
> +		if (!can_assume(VALID_DTB) && !p)
> +			return FDT_END; /* premature end */
> +		offset = FDT_CELLALIGN(offset);
> +
> +		/* Skip phandle */
> +		tmp32p = fdt_offset_ptr(fdt, offset, sizeof(*tmp32p));
> +		if (!can_assume(VALID_DTB) && !tmp32p)
> +			return FDT_END; /* premature end */
> +		offset += sizeof(fdt32_t);
> +
> +		/* Skip external name */
> +		do {
> +			p = fdt_offset_ptr(fdt, offset++, 1);
> +		} while (p && (*p != '\0'));
> +		if (!can_assume(VALID_DTB) && !p)
> +			return FDT_END; /* premature end */
> +		break;
> +
>  	default:
>  		return FDT_END;
>  	}
> @@ -290,6 +313,7 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset)
>  		case FDT_REF_LOCAL:
>  		case FDT_REF_PHANDLE:
>  		case FDT_EXPORT_SYM:
> +		case FDT_EXPORT_SYM_REF:
>  			/*
>  			 * Next tag is a meta-data tag present in the middle
>  			 * of the structure -> Skip it and look at next one
> diff --git a/libfdt/fdt.h b/libfdt/fdt.h
> index e85bc07..c23723b 100644
> --- a/libfdt/fdt.h
> +++ b/libfdt/fdt.h
> @@ -65,6 +65,8 @@ struct fdt_property {
>  					   external label */
>  #define FDT_END		0x9
>  #define FDT_EXPORT_SYM	0xa		/* export symbol: name, phandle value */
> +#define FDT_EXPORT_SYM_REF 0xb		/* export symbol: name, phandle value (maybe
> +					   unresolved), external label */
>  
>  #define FDT_V1_SIZE	(7*sizeof(fdt32_t))
>  #define FDT_V2_SIZE	(FDT_V1_SIZE + sizeof(fdt32_t))
> -- 
> 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
Re: [RFC PATCH 29/77] Add support for FDT_EXPORT_SYM_REF dtb tag
Posted by Herve Codina 2 weeks, 5 days ago
Hi David,

On Thu, 15 Jan 2026 17:25:58 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> On Mon, Jan 12, 2026 at 03:19:19PM +0100, Herve Codina wrote:
> > The FDT_EXPORT_SYM_REF dtb tag is similar to the FDT_EXPORT_SYM tag
> > except that it identifies a reference to an external phandle. The node
> > referenced by the phandle is not present in the device-tree blob.
> > 
> > The FDT_EXPORT_SYM_REF dtb tag is a meta-data tag defining an exported
> > symbol. It can be present in a node bloc meaning that a symbol is
> > exported at this node level. The node pointed to by this symbol is not a
> > local node (i.e. the node is not present in the device-tree blob.). This
> > tag can be available only in overlay or addon device-tree blobs. The
> > symbol has to be resolved when the device-tree blob is applied on top of
> > a base device-tree.
> > 
> > It is followed by three values and a possible alignment padding:
> >   - name (string including \0)
> >       The export symbol name. I.e. the name used to reference this
> >       exported symbol.
> >   - padding:
> >       Padding (0x00) added to have the next value aligned on 32bit.
> >   - phandle (32bit)
> >       A placeholder for a phandle value.
> >       This placeholder can be used during some dtb manipulation to store
> >       a temporary phandle value.  
> 
> Yuck.

Will see what I can do to avoid this placeholder.

I need to store the phandle value related to this symbol during the symbol
resolution. This is done by addon_resolve_phandles() available in
libfdt/fdt_addon.c in patch 70.

libfdt is not designed to perform allocation to store temporary values. It
manipulates data directly mapped from dtb working with offset in dtb blob
without any other kind of object. No specific objects (C struct) for node,
properties, markers, ...

To have an area for this phandle value, a room reserved in dtb was really
the easier way.

But well, I understand your "yuck".

I think it will be quite tricky to store this temporary phandle value
without allocating some additional data.

This placeholder simplified a lot of things but well, I think I need to find
an other solution.

If anyone has any ideas to store the temporary phandle value, I am all ears.

Best regards,
Hervé

Re: [RFC PATCH 29/77] Add support for FDT_EXPORT_SYM_REF dtb tag
Posted by David Gibson 1 week, 3 days ago
On Mon, Jan 19, 2026 at 04:46:28PM +0100, Herve Codina wrote:
> Hi David,
> 
> On Thu, 15 Jan 2026 17:25:58 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > On Mon, Jan 12, 2026 at 03:19:19PM +0100, Herve Codina wrote:
> > > The FDT_EXPORT_SYM_REF dtb tag is similar to the FDT_EXPORT_SYM tag
> > > except that it identifies a reference to an external phandle. The node
> > > referenced by the phandle is not present in the device-tree blob.
> > > 
> > > The FDT_EXPORT_SYM_REF dtb tag is a meta-data tag defining an exported
> > > symbol. It can be present in a node bloc meaning that a symbol is
> > > exported at this node level. The node pointed to by this symbol is not a
> > > local node (i.e. the node is not present in the device-tree blob.). This
> > > tag can be available only in overlay or addon device-tree blobs. The
> > > symbol has to be resolved when the device-tree blob is applied on top of
> > > a base device-tree.
> > > 
> > > It is followed by three values and a possible alignment padding:
> > >   - name (string including \0)
> > >       The export symbol name. I.e. the name used to reference this
> > >       exported symbol.
> > >   - padding:
> > >       Padding (0x00) added to have the next value aligned on 32bit.
> > >   - phandle (32bit)
> > >       A placeholder for a phandle value.
> > >       This placeholder can be used during some dtb manipulation to store
> > >       a temporary phandle value.  
> > 
> > Yuck.
> 
> Will see what I can do to avoid this placeholder.
> 
> I need to store the phandle value related to this symbol during the symbol
> resolution. This is done by addon_resolve_phandles() available in
> libfdt/fdt_addon.c in patch 70.
> 
> libfdt is not designed to perform allocation to store temporary values. It
> manipulates data directly mapped from dtb working with offset in dtb blob
> without any other kind of object. No specific objects (C struct) for node,
> properties, markers, ...

I know. I designed it that way.

Tangent: I have thought that it might be useful to have a diffferent
dt library designed for non-flat trees - i.e. using allocations and
pointers to allow O(1) edits (as well as import/export to flat tree,
of course).  I think that would better suit some of the more complex
tree manipulation many things are doing these days.  I've never had
remotely enough time to look into it, but fwiw, I think the idea's
good.

> To have an area for this phandle value, a room reserved in dtb was really
> the easier way.
> 
> But well, I understand your "yuck".

Yeah, I do realise that lack of free space to put things can make
things really tricky.  I hope we can find a way around this.

> I think it will be quite tricky to store this temporary phandle value
> without allocating some additional data.
> 
> This placeholder simplified a lot of things but well, I think I need to find
> an other solution.
> 
> If anyone has any ideas to store the temporary phandle value, I am all ears.
> 
> Best regards,
> Hervé
> 
> 

-- 
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