[PATCH] D26937: llvm-nm: Print correct symbol types for init and fini sections

Meador Inge via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 14:09:50 PST 2016


meadori created this revision.
meadori added reviewers: llvm-commits, Bigcheese, enderby.

This patch fixes a small bug where symbols defined in the INIT
and FINI sections were incorrectly getting a type of 'n'.


https://reviews.llvm.org/D26937

Files:
  test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64
  test/tools/llvm-nm/X86/init-fini.test
  tools/llvm-nm/llvm-nm.cpp


Index: tools/llvm-nm/llvm-nm.cpp
===================================================================
--- tools/llvm-nm/llvm-nm.cpp
+++ tools/llvm-nm/llvm-nm.cpp
@@ -778,6 +778,9 @@
       break;
     case ELF::SHT_NOBITS:
       return 'b';
+    case ELF::SHT_INIT_ARRAY:
+    case ELF::SHT_FINI_ARRAY:
+      return 't';
     }
   }
 
Index: test/tools/llvm-nm/X86/init-fini.test
===================================================================
--- /dev/null
+++ test/tools/llvm-nm/X86/init-fini.test
@@ -0,0 +1,8 @@
+# RUN: llvm-nm -B -S %p/Inputs/init-fini.out.elf-x86_64 | FileCheck --match-full-lines %s
+
+CHECK: 00000000006000c2 0000000000000000 T __bss_start
+CHECK: 00000000006000c2 0000000000000000 t __init_array_end
+CHECK: 00000000006000ba 0000000000000000 t __init_array_start
+CHECK: 00000000006000c2 0000000000000000 T _edata
+CHECK: 00000000006000c8 0000000000000000 T _end
+CHECK: 00000000004000b0 0000000000000000 T _start


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26937.78782.patch
Type: text/x-patch
Size: 945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161121/9028b457/attachment.bin>


More information about the llvm-commits mailing list