Bug 31488 - undefined reference to `fmod'" error on i586
Summary: undefined reference to `fmod'" error on i586
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: 2.38
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-14 14:01 UTC by Akhilesh Kumar
Modified: 2024-05-10 16:19 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Akhilesh Kumar 2024-03-14 14:01:53 UTC
Hi 

I am using glibc 2.38, while Some of external module compilation I observed  "undefined reference to `fmod'" error. 

I observed this only in x586 for risc-v working fine. 

Reason, for i586 no "fmod" week symbol in libm.so, but same symbol is available in risc-v compiled libm.so  


Looks this behaviour is due to below changes. 

https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=16439f419b270184ec501c531bf20d83b6745fb0


i586 (no fmod week symbol)

khilesh.k@DELL-BUILD01:~source/build$ nm  lib/libm.so.6 | grep fmod
00000000000252a0 t __fmod
0000000000010af0 t __fmod_compat
00000000000143f0 t __fmod_compatf
0000000000038010 t __fmodf
0000000000063fb0 t __fmodf128
0000000000063fb0 W fmodf128
00000000000476e0 T __fmodf128_finite@GLIBC_2.26
0000000000038010 W fmodf32
00000000000252a0 W fmodf32x
00000000000252a0 W fmodf64
000000000000f320 W fmodf64x
0000000000038010 T __fmodf_finite@GLIBC_2.15
00000000000143f0 T fmodf@GLIBC_2.2.5
0000000000038010 T fmodf@@GLIBC_2.38
00000000000252a0 T __fmod_finite@GLIBC_2.15
0000000000010af0 T fmod@GLIBC_2.2.5
00000000000252a0 T fmod@@GLIBC_2.38
000000000000f320 t __fmodl
000000000000f320 W fmodl
0000000000015950 T __fmodl_finite@GLIBC_2.15
00000000000252a0 t __ieee754_fmod
0000000000038010 t __ieee754_fmodf
00000000000476e0 t __ieee754_fmodf128
0000000000015950 t __ieee754_fmodl
00000000000252a0 t __SI__fmod_1
0000000000010af0 t __SI__fmod_compat_0
00000000000143f0 t __SI__fmod_compatf_0
0000000000038010 t __SI__fmodf_0
00000000000252a0 t __SI__ieee754_fmod_0
0000000000038010 t __SI__ieee754_fmodf_1
00000000000476e0 t __SI__ieee754_fmodf128_0
0000000000015950 t __SI__ieee754_fmodl_0

Risc-v result (W fmod)

khilesh.k@DELL-BUILD01:~$ nm ./riscv64-none-linux-gnu/sys-root/lib64/lp64d/libm.so.6 | grep fmod
0000000000026c12 t __fmod
0000000000026c12 W fmod
00000000000346f2 t __fmodf
00000000000346f2 W fmodf
00000000000237e0 W fmodf128
00000000000346f2 W fmodf32
0000000000026c12 W fmodf32x
0000000000026c12 W fmodf64
00000000000237e0 W fmodf64x


Thanks 
Akhilesh
Comment 1 Adhemerval Zanella 2024-03-14 15:59:23 UTC
Could you provide the configure options, including the GCC one? I am trying to reproduce it on 2.38 release branch and fmod is present:

i586-linux-gnu-master$ objdump -t math/libm.so | grep -w fmod
000104b0  w    F .text  000000b8              fmod

And this would be readily triggered by check-abi and math tests. Also, 16439f419b270184ec501c531bf20d83b6745fb0 commit should not matter for i686 (you can check that it adds the fmod@2.38 to all but i386 abi).
Comment 2 Andreas Schwab 2024-03-14 16:08:47 UTC
This is the symbol list for x86_64, not i586, and it defines fmod@@GLIBC_2.38 as expected.
Comment 3 Andreas Schwab 2024-03-14 16:14:39 UTC
But the static libm.a for i586 does not define fmod and fmodf (I would expect them to appear in w_fmod.o and w_fmodf.o, resp):

w_fmodl_compat.o:
w_fmod_compat.o:
w_fmodf_compat.o:
e_fmodl.o:
00000000 T __ieee754_fmodl
w_fmodl.o:
00000000 T __fmodl
         U __ieee754_fmodl
00000000 W fmodf64x
00000000 W fmodl
e_fmod.o:
00000000 T __ieee754_fmod
w_fmod.o:
e_fmodf.o:
00000000 T __ieee754_fmodf
w_fmodf.o:
e_fmodf128.o:
00000000 T __ieee754_fmodf128
         U __ieee754_fmodf128
         U __ieee754_fmodf128
w_fmodf128.o:
00000000 T __fmodf128
         U __ieee754_fmodf128
00000000 W fmodf128
Comment 4 Adhemerval Zanella 2024-03-14 16:16:15 UTC
Ah right, this is an issue for static build. I will take a look.
Comment 5 Akhilesh Kumar 2024-05-10 09:41:02 UTC
Hi 

Any update on this ?
Comment 6 Adhemerval Zanella 2024-05-10 16:19:20 UTC
It stil(In reply to Akhilesh Kumar from comment #5)
> Hi 
> 
> Any update on this ?

It is still under review https://patchwork.sourceware.org/project/glibc/list/?series=32436