Skip to content

Should --clear-symbol-version remove versions from multiple instances? #252

Open
@nitz

Description

@nitz

Describe the bug

I have a shared object I'm attempting to remove the symbol version from that is linking to a newer version of libm.so than my machine has. The shared object seems to have 2 instances of the symbol, one in .dynsym the other in .symtab, but the --clear-symbol-version flag only seems to work on the first.

Steps To Reproduce

Example:

cmd@t:~/app $ readelf -a libMySharedObject.so | grep pow
000b3000  00007416 R_ARM_JUMP_SLOT   00000000   pow@GLIBC_2.29
   116: 00000000     0 FUNC    GLOBAL DEFAULT  UND pow@GLIBC_2.29 (15)
  6483: 00000000     0 FUNC    GLOBAL DEFAULT  UND pow@@GLIBC_2.29

cmd@t:~/app $ patchelf --clear-symbol-version pow libMySharedObject.so --debug
patching ELF file 'libMySharedObject.so'
clearing symbol version for pow
writing libMySharedObject.so

cmd@t:~/app $ readelf -a libMySharedObject.so | grep pow
000b3000  00007416 R_ARM_JUMP_SLOT   00000000   pow
   116: 00000000     0 FUNC    GLOBAL DEFAULT  UND pow
  6483: 00000000     0 FUNC    GLOBAL DEFAULT  UND pow@@GLIBC_2.29

cmd@t:~/app $

Expected behavior

Both symbols should have their version requirement removed, not just the first. Is it perhaps because the second symbol is in .symtab? The one that survives, pow@@GLIBC_2.29 still shows up with, and still seems to be required:

cmd@t:~/app $ ./test
./test: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.29' not found (required by ./libMySharedObject.so)

patchelf --version output

patchelf 0.12

Additional context

The binary is a cross compiled binary (host machine was x86_64, target is armv8a.
I unfortunately don't have a binary I can share at this time, but may be able to do so in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions