Commit dba420bc authored by James Henderson's avatar James Henderson
Browse files

[test][tools] Add missing and improve testing

Mostly this adds testing for certain aliases in more explicit ways.
There are also a few tidy-ups, and additions of missing testing, where
the feature was either not tested at all, or not tested explicitly and
sufficiently.

Reviewed by: MaskRay, rupprecht, grimar

Differential Revision: https://reviews.llvm.org/D71116
parent 0d1490bf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
RUN: llvm-symbolizer --inlining --obj=%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x8dc 0xa05 0x987 | FileCheck %s
RUN: llvm-symbolizer -i --obj=%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x8dc 0xa05 0x987 | FileCheck %s
RUN: llvm-symbolizer --inlines --obj=%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x8dc 0xa05 0x987 | FileCheck %s

CHECK:      inlined_h
CHECK-NEXT: dwarfdump-inl-test.h:2
+4 −0
Original line number Diff line number Diff line
# RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-i386 \
# RUN:         | FileCheck %s -check-prefix ELF-32
# RUN: llvm-nm --dynamic %p/Inputs/shared-object-test.elf-i386 \
# RUN:         | FileCheck %s -check-prefix ELF-32

# ELF-32-NOT: U
# ELF-32: 000012c8 A __bss_start
@@ -12,6 +14,8 @@

# RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-x86-64 \
# RUN:         | FileCheck %s -check-prefix ELF-64
# RUN: llvm-nm --dynamic %p/Inputs/shared-object-test.elf-x86-64 \
# RUN:         | FileCheck %s -check-prefix ELF-64

# ELF-64-NOT: U
# ELF-64: 0000000000200454 A __bss_start
+3 −3
Original line number Diff line number Diff line
RUN: llvm-cxxfilt -n _Z1fi abc | FileCheck %s
RUN: echo "Mangled _Z1fi and _Z3foov in string." | llvm-cxxfilt -n \
RUN: llvm-cxxfilt _Z1fi abc | FileCheck %s
RUN: echo "Mangled _Z1fi and _Z3foov in string." | llvm-cxxfilt \
RUN:   | FileCheck %s --check-prefix=CHECK-STRING
RUN: llvm-cxxfilt -n "CLI remains mangled _Z1fi" \
RUN: llvm-cxxfilt "CLI remains mangled _Z1fi" \
RUN:   | FileCheck %s --check-prefix=CHECK-MANGLED

CHECK: f(int)
+3 −1
Original line number Diff line number Diff line
RUN: llvm-cxxfilt -_ __ZN2ns1fE _ZSt1f _f | FileCheck %s -check-prefix CHECK-STRIPPED
RUN: llvm-cxxfilt --strip-underscore __ZN2ns1fE _ZSt1f _f | FileCheck %s -check-prefix CHECK-STRIPPED
RUN: llvm-cxxfilt __ZN2ns1fE _ZSt1f _f | FileCheck %s -check-prefix CHECK-UNSTRIPPED
RUN: llvm-cxxfilt -n __ZN2ns1fE _ZSt1f _f | FileCheck %s -check-prefix CHECK-UNSTRIPPED
RUN: llvm-cxxfilt --no-strip-underscore __ZN2ns1fE _ZSt1f _f | FileCheck %s -check-prefix CHECK-UNSTRIPPED

CHECK-STRIPPED: ns::f
CHECK-STRIPPED: _ZSt1f
@@ -8,4 +11,3 @@ CHECK-STRIPPED: _f
CHECK-UNSTRIPPED: __ZN2ns1fE
CHECK-UNSTRIPPED: std::f
CHECK-UNSTRIPPED: _f
+58 −0
Original line number Diff line number Diff line
## Show that llvm-nm prints the symbols of all ELF members of an archive.

# RUN: yaml2obj %s --docnum=1 -o %t1.o
# RUN: yaml2obj %s --docnum=2 -o %t2.o

# RUN: rm -f %t.symtab
# RUN: llvm-ar rc %t.symtab %t1.o %t2.o
# RUN: llvm-nm %t.symtab | FileCheck %s --match-full-lines

# RUN: rm -f %t.nosymtab
# RUN: llvm-ar rcS %t.nosymtab %t1.o %t2.o
# RUN: llvm-nm %t.nosymtab | FileCheck %s --match-full-lines

# CHECK:      {{.*}}1.o:
# CHECK-NEXT: 00000002 D global_data_symbol
# CHECK-NEXT: 00000000 T global_function_symbol
# CHECK-EMPTY:
# CHECK-NEXT: {{.*}}2.o:
# CHECK-NEXT: 00000001 D another_data_symbol

--- !ELF
FileHeader:
  Class:   ELFCLASS32
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_386
Sections:
  - Name:  .text
    Type:  SHT_PROGBITS
    Flags: [SHF_ALLOC, SHF_EXECINSTR]
  - Name:  .data
    Type:  SHT_PROGBITS
    Flags: [SHF_ALLOC, SHF_WRITE]
Symbols:
  - Name:    global_function_symbol
    Value:   0x0
    Binding: STB_GLOBAL
    Section: .text
  - Name:    global_data_symbol
    Binding: STB_GLOBAL
    Section: .data
    Value:   0x2

--- !ELF
FileHeader:
  Class:   ELFCLASS32
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_386
Sections:
  - Name:  .data
    Type:  SHT_PROGBITS
    Flags: [SHF_ALLOC, SHF_WRITE]
Symbols:
  - Name:    another_data_symbol
    Binding: STB_GLOBAL
    Section: .data
    Value:   0x1
Loading