fpga: add inline stub for fpga_load
PATCH v2 1/1 fpga: add inline stub for fpga_load
In case CC_OPTIMIZE_FOR_DEBUG is set, unused code will not be optimized out, hence the reference to fpga_load will be compiled.
if DM_FPGA and SPL_FPGA are not set, the build will fail with :
aarch64-none-linux-gnu-ld.bfd: common/spl/spl_fit.o: in function `spl_fit_upload_fpga':u-boot/common/spl/spl_fit.c:595: undefined reference to `fpga_load'
To solve this, added an inline empty stub in the header if CC_OPTIMIZE_FOR_DEBUG is set such that the build will succeed.
---
Changes in v2:
- this is a rework as suggested by Simon of this previous patch :
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
include/fpga.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/fpga.h +9 -0
@@ -60,8 +60,17 @@ int fpga_add(fpga_type devtype, void *desc);int fpga_count (void );const fpga_desc *const fpga_get_desc (int devnum);int fpga_is_partial_data (int devnum,size_t img_len); +#if defined(CONFIG_CC_OPTIMIZE_FOR_DEBUG ) +static inline int fpga_load (int devnum,const void *buf,size_t bsize, +bitstream_type bstype,int flags) +{ +return 0 ; +} +#else int fpga_load (int devnum,const void *buf,size_t bsize,bitstream_type bstype,int flags); +#endif +int fpga_fsload (int devnum,const void *buf,size_t size,fpga_fs_info *fpga_fsinfo); int fpga_loads(int devnum, const void *buf, size_t size,
Signature · 1 line
2.34.1
Hi Eugen,
Quoted 25 lines · Eugen Hristev
In case
CC_OPTIMIZE_FOR_DEBUGis set, unused code will not be optimized out, hence the reference tofpga_loadwill be compiled.
ifDM_FPGAandSPL_FPGAare not set, the build will fail with :aarch64-none-linux-gnu-ld.bfd:
common/spl/spl_fit.o: in function `spl_fit_upload_fpga':u-boot/common/spl/spl_fit.c:595: undefined reference to `fpga_load'To solve this, added an inline empty stub in the header if
CC_OPTIMIZE_FOR_DEBUGis set such that the build will succeed.Signed-off-by Eugen Hristev <[email protected]>---
Changes in v2:
- this is a rework as suggested by Simon of this previous patch :
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/include/fpga.h | 9 +++++++++ 1 file changed, 9 insertions(+)include/fpga.h +0
-0
include/fpga.h int fpga_add(fpga_type devtype, void *desc); · line 67
Quoted 8 lines
include/fpga.h +5
-0@@ -60,8 +60,17 @@ int fpga_add(fpga_type devtype, void *desc);int fpga_count (void );const fpga_desc *const fpga_get_desc (int devnum);int fpga_is_partial_data (int devnum,size_t img_len); +#if defined(CONFIG_CC_OPTIMIZE_FOR_DEBUG ) +static inline int fpga_load (int devnum,const void *buf,size_t bsize, +bitstream_type bstype,int flags) +{ +return 0 ;
It should return -ENOSYS, right?
Quoted 10 lines
include/fpga.h +4
-1+} +#else int fpga_load (int devnum,const void *buf,size_t bsize,bitstream_type bstype,int flags); +#endif +int fpga_fsload (int devnum,const void *buf,size_t size,fpga_fs_info *fpga_fsinfo); int fpga_loads(int devnum, const void *buf, size_t size, --
Quoted 2 lines
2.34.1
Regards,
SImon