xref: /llvm-project/lld/test/ELF/linkorder-group.test (revision 0ab5d8ba023f920e03dcd328f62c4df1855af374)
1# REQUIRES: x86
2## Test SHF_LINK_ORDER when the linked-to section has a larger index.
3# RUN: yaml2obj %s -o %t.o
4# RUN: ld.lld -r %t.o -o %t.ro
5# RUN: llvm-readelf -x asan_globals %t.ro | FileCheck %s
6
7# CHECK:      Hex dump of section 'asan_globals':
8# CHECK-NEXT: 0x00000000 00                                  .
9
10--- !ELF
11FileHeader:
12  Class:           ELFCLASS64
13  Data:            ELFDATA2LSB
14  Type:            ET_REL
15  Machine:         EM_X86_64
16  SectionHeaderStringTable: .strtab
17Sections:
18  - Name:            .text
19    Type:            SHT_PROGBITS
20    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
21  - Name:            .bss
22    Type:            SHT_NOBITS
23    Flags:           [ SHF_WRITE, SHF_ALLOC, SHF_GROUP ]
24    Size:            0x1
25  - Name:            asan_globals
26    Type:            SHT_PROGBITS
27    Flags:           [ SHF_ALLOC, SHF_LINK_ORDER, SHF_GROUP ]
28    Link:            .bss
29    Content:         '00'
30  - Name:            .group
31    Type:            SHT_GROUP
32    Link:            .symtab
33    Info:            foo
34    AddressAlign:    4
35    Members:
36      - SectionOrType:   GRP_COMDAT
37      - SectionOrType:   .bss
38      - SectionOrType:   asan_globals
39      - SectionOrType:   .relaasan_globals
40  - Name:            .relaasan_globals
41    Type:            SHT_RELA
42    Flags:           [ SHF_GROUP ]
43    Link:            .symtab
44    Info:            asan_globals
45    Relocations:
46      - Type:            R_X86_64_NONE
47  - Type:            SectionHeaderTable
48    Sections:
49      - Name:            .strtab
50      - Name:            .text
51      - Name:            .group
52      - Name:            asan_globals
53      - Name:            .relaasan_globals
54      - Name:            .bss
55      - Name:            .symtab
56Symbols:
57  - Name:            foo
58    Section:         .bss
59    Binding:         STB_WEAK
60