binman: Support positioning an entry by and ELF symbol

In some cases it is useful to position an entry over the top of a symbol
in an ELF file. For example, if the symbol holds a version string then it
allows the string to be accessed from the fdtmap.

Add support for this.

Suggested-by: Pali Rohár <pali@kernel.org>
Suggested-by: Keith Short <keithshort@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/binman/test/274_offset_from_elf.dts b/tools/binman/test/274_offset_from_elf.dts
new file mode 100644
index 0000000..e3372fc
--- /dev/null
+++ b/tools/binman/test/274_offset_from_elf.dts
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		blob: blob {
+			filename = "blob_syms.bin";
+			elf-filename = "blob_syms";
+			elf-base-sym = "__my_start_sym";
+		};
+
+		inset {
+			type = "null";
+			offset-from-elf = <&blob>, "val3", <0>;
+			size = <4>;
+			overlap;
+		};
+
+		inset2 {
+			type = "null";
+			offset-from-elf = <&blob>, "val3", <4>;
+			size = <4>;
+			overlap;
+		};
+	};
+};