Issue 161513
Summary `obj2yaml` does not seem to preserve dependency information for ELF shared libraries
Labels question, objectyaml
Assignees
Reporter 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:**

```bash
# 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:

```bash
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?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to