55 lines · plain
1# REQUIRES: x862## Regression test: add STT_SECTION even if synthetic sections are interleaved3## with regular input sections.4 5# RUN: rm -rf %t && split-file %s %t6# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o7# RUN: ld.lld --emit-relocs --no-relax -T %t/1.t %t/a.o -o %t/a18# RUN: llvm-objdump --no-print-imm-hex -dr %t/a1 | FileCheck %s --check-prefixes=CHECK,CHECK19# RUN: ld.lld --emit-relocs --no-relax -T %t/2.t %t/a.o -o %t/a210# RUN: llvm-objdump --no-print-imm-hex -dr %t/a2 | FileCheck %s --check-prefixes=CHECK,CHECK211 12# CHECK: <_start>:13## %t/a1: bss is at offset 17. bss-4 = .bss + 0xd14## %t/a2: bss is at offset 16. bss-4 = .bss + 0xc15# CHECK-NEXT: movl [[#]](%rip), %eax16# CHECK1-NEXT: R_X86_64_PC32 .bss+0xd17# CHECK2-NEXT: R_X86_64_PC32 .bss+0xc18# CHECK-NEXT: movl [[#]](%rip), %eax19# CHECK-NEXT: R_X86_64_PC32 common-0x420# CHECK-NEXT: movl [[#]](%rip), %eax21## %t/a1: input .data is at offset 8. 8-4 = 0x422## %t/a2: input .data is at offset 0. 0-4 = -0x423# CHECK1-NEXT: R_X86_64_GOTPCRELX .data+0x424# CHECK2-NEXT: R_X86_64_GOTPCRELX .data-0x425 26#--- a.s27.globl _start28_start:29 movl bss(%rip), %eax30 movl common(%rip), %eax31## Compilers don't produce this. We just check the behavior.32 movl .data@gotpcrel(%rip), %eax33 34.section .data,"aw",@progbits35.quad 036 37.section .bss,"aw",@nobits38.space 1639bss:40.byte 041 42.comm common,1,143 44#--- 1.t45SECTIONS {46 .data : { *(.got) *(.data) }47 .bss : { *(COMMON) *(.bss) }48}49 50#--- 2.t51SECTIONS {52 .data : { *(.data) *(.got) }53 .bss : { *(.bss) *(COMMON) }54}55