bitbake u-boot-imx failed because undefined reference to __aeabi_d2iz

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

bitbake u-boot-imx failed because undefined reference to __aeabi_d2iz

Jump to solution
3,102 Views
TKayO
Contributor III

Hello, 

 

I added some code in my $UBOOT/board/freescale/mx6sabresd.c.

which is some calculation of double precision variables.

 

then when I build my u-boot-imx with "bitbake u-boot-imx"

following errors occurs.

 

/MY-ROOT/uboot/board/freescale/mx6sabresd/mx6sabresd.c:2135: undefined reference to `__aeabi_d2iz'
arm-poky-linux-gnueabi-ld.bfd: /MY-ROOT/uboot/board/freescale/mx6sabresd/mx6sabresd.c:2135: undefined reference to `__aeabi_d2iz'
arm-poky-linux-gnueabi-ld.bfd: /MY-ROOT/uboot/board/freescale/mx6sabresd/mx6sabresd.c:2137: undefined reference to `__aeabi_dcmplt'
arm-poky-linux-gnueabi-ld.bfd: /MY-ROOT/uboot/board/freescale/mx6sabresd/mx6sabresd.c:2149: undefined reference to `__aeabi_dcmpgt'
arm-poky-linux-gnueabi-ld.bfd: /MY-ROOT/uboot/board/freescale/mx6sabresd/mx6sabresd.c:2143: undefined reference to `__aeabi_dcmplt'
arm-poky-linux-gnueabi-ld.bfd: /MY-ROOT/uboot/board/freescale/mx6sabresd/mx6sabresd.c:2149: undefined reference to `__aeabi_dcmpgt'
arm-poky-linux-gnueabi-ld.bfd: /MY-ROOT/uboot/board/freescale/mx6sabresd/mx6sabresd.c:2149: undefined reference to `__aeabi_dcmpgt'
make: *** [Makefile:1704: u-boot] Error 1

 

the double precision calculation codes are copied from my earlier project in u-boot.2009.

and there was no problem with 2009 version.

 

Please help with any suggestions. 

Thank you!!

0 Kudos
1 Solution
3,057 Views
TKayO
Contributor III

Here's solution..

 

in arch/arm/config.mk

# added the bold text part
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \
             -fno-common -ffixed-r9 \
             -mfpu=neon -mfloat-abi=hard
 
# and removed the bold text part
PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \
      $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 
in my defconfig
added below
# CONFIG_USE_PRIVATE_LIBGCC is not set
this option effects the Makefile 
 
# Add GCC lib
ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
else
PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
endif
PLATFORM_LIBS += $(PLATFORM_LIBGCC)
 
Regards

View solution in original post

6 Replies
3,058 Views
TKayO
Contributor III

Here's solution..

 

in arch/arm/config.mk

# added the bold text part
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections \
             -fno-common -ffixed-r9 \
             -mfpu=neon -mfloat-abi=hard
 
# and removed the bold text part
PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \
      $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 
in my defconfig
added below
# CONFIG_USE_PRIVATE_LIBGCC is not set
this option effects the Makefile 
 
# Add GCC lib
ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
else
PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
endif
PLATFORM_LIBS += $(PLATFORM_LIBGCC)
 
Regards
3,069 Views
TKayO
Contributor III

modified defconfig with

"# CONFIG_USE_PRIVATE_LIBGCC is not set"

then 

arm-poky-linux-gnueabi-ld.bfd: error: /home/brant/work/imx/bld-imx6dlsabresd-xwayland-full/_local/tool/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/lib/arm-poky-linux-gnueabi/10.2.0/libgcc.a(_udivmoddi4.o) uses VFP register arguments, u-boot does not
arm-poky-linux-gnueabi-ld.bfd: warning: /home/brant/work/imx/bld-imx6dlsabresd-xwayland-full/_local/tool/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/lib/arm-poky-linux-gnueabi/10.2.0/libgcc.a(_udivmoddi4.o) uses 4-byte wchar_t yet the output is to use 2-byte wchar_t; use of wchar_t values across objects may fail
arm-poky-linux-gnueabi-ld.bfd: failed to merge target specific data of file /home/brant/work/imx/bld-imx6dlsabresd-xwayland-full/_local/tool/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/lib/arm-poky-linux-gnueabi/10.2.0/libgcc.a(_udivmoddi4.o)
make: *** [Makefile:1704: u-boot] Error 1

0 Kudos
3,068 Views
TKayO
Contributor III

added "-mfpu=vfpv3 -mfloat-abi=hard"

to PLATFORM_RELFLAGS in config.mk

 
 
and now I have a warning.. 
 
"arm-poky-linux-gnueabi-ld.bfd: warning: /home/brant/work/imx/bld-imx6dlsabresd-xwayland-full/_local/tool/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/lib/arm-poky-linux-gnueabi/10.2.0/libgcc.a(_udivmoddi4.o) uses 4-byte wchar_t yet the output is to use 2-byte wchar_t; use of wchar_t values across objects may fail"
 
 
0 Kudos
3,072 Views
TKayO
Contributor III

https://community.nxp.com/t5/i-MX-Processors/how-to-use-float-operation-in-uboot-codes/m-p/1071182

 

this topic says no floating point supported in u-boot. 

also double precision?

0 Kudos
3,090 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello Brant8484,

__aeabi_d2iz lives in libgcc.a. libgcc.a must be linked *AFTER* libm.a.

Adding "gcc" to the Linker | Libraries | Libraries pane after "m" fixed the problem.

We had a -lgcc in the Miscellaneous Linker Flags pane, which apparently caused libgcc.a to be linked BEFORE libm.a.

However please try the latest uboot is fully tested and works ok.

 

Regards

0 Kudos
3,079 Views
TKayO
Contributor III

Hello, 

Thank you for your reply.

I'm working with u-boot version lf_v2020.04.

 

I added my Makefile (board/freescale/mx6sabresd/Makefile) like below,


LDFLAGS_mc6sabresd.o := -lgcc
obj-y  := mx6sabresd.o 
 
and there's no differences.
@Bio_TICFSL Can you help me with exact file name and modification point?
 
Regards.
0 Kudos