Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

long double functions stubs #232

Open
alexkalmuk opened this issue Apr 13, 2021 · 1 comment
Open

long double functions stubs #232

alexkalmuk opened this issue Apr 13, 2021 · 1 comment

Comments

@alexkalmuk
Copy link

Are there stubs of functions that operate with long double types like roundl(), sinl() and so on? I can not find it. I found such stubs in glibc and newlib, hence I wonder shouldn't OpenLibm provide these stubs for the platforms which have long double equal to double type if the check below failed?

openlibm/src/Make.files

Lines 46 to 47 in f052f42

# Add in long double functions for x86, x64 and aarch64
ifeq ($(LONG_DOUBLE_NOT_DOUBLE),1)

@lephe
Copy link
Contributor

lephe commented May 20, 2021

I was looking for this – a bit late but I hope it helps. When long double is double (aka. 64-bit floating-point), the files in src define aliases. For instance, src/s_nan.c has:

#if (LDBL_MANT_DIG == 53)
openlibm_weak_reference(nan, nanl);
#endif

The mechanism used for weak references is defined in src/cdefs-compat.h, as you'd expect it varies heavily depending on the OS and compiler.

You can check that the weak symbol is indeed there by running objdump -t (or readelf, or any other tool) on a relevant object file.

% objdump -t src/s_nan.c.o

src/s_nan.c.o:     file format elf32-big

SYMBOL TABLE:
...
000000fc  w    F .text	0000003c _nanl
000000fc g     F .text	0000003c _nan
...
00000138 g     F .text	00000034 _nanf

It can be missing if the weak reference mechanism doesn't work (this was the case for me, since on my architecture there are underscores before symbol names and src/cdefs-compat.h didn't account for it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants