[Lldb-commits] [lldb] Add support for reading the dynamic symbol table from PT_DYNAMIC (PR #112596)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 30 06:17:56 PDT 2024


================
@@ -0,0 +1,42 @@
+// This test verifies that loading an ELF file that has no section headers can
+// load the dynamic symbol table using the DT_SYMTAB, DT_SYMENT, DT_HASH or
+// the DT_GNU_HASH .dynamic key/value pairs that are loaded via the PT_DYNAMIC
+// segment.
+
+// RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \
+// RUN:   -o - - <<<".globl defined, undefined; defined:" | \
+// RUN:   ld.lld /dev/stdin -o - --hash-style=gnu -export-dynamic -shared \
----------------
labath wrote:

```suggestion
// RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s -o %t.o \
// RUN: ld.lld %t.o --hash-style=gnu -export-dynamic -shared \
```

.. and put the asm input into this file. I don't think `<<<` and `/dev/stdin` will work on windows. I've just used as a simple command for experimentation.

I would also recommend more unique names and thinking about whether there are any corner cases that are worth explicitly testing (e.g. deliberately creating some hash collisions?).

https://github.com/llvm/llvm-project/pull/112596


More information about the lldb-commits mailing list