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

Meador Inge via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 12:17:20 PST 2016


Author: meadori
Date: Wed Nov 23 14:17:20 2016
New Revision: 287803

URL: http://llvm.org/viewvc/llvm-project?rev=287803&view=rev
Log:
llvm-nm: Print correct symbol types for init and fini sections

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

Added:
    llvm/trunk/test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64   (with props)
    llvm/trunk/test/tools/llvm-nm/X86/init-fini.test
Modified:
    llvm/trunk/tools/llvm-nm/llvm-nm.cpp

Added: llvm/trunk/test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64?rev=287803&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64 (added) and llvm/trunk/test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64 Wed Nov 23 14:17:20 2016 differ

Propchange: llvm/trunk/test/tools/llvm-nm/X86/Inputs/init-fini.out.elf-x86_64
------------------------------------------------------------------------------
    svn:executable = *

Added: llvm/trunk/test/tools/llvm-nm/X86/init-fini.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-nm/X86/init-fini.test?rev=287803&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-nm/X86/init-fini.test (added)
+++ llvm/trunk/test/tools/llvm-nm/X86/init-fini.test Wed Nov 23 14:17:20 2016
@@ -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

Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=287803&r1=287802&r2=287803&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Wed Nov 23 14:17:20 2016
@@ -778,6 +778,9 @@ static char getSymbolNMTypeChar(ELFObjec
       break;
     case ELF::SHT_NOBITS:
       return 'b';
+    case ELF::SHT_INIT_ARRAY:
+    case ELF::SHT_FINI_ARRAY:
+      return 't';
     }
   }
 




More information about the llvm-commits mailing list