You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.1 KiB

## Test that llvm-objdump can dump dynamic symbols.
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-objdump --dynamic-syms %t1 | \
# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=DYNSYM
# RUN: llvm-objdump -T %t1 | \
# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=DYNSYM
# DYNSYM:DYNAMIC SYMBOL TABLE:
# DYNSYM-NEXT:0000000000000000 l DO .data 0000000000000000 localsym
# DYNSYM-NEXT:0000000000000000 g DO .data 0000000000000000 globalsym
# DYNSYM-NEXT:0000000000000000 u DO .data 0000000000000000 uniqueglobalsym
# DYNSYM-NEXT:0000000000000000 w DO .data 0000000000000000 weaksym
# DYNSYM-NEXT:0000000000000000 g Df .data 0000000000000000 filesym
# DYNSYM-NEXT:0000000000000000 g DF .data 0000000000000000 funcsym
# DYNSYM-EMPTY:
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_WRITE ]
DynamicSymbols:
- Name: localsym
Type: STT_OBJECT
Section: .data
Binding: STB_LOCAL
- Name: globalsym
Type: STT_OBJECT
Section: .data
Binding: STB_GLOBAL
- Name: uniqueglobalsym
Type: STT_OBJECT
Section: .data
Binding: STB_GNU_UNIQUE
- Name: weaksym
Type: STT_OBJECT
Section: .data
Binding: STB_WEAK
- Name: filesym
Type: STT_FILE
Section: .data
Binding: STB_GLOBAL
- Name: funcsym
Type: STT_FUNC
Section: .data
Binding: STB_GLOBAL
## Test dumping ELF files with no .dynsym section.
# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: llvm-objdump --dynamic-syms %t2 | \
# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=NODYNSYM
# RUN: llvm-objdump -T %t2 | \
# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=NODYNSYM
# NODYNSYM:DYNAMIC SYMBOL TABLE:
# NODYNSYM-EMPTY:
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
## Test dumping ELF files with logically empty .dynsym section (only has a 0-index NULL symbol).
# RUN: yaml2obj --docnum=3 %s -o %t3
# RUN: llvm-objdump --dynamic-syms %t3 | \
# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=ONLY-NULL
# RUN: llvm-objdump -T %t3 | \
# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=ONLY-NULL
# ONLY-NULL:DYNAMIC SYMBOL TABLE:
# ONLY-NULL-EMPTY:
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
DynamicSymbols: []
## Test dumping ELF files with truly empty .dynsym section (size of .dynsym section is 0).
# RUN: yaml2obj --docnum=4 %s -o %t4
# RUN: llvm-objdump --dynamic-syms %t4 | \
# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=EMPTY
# RUN: llvm-objdump -T %t4 | \
# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=EMPTY
# EMPTY:DYNAMIC SYMBOL TABLE:
# EMPTY-EMPTY:
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynsym
Type: SHT_DYNSYM
Size: 0