Skip to contentSkip to conversation

scripts: dtc: libfdt: fdt_ro.c: always define fdt_check_full

PATCH In review Philippe Reynes 2 participants 3 messages Feb 9, 2022 – Feb 23, 2022 Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: dtc: libfdt: fdt_ro.c: always define fdt_check_full

On some configs (like stm32mp15_dhcom_basic_defconfig), if configs SPL_LOAD_FIT_FULL and SPL_FIT_FULL_CHECK are enabled. Then the compilatio fails with the following error:

arm-linux-gnueabi-ld.bfd: boot/image-fit.o: in function `fit_check_format':
<PATH>/uboot/u-boot-stm/boot/image-fit.c:1641: undefined reference to `fdt_check_full' scripts/Makefile.spl:509: recipe for target 'spl/u-boot-spl' failed

This issue happens because the function fdt_check_full is only defined if "!defined(FDT_ASSUME_MASK) || FDT_ASSUME_MASK != 0xff". But this function may be called even if this condition are not verified. To avoid this issue, the function fdt_check_full is always defined.

---
 scripts/dtc/libfdt/fdt_ro.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
scripts/dtc/libfdt/fdt_ro.c +7 -1
index efe7efe921..63eaf57f43 100644
@@ -937,4 +937,10 @@ int fdt_check_full(const void *fdt, size_t bufsize)
 		}
 	}
 }
-#endif
+#else
+int fdt_check_full(const void __always_unused *fdt,
+		   size_t __always_unused bufsize)
+{
+	return 0;
+}
+#endif /* #if !defined(FDT_ASSUME_MASK) || FDT_ASSUME_MASK != 0xff */
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Philippe Reynes

On some configs (like stm32mp15_dhcom_basic_defconfig), if configs SPL_LOAD_FIT_FULL and SPL_FIT_FULL_CHECK are enabled. Then the compilatio fails with the following error:

arm-linux-gnueabi-ld.bfd: boot/image-fit.o: in function `fit_check_format':
<PATH>/uboot/u-boot-stm/boot/image-fit.c:1641: undefined reference to `fdt_check_full' scripts/Makefile.spl:509: recipe for target 'spl/u-boot-spl' failed

This issue happens because the function fdt_check_full is only defined if "!defined(FDT_ASSUME_MASK) || FDT_ASSUME_MASK != 0xff". But this function may be called even if this condition are not verified. To avoid this issue, the function fdt_check_full is always defined.

Quoted 4 lines
---
 scripts/dtc/libfdt/fdt_ro.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Reviewed-by
#2 lore raw
Quoted 14 lines · Philippe Reynes

On some configs (like stm32mp15_dhcom_basic_defconfig), if configs SPL_LOAD_FIT_FULL and SPL_FIT_FULL_CHECK are enabled. Then the compilatio fails with the following error:

arm-linux-gnueabi-ld.bfd: boot/image-fit.o: in function `fit_check_format':
<PATH>/uboot/u-boot-stm/boot/image-fit.c:1641: undefined reference to `fdt_check_full' scripts/Makefile.spl:509: recipe for target 'spl/u-boot-spl' failed

This issue happens because the function fdt_check_full is only defined if "!defined(FDT_ASSUME_MASK) || FDT_ASSUME_MASK != 0xff". But this function may be called even if this condition are not verified. To avoid this issue, the function fdt_check_full is always defined.

Quoted 4 lines
---
 scripts/dtc/libfdt/fdt_ro.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Applied to u-boot-dm, thanks!