This corresponds to the latest status (hasn't changed in 9+ years) from openbsd of ld80/ld128 powl, and source cpowf, cpow, cpowl (the complex power functions for float complex, double complex, and long double complex) which are required for C99 compliance and were missing from FreeBSD. Also required for some numerical codes using complex numbered Hamiltonians.
Details
- Reviewers
mmacy - Group Reviewers
manpages - Commits
- rS336767: MFC r327400 (by eadler):
rS336299: msun: add ld80/ld128 powl, cpow, cpowf, cpowl from openbsd
make universe completes for targets i386, amd64, arm64, risc (except sf), and powerpc . Solves link issue and works for a complex numbered tight binding Hamiltonian (compared to using opensolaris libm from ports) on amd64.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
universe on riscv reveals that we generally didn't have a powl but instead re-used regular pow. Only gcc on risvc complains about this though. Hence, import powl for ld80 and ld128 from openbsd (and some helper routines) and restrict the workaround to mantissa 53 architectures (power). with this, universe passes on amd64, i386, riscv (except sf but that seems to be expected), arm64, and powerpc.
lib/msun/Symbol.map | ||
---|---|---|
279 | I would keep the comment as it appears to still be relevant for tgammal? It's not clear if powl() is now always precise. If it is I would perhaps move it into sorted order above the comment. | |
lib/msun/src/imprecise.c | ||
53 ↗ | (On Diff #44278) | I don't understand why we are keeping imprecise_powl() for platforms where double == long double? Shouldn't we instead remove powl from here entirely and add a conditional __weak_reference() from powl to pow in src/e_pow.c instead the same as is done at the bottom of src/e_log.c for logl aliased to log? |
Thanks for the comments!
lib/msun/Symbol.map | ||
---|---|---|
279 | Thanks, good point, I'll move it up - in line with logl which also is mostly precise. | |
lib/msun/src/imprecise.c | ||
53 ↗ | (On Diff #44278) | I indeed tried that at first and it wouldn't add the weak reference. I hence decided to do the minimally intrusive change and just ifdef it here for such platforms. I can try to sort out the weak reference again. |
Results for using weak_reference as opposed to imprecise.c
lib/msun/src/imprecise.c | ||
---|---|---|
53 ↗ | (On Diff #44278) | Again attempted that, it fails with ld: error: can't create dynamic relocation R_PPC_LOCAL24PC against symbol: _GLOBAL_OFFSET_TABLE_ in readonly segment; recompile object files with -fPIC >>> defined in <internal> >>> referenced by crtstuff.c >>> /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o:(.text+0x8) ld: error: can't create dynamic relocation R_PPC_GOT16 against symbol: .LANCHOR0 in readonly segment; recompile object files with -fPIC >>> defined in /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o >>> referenced by crtstuff.c >>> /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o:(.text+0x1E) ld: error: can't create dynamic relocation R_PPC_GOT16 against symbol: __cxa_finalize in readonly segment; recompile object files with -fPIC >>> defined in atexit.pico >>> referenced by crtstuff.c >>> /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o:(.text+0x3A) --- lib/libc_nonshared__L --- --- lib/libc__L --- ld: error: can't create dynamic relocation R_PPC_GOT16 against symbol: __dso_handle in readonly segment; recompile object files with -fPIC >>> defined in /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o >>> referenced by crtstuff.c >>> /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o:(.text+0x46) ld: error: can't create dynamic relocation R_PPC_GOT16 against symbol: .LANCHOR1 in readonly segment; recompile object files with -fPIC >>> defined in /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o >>> referenced by crtstuff.c >>> /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o:(.text+0x52) ld: error: can't create dynamic relocation R_PPC_LOCAL24PC against symbol: _GLOBAL_OFFSET_TABLE_ in readonly segment; recompile object files with -fPIC >>> defined in <internal> >>> referenced by crtstuff.c >>> /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o:(.text+0xE4) ld: error: can't create dynamic relocation R_PPC_GOT16 against symbol: .LANCHOR2 in readonly segment; recompile object files with -fPIC >>> defined in /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o >>> referenced by crtstuff.c >>> /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o:(.text+0xFE) ld: error: can't create dynamic relocation R_PPC_GOT16 against symbol: _Jv_RegisterClasses in readonly segment; recompile object files with -fPIC >>> defined in /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o >>> referenced by crtstuff.c >>> /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o:(.text+0x10E) ld: error: can't create dynamic relocation R_PPC_LOCAL24PC against local symbol in readonly segment; recompile object files with -fPIC >>> defined in /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o >>> referenced by crtstuff.c >>> /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o:(.fini+0x0) ld: error: can't create dynamic relocation R_PPC_LOCAL24PC against local symbol in readonly segment; recompile object files with -fPIC >>> defined in /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o >>> referenced by crtstuff.c >>> /usr/obj/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o:(.init+0x0) ld: error: can't create dynamic relocation R_PPC_LOCAL24PC against symbol: _GLOBAL_OFFSET_TABLE_ in readonly segment; recompile object files with -fPIC >>> defined in <internal> >>> referenced by wcsxfrm.c:46 (/usr/src/lib/libc/string/wcsxfrm.c:46) on all powerpc targets when linking libc. |
lib/msun/src/imprecise.c | ||
---|---|---|
53 ↗ | (On Diff #44278) | None of these errors are for libm, but for libc which is compiled earlier in world. Can you update the diff with the version that doesn't use imprecise.c? |
Version using weak_reference instead of imprecise. Does not build world on power* platforms.
lib/msun/src/e_pow.c | ||
---|---|---|
59 ↗ | (On Diff #45003) | Still waiting for a universe with my suggested fix to finish, but you need to add #include <float.h> here just as it is in e_log.c so that LDBL_MANT_DIG is defined. This added the missing 'powl' symbol to e_pow.o and e_pow.pico object files for me on the mips.mips build of libm. |