Bug 259617

Summary: ARM support function __aeabi_d2uiz missing
Product: Base System Reporter: Robert Clausecker <fuz>
Component: armAssignee: freebsd-arm (Nobody) <freebsd-arm>
Status: Closed DUPLICATE    
Severity: Affects Only Me CC: emaste, jrtc27
Priority: --- Flags: fuz: mfc-stable13?
fuz: mfc-stable12?
Version: 13.0-RELEASE   
Hardware: arm   
OS: Any   

Description Robert Clausecker freebsd_committer freebsd_triage 2021-11-02 17:31:07 UTC
When compiling the following code in Thumb mode on armv6 FreeBSD 13, linking fails due to an undefined symbol __aeabi_d2iz.  On armv7 FreeBSD 13 the issue is not directly reproducible because this support function is not needed, but you can pass -march=armv6 to make it fail the same way.

#include <stdio.h>
#include <stdlib.h>

int main()
{
	double f;

	f = strtod("1.0", NULL);

	printf("%u\n", (unsigned int)f);
}

To compile, type:

$ cc -mthumb -o x x.c                                                                 
ld: error: undefined symbol: __aeabi_d2uiz
>>> referenced by x.c
>>>               /tmp/x-c2541a.o:(main)
>>> did you mean: __aeabi_d2iz
>>> defined in: /lib/libc.so.7
cc: error: linker command failed with exit code 1 (use -v to see invocation)

It appears that this function is missing despite being provided in
contrib/llvm-project/compiler-rt/lib/builtins/fixunsdfsi.c.
Comment 1 Robert Clausecker freebsd_committer freebsd_triage 2021-11-02 17:32:36 UTC
Sorry, it's __aeabi_d2uiz of course.
Comment 2 Ed Maste freebsd_committer freebsd_triage 2021-11-05 15:30:13 UTC
contrib/llvm-project/compiler-rt/lib/builtins/fixunsdfsi.c:

COMPILER_RT_ABI su_int __fixunsdfsi(fp_t a) { return __fixuint(a); }

#if defined(__ARM_EABI__)
#if defined(COMPILER_RT_ARMHF_TARGET)
AEABI_RTABI su_int __aeabi_d2uiz(fp_t a) { return __fixunsdfsi(a); }
#else
COMPILER_RT_ALIAS(__fixunsdfsi, __aeabi_d2uiz)
#endif
#endif

Presumably making this available is just a matter of #defines and Symbol.map entries.
Comment 3 Jessica Clarke freebsd_committer freebsd_triage 2023-04-26 22:57:01 UTC

*** This bug has been marked as a duplicate of bug 271087 ***