• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
2## Test that we allow SHF_LINK_ORDER sections with sh_link=0.
3## SHF_LINK_ORDER sections with sh_link!=0 are ordered before others.
4# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
5# RUN: ld.lld %t.o -o %t
6# RUN: llvm-readelf -S -x .linkorder %t | FileCheck %s
7
8# CHECK:      [Nr] Name       {{.*}} Size   ES Flg Lk Inf
9# CHECK-NEXT: [ 0]            {{.*}}
10# CHECK-NEXT: [ 1] .linkorder {{.*}} 000004 00  AL  3   0
11# CHECK-NEXT: [ 2] .ignore    {{.*}}
12# CHECK-NEXT: [ 3] .text      {{.*}}
13
14# CHECK:      Hex dump of section '.linkorder':
15# CHECK-NEXT:   [[#%x,ADDR:]] 01020003
16
17# RUN: llvm-mc --filetype=obj -triple=x86_64 --defsym EXTRA=1 %s -o %t.o
18# RUN: ld.lld %t.o -o %t1
19# RUN: llvm-readelf -S -x .linkorder %t1 | FileCheck %s --check-prefix=CHECK1
20
21# CHECK1:      [Nr] Name       {{.*}} Size   ES Flg Lk Inf
22# CHECK1-NEXT: [ 0]            {{.*}}
23# CHECK1-NEXT: [ 1] .linkorder {{.*}} 000005 00  AL  2   0
24# CHECK1-NEXT: [ 2] .text      {{.*}}
25
26# CHECK1:      Hex dump of section '.linkorder':
27# CHECK1-NEXT:   [[#%x,ADDR:]] 01020004 03
28
29.section .text,"ax",@progbits,unique,0
30.Ltext0:
31.section .text,"ax",@progbits,unique,1
32.Ltext1:
33.section .linkorder,"ao",@progbits,0,unique,0
34  .byte 0
35.section .linkorder,"ao",@progbits,.Ltext0
36  .byte 1
37.section .linkorder,"ao",@progbits,.Ltext1
38  .byte 2
39
40.ifdef EXTRA
41.section .linkorder,"a",@progbits
42  .byte 4
43.else
44.section .ignore,"ao",@progbits,.Ltext1
45.endif
46
47.section .linkorder,"ao",@progbits,0,unique,3
48  .byte 3
49