Follow-up to the discussion in https://reviews.llvm.org/D141824. Because the
purpose of the test is to test loading a shared library, and clang tests
traditionally have not invoked actual linking, reduce this test case to loading
a shared library only.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Unit Tests
Time | Test | |
---|---|---|
230 ms | x64 debian > Clang.Interpreter::dynamic-library.cpp |
Event Timeline
Comment Actions
This doesn't work. The test would fail with
error: libdynamic-library-test.so: ELF load command address/offset not properly aligned
I first used obj2yaml to convert libdynamic-library-test.so to YAML, and then the test uses yaml2obj to convert it back. But it looks like yaml2obj could not generate a loadable shared library. The input library's first load offset starts at 0x000:
LOAD off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**12 filesz 0x00000000000004f4 memsz 0x00000000000004f4 flags r--
It contains a padding section before the first real section .dynsym:
Sections: Idx Name Size VMA Type 0 00000000 0000000000000000 1 .dynsym 000000a8 0000000000000238
But in the output library of yaml2obj, the first load offset does not start at 0x000 but with the start of .dynsym 0x238
LOAD off 0x0000000000000238 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**12 filesz 0x00000000000002bc memsz 0x00000000000002bc flags r--
It's not aligned by 0x1000 and therefore it failed to load.