unikraft / lib-musl

musl: A C standard library
Other
9 stars 29 forks source link

Makefile.uk: Include missing cpow* functions #64

Closed andreittr closed 1 year ago

andreittr commented 1 year ago

The complex number library was previously missing the implementation of cpow* functions. This change corrects this omission.

andreittr commented 1 year ago

@andreittr I get the following errors when building with the musl-complex library enabled:

/usr/bin/ld: workdir/apps/nginx/build/libmusl.o: in function `cpow':
workdir/apps/nginx/build/libmusl/origin/musl-1.2.3//src/complex/cpow.c:7: undefined reference to `__muldc3'
/usr/bin/ld: workdir/apps/nginx/build/libmusl.o: in function `cpowf':
workdir/apps/nginx/build/libmusl/origin/musl-1.2.3//src/complex/cpowf.c:5: undefined reference to `__mulsc3'
/usr/bin/ld: workdir/apps/nginx/build/libmusl.o: in function `cpowl':
workdir/apps/nginx/build/libmusl/origin/musl-1.2.3//src/complex/cpowl.c:11: undefined reference to `__mulxc3'

Is there anything I'm missing?

These functions are emitted by the compiler and implemented in lib-compiler-rt (especially if you're building with clang, does it happen with GCC as well?). More details here. You might want to grab https://github.com/unikraft/lib-compiler-rt/pull/14 as well to not have to pull in an entire C++ runtime.

StefanJum commented 1 year ago

These functions are emitted by the compiler and implemented in lib-compiler-rt (especially if you're building with clang, does it happen with GCC as well?). More details here. You might want to grab unikraft/lib-compiler-rt#14 as well to not have to pull in an entire C++ runtime.

Yes, it happens on gcc too. Should we then do a select or depends on for the compiler-rt library in case LIBMUSL_COMPLEX is selected?

andreittr commented 1 year ago

Yes, it happens on gcc too. Should we then do a select or depends on for the compiler-rt library in case LIBMUSL_COMPLEX is selected?

Updated w/ new commit; had libcomplex select compiler-rt.