You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an ifunc in a shared library is referenced, mlibc's dynamic linker currently resolves it to the resolver function instead of the target function. This is because such references are linked with the R_<arch>_JUMP_SLOT and R_<arch>_GLOB_DAT relocations instead of the R_<arch>_IRELATIVE one. The dynamic linker is supposed to handle this by detecting that the resolved symbol is STT_GNU_IFUNC and dereferencing it, but mlibc doesn't do this.
$ gcc test1.c -o libtest.so -shared
$ gcc test2.c -o test -L. -ltest -Wl,-rpath=.
$ ./test
# expected output (glibc): 1# actual output (mlibc): address of foo_impl, truncated to 32 bits and interpreted as signed
The text was updated successfully, but these errors were encountered:
monkuous
changed the title
ifunc references to shared library functions are not resolve correctly
ifunc references to shared library functions are not resolved correctly
Jan 30, 2025
When an ifunc in a shared library is referenced, mlibc's dynamic linker currently resolves it to the resolver function instead of the target function. This is because such references are linked with the
R_<arch>_JUMP_SLOT
andR_<arch>_GLOB_DAT
relocations instead of theR_<arch>_IRELATIVE
one. The dynamic linker is supposed to handle this by detecting that the resolved symbol isSTT_GNU_IFUNC
and dereferencing it, but mlibc doesn't do this.Test case
test1.c
:test2.c
:The text was updated successfully, but these errors were encountered: