Skip to content

obj2yaml does not seem to preserve dependency information for ELF shared libraries #161513

@SahilPatidar

Description

@SahilPatidar

When converting an ELF shared library (.so) to YAML using obj2yaml and then back to a .so using yaml2obj, the NEEDED entries do not appear to be preserved as expected. Instead of the shared library names, the output shows numeric values.

I am not sure if this is the intended behavior or a missing feature/bug.

Steps:

# Original .so has dependencies:
0x0000000000000001 (NEEDED)             Shared library: [libA.so]
0x0000000000000001 (NEEDED)             Shared library: [libB.so]
0x0000000000000001 (NEEDED)             Shared library: [libD.so]
0x0000000000000001 (NEEDED)             Shared library: [libZ.so]

# Convert original .so → yaml → new .so
obj2yaml original.so > lib.yaml
yaml2obj lib.yaml > new.so

# New .so shows:
# readelf -d libC.so | grep NEEDED
0x0000000000000001 (NEEDED)             0x6e
0x0000000000000001 (NEEDED)             0x76
0x0000000000000001 (NEEDED)             0x7e
0x0000000000000001 (NEEDED)             0x86

Environment:

  • Host: macOS (Apple M1)
  • Running inside Docker:
docker run --platform=linux/amd64 -it --rm -v $(pwd):/workspace ubuntu:22.04
  • LLVM version: 22.0.0git (built inside Docker)

Library Build : https://gist.github.com/SahilPatidar/00a46afc5e3168b992c6e51974c9853d

Is this the expected behavior for obj2yaml/yaml2obj with ELF?

Metadata

Metadata

Assignees

No one assigned

    Labels

    objectyamlquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions