[llvm] [llvm-objdump] Honor ELF symbol sizes in selective disassembly (PR #224068)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 28 02:29:41 PDT 2026
================
@@ -0,0 +1,91 @@
+## Selected ELF symbols with a nonzero size include code past internal labels
+## but not padding after the symbol. This also applies to dynamic symbols.
+# REQUIRES: x86-registered-target
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump --disassemble-symbols=foo %t | FileCheck %s --check-prefix=FOO
+# RUN: llvm-objdump --disassemble=foo %t | FileCheck %s --check-prefix=FOO
+# RUN: yaml2obj -DSYMBOLS=DynamicSymbols %s -o %t.dyn
+# RUN: llvm-objdump --disassemble=foo %t.dyn | FileCheck %s --check-prefix=FOO
+
+# FOO: <foo>:
+# FOO-NEXT: 1000: 90 nop
+# FOO-NEXT: 1001: 90 nop
+# FOO-NEXT: 1002: c3 retq
+# FOO-NOT: {{.}}
+
+## Only the selected alias determines the range.
+# RUN: llvm-objdump --disassemble=alias %t | FileCheck %s --check-prefix=ALIAS
+# ALIAS: <alias>:
+# ALIAS-NEXT: 1000: 90 nop
+# ALIAS-NOT: {{.}}
+
+## Overlapping selections do not duplicate instructions or lose labels.
+# RUN: llvm-objdump --disassemble-symbols=foo,inner %t | FileCheck %s --check-prefix=OVERLAP
+# OVERLAP: <foo>:
+# OVERLAP-NEXT: 1000: 90 nop
+# OVERLAP-EMPTY:
+# OVERLAP-NEXT: 0000000000001001 <inner>:
+# OVERLAP-NEXT: 1001: 90 nop
+# OVERLAP-NEXT: 1002: c3 retq
+# OVERLAP-NOT: {{.}}
+
+## A zero size still ends at the next symbol.
----------------
jh7370 wrote:
"still" is only relevant in the context of the PR. Once this change lands, it doesn't make sense. (Ask yourself the question "what does it mean once this behaviour is the current behaviour of llvm-objdump?"). Same goes for other similar wording.
If you used an LLM to write these comments. Try deleting them, then writing the comments yourself using your own wording (then get an LLM to proof-read it, if you like).
Are there no zero-sized symbol plus --disassemble= tests already?
https://github.com/llvm/llvm-project/pull/224068
More information about the llvm-commits
mailing list