[Lldb-commits] [lldb] [LLDB] Impove ObjectFileELF's .dynamic parsing and usage. (PR #101237)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 7 04:12:11 PDT 2024
================
@@ -0,0 +1,49 @@
+// REQUIRES: system-linux, native
----------------
labath wrote:
This test still requires linux a bunch of system dependencies. Here's a self-contained version that can be run anywhere (just run the input through yaml2obj and give it to lldb). I took `test/tools/llvm-readobj/ELF/needed-libs.test:` and adapted it for our use case -- I added DT_DEBUG as that's important for lldb, but you can also easily add any other tag you deem necessary
```
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Type: SectionHeaderTable
NoHeaders: true
- Name: .dynstr
Type: SHT_STRTAB
Flags: [ SHF_ALLOC ]
Content: '00616161006262620063636300' ## 0,a,a,a,0,b,b,b,0,c,c,c,0
Size: 0x100
- Name: .dynamic
Type: SHT_DYNAMIC
Address: 0x100
Entries:
- Tag: DT_STRTAB
Value: 0x0000000000000000
- Tag: DT_NEEDED
Value: 9
- Tag: DT_NEEDED
Value: 1
- Tag: DT_NEEDED
Value: 5
- Tag: DT_STRSZ
Value: 0x100
- Tag: DT_DEBUG
Value: 0xdeadbeef
- Tag: DT_NULL
Value: 0x0
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x0
FirstSec: .dynstr
LastSec: .dynamic
- Type: PT_DYNAMIC
FirstSec: .dynamic
LastSec: .dynamic
VAddr: 0x100
Align: 0x8
```
https://github.com/llvm/llvm-project/pull/101237
More information about the lldb-commits
mailing list