undefined reference to `__aeabi_dcmpgt'

Bug #1441916 reported by Alper Kultur
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
Invalid
Undecided
Unassigned

Bug Description

Hello,

I am using GCC arm toolchain 4.9.3 and it gives below undefined reference errors. Looks like libgcc.a is missing those functions. Do you have any idea?

.../delivery/Tools/ARM_GNU/Win32/arm-none-eabi/lib/armv7e-m/fpu\libm.a(lib_a-e_asin.o): In function `__ieee754_asin':
e_asin.c:(.text.__ieee754_asin+0x68): undefined reference to `__aeabi_dcmpgt'
.../delivery/Tools/ARM_GNU/Win32/arm-none-eabi/lib/armv7e-m/fpu\libm.a(lib_a-e_rem_pio2.o): In function `__ieee754_rem_pio2':
e_rem_pio2.c:(.text.__ieee754_rem_pio2+0xee): undefined reference to `__aeabi_dcmpeq'
e_rem_pio2.c:(.text.__ieee754_rem_pio2+0x100): undefined reference to `__aeabi_dcmpeq'
.../delivery/Tools/ARM_GNU/Win32/arm-none-eabi/lib/armv7e-m/fpu\libm.a(lib_a-k_rem_pio2.o): In function `__kernel_rem_pio2':
k_rem_pio2.c:(.text.__kernel_rem_pio2+0x268): undefined reference to `__aeabi_dcmpeq'
k_rem_pio2.c:(.text.__kernel_rem_pio2+0x3a0): undefined reference to `__aeabi_dcmpge'
k_rem_pio2.c:(.text.__kernel_rem_pio2+0x404): undefined reference to `__aeabi_dcmpge'
.../delivery/Tools/ARM_GNU/Win32/arm-none-eabi/lib/armv7e-m/fpu\libm.a(lib_a-s_atan.o): In function `atan':
s_atan.c:(.text.atan+0x1ac): undefined reference to `__aeabi_dcmpgt'
.../delivery/Tools/ARM_GNU/Win32/arm-none-eabi/lib/armv7e-m/fpu\libm.a(lib_a-s_floor.o): In function `floor':
s_floor.c:(.text.floor+0x3c): undefined reference to `__aeabi_dcmpgt'
s_floor.c:(.text.floor+0x8a): undefined reference to `__aeabi_dcmpgt'
s_floor.c:(.text.floor+0xb6): undefined reference to `__aeabi_dcmpgt'

Thanks,
Alper

Revision history for this message
Alper Kultur (alperkultur) wrote :

Actually I also run readelf for libgcc.a and could not found the above undefined reference (missing functions) there. Can someone help me why those functions might be missing in toolchain?

Thanks,
Alper

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) wrote :

Hi Alper,

These functions are defined from libm.a and defined in libgcc.a. I'm guessing you link with -specs=nosys.specs -lm. Try exchanging the order. When an object X define a symbol used in an object Y the object Y should always appear *before* the object X on the command line. If that's already what you are doing, could you provide us the command line you are using to link?

Best regards.

Revision history for this message
Alper Kultur (alperkultur) wrote :

Hello Thomas,

Yes I am using -specs=nosys.specs -lm. Reversing the order did not help much :(. I am attaching my full command line.

Thanks again!
Alper

Revision history for this message
Terry Guo (terry.guo) wrote :

I suspect the problem comes from your last link step ""C:/p4/Sandbox/akultur/dev/v10_227604/customers/cust_name/platform_name/delivery/Tools/ARM_GNU/Win32/bin/arm-none-eabi-ld.exe" SensorHub/src/ctl_main.oplat_name_GCC483A2EMBOS SensorHub/src/sensor_hub_controller.oplat_name_GCC483A2EMBOS SensorHub/src/startup.oplat_name_GCC483A2EMBOS SensorHub/lib/AKM09912_lib_high_speed.a SensorHub/lib/libCyweeSensorHubHWFPU.a ./BSP/lib/iar_thunker_Stingray_A2_r.a -lc -lgcc -lm -Map SensorHub.map -T C:/p4/Sandbox/akultur/dev/v10_227604/customers/cust_name/platform_name/delivery/Tools/link_script_4773.ld -R ./BSP/lib/Stingray_A2_bsp_r.sym -LC:/p4/Sandbox/akultur/dev/v10_227604/customers/cust_name/platform_name/delivery/Tools/ARM_GNU/Win32/arm-none-eabi/lib/armv7e-m/fpu -L./Tools/ARM_GNU/win32/arm-none-eabi/lib/armv7e-m/fpu -L ./Tools/ARM_GNU/win32/lib/gcc/arm-none-eabi/4.8.4 -L. -o bin/Exe/SensorHub.elf"

Please do not use arm-none-eabi-ld.exe to do link. Please remove all -L options and link with command "arm-none-eabi-gcc.exe -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16". This command will automatically find correct library for you.

Revision history for this message
Alper Kultur (alperkultur) wrote :

Hello Terry,

I actually had tried that previously but that time I am getting 2 different problems

1) I cannot link my .sym symbolic link file. I mean for arm-none-eabi-ld.exe this is done successfully by using -R command argument. Do you know which command argument should I use with arm-none-eabi-gcc.exe to be able to link .sym file?

2) For arm-none-eabi-ld.exe -Map command argument was working fine but for arm-none-eabi-gcc.exe -Map is not working. Do you know an alternate command argument for -Map ?

 $(CC) $(SENSORHUB_LIB_OBJS) $(CUST_LIBS) $(IAR_THUNKER_LIB_NAME) $(LDFLAGS) -lc -lgcc -lm -lnosys -Map $(MAPNAME) -T $(LINKER_SCRIPT) -R $(BSP_SYM) $(LIBS) -L$(MCU_LIB_PATH) -L$(TOPDIR)/Tools/ARM_GNU/win32/arm-none-eabi/lib/armv7e-m/fpu -L $(TOPDIR)/Tools/ARM_GNU/win32/lib/gcc/arm-none-eabi/4.8.4 -L. -o $@

Thanks,
Alper

Revision history for this message
Alper Kultur (alperkultur) wrote :

Hi all,

I fixed this issue. It was due to the wrong order of -l flags. I am still using ld.exe instead of gcc.exe during linking process.

Thanks,
Alper

Revision history for this message
Terry Guo (terry.guo) wrote :

Please refer to https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Link-Options.html#Link-Options,

-Wl,option
    Pass option as an option to the linker. If option contains commas, it is split into multiple options at the commas. You can use this syntax to pass an argument to the option. For example, -Wl,-Map,output.map passes -Map output.map to the linker. When using the GNU linker, you can also get the same effect with -Wl,-Map=output.map.

The gcc.exe works like a driver, it firstly figured out correct library path then it invokes ld.exe to do final link. So for link options -R and -Map, I think we can use -Wl,-R and -Wl,-Map for gcc.exe.

Using gcc.exe rather than ld.exe is exactly to avoid library path issue.

Revision history for this message
Terry Guo (terry.guo) wrote :

Mark as invalid because this is a usage problem of options. Feel free to re-open if you have further concerns.

Changed in gcc-arm-embedded:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.