brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · d4bbfc0 Raw
84 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o3 4## Contiguous SHF_LINK_ORDER sections.5# RUN: echo 'SECTIONS { .rodata : {BYTE(0) *(.rodata*) BYTE(4)} \6# RUN:   .text : {*(.text.bar) *(.text.foo)} }' > %t.lds7# RUN: ld.lld -T %t.lds %t.o -o %t8# RUN: llvm-readelf -S -x .rodata -x .text %t | FileCheck %s9 10# CHECK:      [ 1] .rodata   {{.*}} AL 311# CHECK:      [ 3] .text     {{.*}} AX 012# CHECK:      Hex dump of section '.rodata':13# CHECK-NEXT: 00030102 0414# CHECK:      Hex dump of section '.text':15# CHECK-NEXT: 020116 17# RUN: echo 'SECTIONS { .rodata : {BYTE(0) *(.rodata*) BYTE(4)} \18# RUN:  .text : {*(.text.foo) *(.text.bar)} }' > %t1.lds19# RUN: ld.lld -T %t1.lds %t.o -o %t120# RUN: llvm-readelf -S -x .rodata -x .text %t1 | FileCheck --check-prefix=CHECK1 %s21 22# CHECK1:      [ 1] .rodata   {{.*}} AL 323# CHECK1:      [ 3] .text     {{.*}} AX 024# CHECK1:      Hex dump of section '.rodata':25# CHECK1-NEXT: 00010302 0426# CHECK1:      Hex dump of section '.text':27# CHECK1-NEXT: 010228 29## Adjacent input sections descriptions are contiguous.30## Orphan section .text.bar precedes .text.foo. However, don't swap the order of .rodata.*31## because they are in different InputSectionDescriptions.32# RUN: echo 'SECTIONS { .rodata : {*(.rodata.foo) *(.rodata.bar)} }' > %t2.lds33# RUN: ld.lld -T %t2.lds %t.o -o %t234# RUN: llvm-readelf -S -x .rodata %t2 | FileCheck --check-prefix=CHECK2 %s35 36# CHECK2:      [ 1] .rodata   {{.*}} AL 537# CHECK2:      [ 4] .text.bar {{.*}} AX 038# CHECK2-NEXT: [ 5] .text.foo {{.*}} AX 039# CHECK2:      Hex dump of section '.rodata':40# CHECK2-NEXT: 01030241 42## Non-contiguous SHF_LINK_ORDER sections, separated by a BYTE.43# RUN: echo 'SECTIONS { .rodata : {*(.rodata.foo) BYTE(0) *(.rodata.bar)} }' > %t3.lds44# RUN: ld.lld -T %t3.lds %t.o -o %t345# RUN: llvm-readelf -S -x .rodata %t3 | FileCheck --check-prefix=CHECK3 %s46 47# CHECK3:      [ 1] .rodata   {{.*}} AL 548# CHECK3:      [ 4] .text.bar {{.*}} AX 049# CHECK3:      [ 5] .text.foo {{.*}} AX 050# CHECK3:      Hex dump of section '.rodata':51# CHECK3-NEXT: 0100030252 53## Non-contiguous SHF_LINK_ORDER sections, separated by a non-SHF_LINK_ORDER section.54# RUN: echo 'SECTIONS { .rodata : {*(.rodata.foo) *(.text) *(.rodata.bar)} }' > %t4.lds55# RUN: ld.lld -T %t4.lds %t.o -o %t456# RUN: llvm-readelf -x .rodata %t4 | FileCheck --check-prefix=CHECK4 %s57 58# CHECK4:      Hex dump of section '.rodata':59# CHECK4-NEXT: 01cccccc 030260 61## Non-contiguous SHF_LINK_ORDER sections, separated by a symbol assignment.62# RUN: echo 'SECTIONS { .rodata : {*(.rodata.foo) a = .; *(.rodata.bar)} }' > %t5.lds63# RUN: ld.lld -T %t5.lds %t.o -o %t564# RUN: llvm-readelf -S -x .rodata %t5 | FileCheck --check-prefix=CHECK2 %s65 66.global _start67_start:68 69.section .ro,"a"70.byte 071 72.section .text.bar,"a",@progbits73.byte 274.section .text.foo,"a",@progbits75.byte 176.section .rodata.foo,"ao",@progbits,.text.foo77.byte 178## If the two .rodata.bar sections are in the same InputSectionDescription,79## 03 (sh_link!=0) will be ordered before 02 (sh_link=0).80.section .rodata.bar,"a",@progbits81.byte 282.section .rodata.bar,"ao",@progbits,.text.bar83.byte 384