File: dynsym-section.yaml

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (80 lines) | stat: -rw-r--r-- 2,674 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
## Check how we produce SHT_DYNSYM sections.

## Check we do not crash/assert when .dynsym is specified
## explicitly, but .dynstr is not present.
## Check we set the sh_link field to 0 for the .dynsym section in this case.

# RUN: yaml2obj %s -o %t1
# RUN: llvm-readelf --section-headers %t1 | FileCheck %s

# CHECK:      Section Headers:
# CHECK-NEXT:  [Nr] Name    Type   Address          Off    Size   ES Flg Lk
# CHECK-NEXT:  [ 0]         NULL   0000000000000000 000000 000000 00 0   0
# CHECK-NEXT:  [ 1] .dynsym DYNSYM 0000000000000000 000040 000018 18 A   0

--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_DYN
Sections:
  - Name:   .dynsym
    Type:   SHT_DYNSYM
    Offset: [[OFFSET=<none>]]

## Check we can use the "Offset" key to to set an arbitrary offset for the SHT_DYNSYM section.

# RUN: yaml2obj %s -DOFFSET=0x100 -o %t2
# RUN: llvm-readelf --section-headers %t2 | FileCheck %s --check-prefix=OFFSET

# OFFSET:      Section Headers:
# OFFSET-NEXT:   [Nr] Name    Type   Address          Off    Size   ES Flg Lk Inf Al
# OFFSET-NEXT:   [ 0]         NULL   0000000000000000 000000 000000 00     0   0  0
# OFFSET-NEXT:   [ 1] .dynsym DYNSYM 0000000000000000 000100 000018 18   A 0   1  0

## Check we are able to set Link = 0 for the .dynsym section explicitly.

# RUN: yaml2obj %s --docnum=2 -DLINK=0 -o %t2
# RUN: llvm-readelf --section-headers %t2 | FileCheck %s --check-prefix=LINK-NULL

# LINK-NULL: [Nr] Name    {{.*}} Flg Lk Inf
# LINK-NULL: [ 1] .dynsym {{.*}}   A 0   1

--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_DYN
Sections:
  - Name: .dynsym
    Type: SHT_DYNSYM
    Link: [[LINK=<none>]]
  - Name: .dynstr
    Type: SHT_STRTAB
  - Name: .foo
    Type: SHT_PROGBITS

## Check that by default the .dynsym section will be linked to the .dynstr section,
## when the latter one exists.

# RUN: yaml2obj %s --docnum=2 -o %t3
# RUN: llvm-readelf --section-headers %t3 | FileCheck %s --check-prefix=LINK-DEFAULT

# LINK-DEFAULT: [Nr] Name    {{.*}} Flg Lk Inf
# LINK-DEFAULT: [ 1] .dynsym {{.*}}   A 2   1
# LINK-DEFAULT: [ 2] .dynstr {{.*}}   A 0   0

## Even when the .dynstr section exists, we can explicitly link the .dynsym section
## to another section.

# RUN: yaml2obj %s --docnum=2 -DLINK=3 -o %t4
# RUN: llvm-readelf --section-headers %t4 | FileCheck %s --check-prefix=LINK-FOO

# LINK-FOO: [Nr] Name     {{.*}} Flg Lk Inf
# LINK-FOO: [ 1] .dynsym  {{.*}}   A 3   1
# LINK-FOO: [ 3] .foo

## Check we can use a section name as a Link value for .dynsym.

# RUN: yaml2obj %s --docnum=2 -DLINK=.foo -o %t5
# RUN: llvm-readelf --section-headers %t5 | FileCheck %s --check-prefix=LINK-FOO