1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3
4# RUN: echo "SECTIONS { \
5# RUN:   . = SIZEOF_HEADERS; \
6# RUN:   .foo : { begin = .; *(.foo.*) end = .;} \
7# RUN: }" > %t.script
8# RUN: ld.lld -o %t1 --script %t.script %t -shared
9# RUN: llvm-readobj -S --symbols %t1 | FileCheck %s
10
11# CHECK:        Name: .foo
12# CHECK-NEXT:   Type: SHT_PROGBITS
13# CHECK-NEXT:   Flags [
14# CHECK-NEXT:     SHF_ALLOC
15# CHECK-NEXT:     SHF_MERGE
16# CHECK-NEXT:     SHF_STRINGS
17# CHECK-NEXT:   ]
18# CHECK-NEXT:   Address: 0x[[ADDR1:.*]]
19# CHECK-NEXT:   Offset: 0x[[ADDR1]]
20# CHECK-NEXT:   Size: 8
21# CHECK-NEXT:   Link: 0
22# CHECK-NEXT:   Info: 0
23# CHECK-NEXT:   AddressAlignment: 2
24# CHECK-NEXT:   EntrySize: 0
25# CHECK-NEXT: }
26
27# CHECK:      Name: begin
28# CHECK-NEXT: Value: 0x[[ADDR1]]
29
30# CHECK:      Name: end
31# CHECK-NEXT: Value: 0x268
32
33# Check that we don't crash with --gc-sections
34# RUN: ld.lld --gc-sections -o %t2 --script %t.script %t -shared
35# RUN: llvm-readobj -S --symbols %t2 | FileCheck %s --check-prefix=GC
36
37# GC:        Name: .foo
38# GC-NEXT:   Type: SHT_PROGBITS
39# GC-NEXT:   Flags [
40# GC-NEXT:     SHF_ALLOC
41# GC-NEXT:   ]
42
43.section        .foo.1a,"aMS",@progbits,1
44.asciz "foo"
45
46.section        .foo.1b,"aMS",@progbits,1
47.asciz "foo"
48
49.section        .foo.2a,"aM",@progbits,1
50.byte 42
51
52.section        .foo.2b,"aM",@progbits,1
53.byte 42
54
55.section        .foo.3a,"aM",@progbits,2
56.align 2
57.short 42
58
59.section        .foo.3b,"aM",@progbits,2
60.align 2
61.short 42
62