]> granicus.if.org Git - llvm/commitdiff
llvm-nm: Print correct symbol types for init and fini sections
authorMeador Inge <meadori@codesourcery.com>
Wed, 23 Nov 2016 20:17:20 +0000 (20:17 +0000)
committerMeador Inge <meadori@codesourcery.com>
Wed, 23 Nov 2016 20:17:20 +0000 (20:17 +0000)
This patch fixes a small bug where symbols defined in the INIT
and FINI sections were incorrectly getting a type of 'n'.

Differential Revision: https://reviews.llvm.org/D26937

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287803 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64 [new file with mode: 0755]
test/tools/llvm-nm/X86/init-fini.test [new file with mode: 0644]
tools/llvm-nm/llvm-nm.cpp

diff --git a/test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64 b/test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64
new file mode 100755 (executable)
index 0000000..b5c74f2
Binary files /dev/null and b/test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64 differ
diff --git a/test/tools/llvm-nm/X86/init-fini.test b/test/tools/llvm-nm/X86/init-fini.test
new file mode 100644 (file)
index 0000000..86afc71
--- /dev/null
@@ -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
index e89d1d31048266cd08ce9c73b79df31abe3384c7..8c6fa4ecec70ed7f120b214e7e689335bba61905 100644 (file)
@@ -778,6 +778,9 @@ static char getSymbolNMTypeChar(ELFObjectFileBase &Obj,
       break;
     case ELF::SHT_NOBITS:
       return 'b';
+    case ELF::SHT_INIT_ARRAY:
+    case ELF::SHT_FINI_ARRAY:
+      return 't';
     }
   }