brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · f06c733 Raw
54 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/insert-after.s -o %t1.o3 4## Main linker script contains .text and .data sections. Here5## we check that can use INSERT BEFORE to insert sections .foo.data6## and .foo.text at the right places.7 8# RUN: ld.lld %t1.o -o %t1 --script %p/Inputs/insert-after.script --script %s9# RUN: llvm-readelf -S -l %t1 | FileCheck %s10# CHECK:      Name      Type     Address          Off    Size   ES Flg11# CHECK-NEXT:           NULL12# CHECK-NEXT: .foo.text PROGBITS 0000000000000000 001000 000008 00  AX 013# CHECK-NEXT: .text     PROGBITS 0000000000000008 001008 000008 00  AX 014# CHECK-NEXT: .byte     PROGBITS 0000000000000010 001010 000001 00  A  015# CHECK-NEXT: .foo.data PROGBITS 0000000000000011 001011 000008 00  WA 016# CHECK-NEXT: .data     PROGBITS 0000000000000019 001019 000008 00  WA 017# CHECK:      Type18# CHECK-NEXT: LOAD {{.*}} R E19# CHECK-NEXT: LOAD {{.*}} R20# CHECK-NEXT: LOAD {{.*}} RW21# CHECK-NEXT: GNU_STACK {{.*}} RW22 23## There is no main linker script. INSERT BEFORE just reorders output sections,24## without making more layout changes. Address/offset assignments are different25## with a main linker script.26 27## Test non-contiguous OutputDescs in script->sectionCommands.28# RUN: ld.lld --defsym y0=1 %s --defsym y1=1 %t1.o -o %t229# RUN: llvm-readelf -S -l -sX %t2 | FileCheck --check-prefix=CHECK2 %s30# CHECK2:      Name      Type     Address            Off      Size   ES Flg31# CHECK2-NEXT:           NULL32# CHECK2-NEXT: .foo.text PROGBITS 000000000020{{.*}} [[#%x,]] 000008 00  AX33# CHECK2-NEXT: .text     PROGBITS [[#%x,]]           [[#%x,]] 000008 00  AX34# CHECK2-NEXT: .byte     PROGBITS [[#%x,]]           [[#%x,]] 000001 00  WA35# CHECK2-NEXT: .foo.data PROGBITS [[#%x,]]           [[#%x,]] 000008 00  WA36# CHECK2-NEXT: .data     PROGBITS [[#%x,]]           [[#%x,]] 000008 00  WA37# CHECK2:      Type      {{.*}} Flg Align38# CHECK2-NEXT: PHDR      {{.*}} R   0x839# CHECK2-NEXT: LOAD      {{.*}} R   0x100040# CHECK2-NEXT: LOAD      {{.*}} R E 0x100041# CHECK2-NEXT: LOAD      {{.*}} RW  0x100042# CHECK2-NEXT: GNU_STACK {{.*}} RW  043 44# CHECK2:      NOTYPE  GLOBAL DEFAULT  ABS               y045# CHECK2:      NOTYPE  GLOBAL DEFAULT  [[#]] (.foo.text) x046# CHECK2:      NOTYPE  GLOBAL DEFAULT  ABS               y147 48SECTIONS { .byte : { BYTE(0) } } INSERT BEFORE .data;49 50SECTIONS { .foo.data : { *(.foo.data) } } INSERT BEFORE .data;51 52## The input section .foo.text is an orphan. It will be placed in .foo.text53SECTIONS { .foo.text : { x0 = .; } } INSERT BEFORE ".text";54