llvm.org GIT mirror llvm / e3108d3
Changed the lvm-nm alias "-s" for -print-armap to "-M". This will allow the "-s" flag to implemented in the future as it is in darwin’s nm(1) to list symbols only in the specified section. Given a LGTM by Shankar Easwaran who originally implemented the support for lvm-nm’s -print-armap and archive map symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212576 91177308-0d34-0410-b5e6-96231b3b80d8 Kevin Enderby 6 years ago
8 changed file(s) with 15 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: llvm-as %s -o=%t1
11 ; RUN: rm -f %t2
22 ; RUN: llvm-ar rcs %t2 %t1
3 ; RUN: llvm-nm -s %t2 | FileCheck %s
3 ; RUN: llvm-nm -M %t2 | FileCheck %s
44
55 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
66 target triple = "x86_64-unknown-linux-gnu"
0 #
11 # Check if the index is appearing properly in the output file
22 #
3 RUN: llvm-nm -s %p/Inputs/liblong_filenames.a | FileCheck -check-prefix=CHECKIDX %s
3 RUN: llvm-nm -M %p/Inputs/liblong_filenames.a | FileCheck -check-prefix=CHECKIDX %s
44
55 CHECKIDX: Archive map
66 CHECKIDX: abcdefghijklmnopqrstuvwxyz12345678 in 1.o
0 RUN: rm -f %t.a
11 RUN: llvm-ar rcs %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
2 RUN: llvm-nm -s %t.a | FileCheck %s
2 RUN: llvm-nm -M %t.a | FileCheck %s
33
44 CHECK: Archive map
55 CHECK-NEXT: main in trivial-object-test.elf-x86-64
1919
2020 RUN: rm -f %t.a
2121 RUN: llvm-ar rcS %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
22 RUN: llvm-nm -s %t.a | FileCheck %s --check-prefix=NOMAP
22 RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
2323
2424 NOMAP-NOT: Archive map
2525
2626 RUN: llvm-ar s %t.a
27 RUN: llvm-nm -s %t.a | FileCheck %s
27 RUN: llvm-nm -M %t.a | FileCheck %s
2828
2929 check that the archive does have a corrupt symbol table.
3030 RUN: rm -f %t.a
3131 RUN: cp %p/Inputs/archive-test.a-corrupt-symbol-table %t.a
32 RUN: llvm-nm -s %t.a | FileCheck %s --check-prefix=CORRUPT
32 RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
3333
3434 CORRUPT: Archive map
3535 CORRUPT-NEXT: mbin in trivial-object-test.elf-x86-64
4848
4949 check that the we *don't* update the symbol table.
5050 RUN: llvm-ar s %t.a
51 RUN: llvm-nm -s %t.a | FileCheck %s --check-prefix=CORRUPT
51 RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=CORRUPT
5252
5353 repeate the test with llvm-ranlib
5454
5555 RUN: rm -f %t.a
5656 RUN: llvm-ar rcS %t.a %p/Inputs/trivial-object-test.elf-x86-64 %p/Inputs/trivial-object-test2.elf-x86-64
57 RUN: llvm-nm -s %t.a | FileCheck %s --check-prefix=NOMAP
57 RUN: llvm-nm -M %t.a | FileCheck %s --check-prefix=NOMAP
5858
5959 RUN: llvm-ranlib %t.a
60 RUN: llvm-nm -s %t.a | FileCheck %s
60 RUN: llvm-nm -M %t.a | FileCheck %s
6161
62 RUN: llvm-nm -s %p/Inputs/macho-archive-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
62 RUN: llvm-nm -M %p/Inputs/macho-archive-x86_64.a | FileCheck %s --check-prefix=BSD-MachO
6363
6464 BSD-MachO: Archive map
6565 BSD-MachO: _bar in bar.o
44 # than 15 characters, thus, unlike coff_archive.lib, it has no string
55 # table as the third member.
66 #
7 RUN: llvm-nm --numeric-sort -s %p/Inputs/coff_archive_short.lib | FileCheck -check-prefix=CHECKIDX %s
7 RUN: llvm-nm --numeric-sort -M %p/Inputs/coff_archive_short.lib | FileCheck -check-prefix=CHECKIDX %s
88
99 CHECKIDX: Archive map
1010 CHECKIDX: _shortfn1 in short1.obj
0 #
11 # Check if the index is appearing properly in the output file
22 #
3 RUN: llvm-nm --numeric-sort -s %p/Inputs/coff_archive.lib | FileCheck -check-prefix=CHECKIDX %s
3 RUN: llvm-nm --numeric-sort -M %p/Inputs/coff_archive.lib | FileCheck -check-prefix=CHECKIDX %s
44
55 CHECKIDX: Archive map
66 CHECKIDX: ??0invalid_argument@std@@QAE@PBD@Z in Debug\mymath.obj
2929
3030
3131 And don't crash when asked to print a non-existing symtab.
32 RUN: llvm-nm -s %p/Inputs/archive-test.a-gnu-minimal
32 RUN: llvm-nm -M %p/Inputs/archive-test.a-gnu-minimal
3333
3434 Don't reject an empty archive.
3535 RUN: llvm-nm %p/Inputs/archive-test.a-empty
0 #
11 # Check if the index is appearing properly in the output file
22 #
3 RUN: llvm-nm -s %p/Inputs/libsimple_archive.a | FileCheck -check-prefix=CHECKIDX %s
3 RUN: llvm-nm -M %p/Inputs/libsimple_archive.a | FileCheck -check-prefix=CHECKIDX %s
44
55 CHECKIDX: Archive map
66 CHECKIDX: abcdefghijklmnopqrstuvwxyz12345678 in 1.o
128128 cl::desc("Exclude aliases from output"));
129129
130130 cl::opt ArchiveMap("print-armap", cl::desc("Print the archive map"));
131 cl::alias ArchiveMaps("s", cl::desc("Alias for --print-armap"),
131 cl::alias ArchiveMaps("M", cl::desc("Alias for --print-armap"),
132132 cl::aliasopt(ArchiveMap));
133133
134134 cl::opt JustSymbolName("just-symbol-name",