1// REQUIRES: x86
2
3/// When copying local symbols, skip those defined in discarded sections.
4
5// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
6// RUN: ld.lld %t -o %t2 -shared --gc-sections
7// RUN: llvm-readobj --symbols -S --section-data %t2 | FileCheck %s
8
9.global foo
10foo:
11
12.section .bar,"a"
13zed:
14
15// CHECK:      Name: .strtab
16// CHECK-NEXT: Type: SHT_STRTAB
17// CHECK-NEXT: Flags [
18// CHECK-NEXT: ]
19// CHECK-NEXT: Address:
20// CHECK-NEXT: Offset:
21// CHECK-NEXT: Size:
22// CHECK-NEXT: Link:
23// CHECK-NEXT: Info:
24// CHECK-NEXT: AddressAlignment:
25// CHECK-NEXT: EntrySize:
26// CHECK-NEXT: SectionData (
27// CHECK-NEXT:   0000: 00666F6F 005F4459 4E414D49 4300      |.foo._DYNAMIC.|
28// CHECK-NEXT: )
29
30// CHECK:      Symbols [
31// CHECK-NEXT:   Symbol {
32// CHECK-NEXT:     Name:  (0)
33// CHECK-NEXT:     Value: 0x0
34// CHECK-NEXT:     Size: 0
35// CHECK-NEXT:     Binding: Local
36// CHECK-NEXT:     Type: None
37// CHECK-NEXT:     Other: 0
38// CHECK-NEXT:     Section: Undefined
39// CHECK-NEXT:   }
40// CHECK-NEXT:   Symbol {
41// CHECK-NEXT:     Name: _DYNAMIC
42// CHECK-NEXT:     Value:
43// CHECK-NEXT:     Size: 0
44// CHECK-NEXT:     Binding: Local
45// CHECK-NEXT:     Type: None
46// CHECK-NEXT:     Other [ (0x2)
47// CHECK-NEXT:       STV_HIDDEN
48// CHECK-NEXT:     ]
49// CHECK-NEXT:     Section: .dynamic
50// CHECK-NEXT:   }
51// CHECK-NEXT:   Symbol {
52// CHECK-NEXT:     Name: foo
53// CHECK-NEXT:     Value:
54// CHECK-NEXT:     Size:
55// CHECK-NEXT:     Binding: Global
56// CHECK-NEXT:     Type: None
57// CHECK-NEXT:     Other:
58// CHECK-NEXT:     Section: .text
59// CHECK-NEXT:   }
60// CHECK-NEXT: ]
61