[llvm] [llvm-nm] Drop STT_FILE/STT_SECTION from --special-syms (PR #192129)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 03:52:13 PDT 2026


================
@@ -4,6 +4,12 @@
 # RUN: llvm-nm %t | count 0
 # RUN: llvm-nm %t --special-syms | FileCheck %s
 
+## --special-syms should show mapping symbols but not STT_FILE or STT_SECTION.
+# CHECK:      2000 d $d.1
+# CHECK-NEXT: 1000 t $x.1
+# CHECK-NOT:  file_sym
+# CHECK-NOT:  .text
----------------
jh7370 wrote:

This will show that `file_sym` and `.text` won't appear after the two mapping symbols, but doesn't show that they won't appear before the mapping symbols. You need to do one of three things:

1) Add a positive CHECK pattern that matches the start of the file and modify the first real check to CHECK-SAME, e.g:
```
# CHECK: {{^}}
# CHECK-SAME: 2000 d $d.1
```
2) Duplicate the CHECK-NOT either side of the entry.
3) Use `--implicit-check-not=file_sym` and `--implicit-check-not=.text`

I think I prefer the last option.

Same applies for each test.

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


More information about the llvm-commits mailing list