1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/tools/yaml2obj/ELF/dynsymtab-shlink.yaml
Fangrui Song 053d07b664 [yaml2obj][test] Move tests to binary format specific subdirectories
Create COFF/, ELF/, and Minidump and move tests there.

Also

* Rename `*.test` to `*.yaml`
* For yaml2obj RUN lines, use `-o %t` instead of `> %t` for consistency.
  We still have tests that check stdout is the default output, e.g.
  multi-doc.test
* Update tests to consistently use `##` for comments.
  `#` is for RUN and CHECK lines.
* Merge symboless-relocation.yaml and invalid-symboless-relocation.yaml to ELF/relocation-implicit-symbol-index.test

Reviewed By: grimar, jhenderson

Differential Revision: https://reviews.llvm.org/D70264
2019-11-18 09:06:14 -08:00

98 lines
2.0 KiB
YAML

## For implicit dynamic symbol table sections, `Link` field can also
## be specified in YAML. Here we test the behavior in different cases.
## Check we are able to set Link = 0 for .dynsym explicitly.
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-readobj %t1 -S | FileCheck %s --check-prefix=CASE1
# CASE1: Name: .dynsym
# CASE1: Link:
# CASE1-SAME: 0
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynsym
Type: SHT_DYNSYM
Link: 0
## Check that by default .dynsym will be linked to .dynstr
## if the latter exists.
# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: llvm-readobj %t2 -S | FileCheck %s --check-prefix=CASE2
# CASE2: .dynsym
# CASE2: Link:
# CASE2-SAME: 2
# CASE2: Index: 2
# CASE2-NEXT: Name: .dynstr
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynsym
Type: SHT_DYNSYM
- Name: .dynstr
Type: SHT_STRTAB
## Even if .dynstr exists, we can explicitly link .dynsym
## to another section.
# RUN: yaml2obj --docnum=3 %s -o %t3
# RUN: llvm-readobj %t3 -S | FileCheck %s --check-prefix=CASE3
# CASE3: .dynsym
# CASE3: Link:
# CASE3-SAME: 3
# CASE3: Index: 3
# CASE3-NEXT: Name: .foo
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynsym
Type: SHT_DYNSYM
Link: 3
- Name: .dynstr
Type: SHT_STRTAB
- Name: .foo
Type: SHT_PROGBITS
## Check we can use a section name as a Link value for .dynsym.
# RUN: yaml2obj --docnum=4 %s -o %t4
# RUN: llvm-readobj %t4 -S | FileCheck %s --check-prefix=CASE4
# CASE4: .dynsym
# CASE4: Link:
# CASE4-SAME: 2
# CASE4: Index: 2
# CASE4-NEXT: Name: .foo
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .dynsym
Type: SHT_DYNSYM
Link: .foo
- Name: .foo
Type: SHT_PROGBITS