brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · de0f1d0 Raw
117 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t && split-file %s %t && cd %t3 4# RUN: llvm-mc --triple=x86_64 -filetype=obj a.s -o a.o5# RUN: llvm-mc --triple=x86_64 -filetype=obj -crel a.s -o ac.o6# RUN: llvm-mc --triple=x86_64 -filetype=obj data.s -o data.o7# RUN: ld.lld a.o data.o -T 0.t 2>&1 | FileCheck %s --check-prefix=CHECK0 --implicit-check-not=warning:8 9# CHECK0:      warning: 0.t:3: ignored with fewer than 2 output sections10# CHECK0-NEXT: warning: 0.t:4: ignored with fewer than 2 output sections11 12# RUN: not ld.lld a.o data.o -T 1.t 2>&1 | FileCheck %s --check-prefix=CHECK1 --implicit-check-not=error:13# RUN: not ld.lld ac.o data.o -T 1.t 2>&1 | FileCheck %s --check-prefix=CHECK1 --implicit-check-not=error:14# CHECK1:      error: a{{.?}}.o:(.text.start+0x11): prohibited cross reference from '.text' to 'data' in '.data'15 16## .text and .text1 are in two NOCROSSREFS commands. Violations are reported twice.17# RUN: not ld.lld --threads=1 a.o data.o -T 2.t 2>&1 | FileCheck %s --check-prefix=CHECK2 --implicit-check-not=error:18# CHECK2:      error: a.o:(.text.start+0x6): prohibited cross reference from '.text' to '.text1' in '.text1'19# CHECK2-NEXT: error: a.o:(.text.start+0x6): prohibited cross reference from '.text' to '.text1' in '.text1'20# CHECK2-NEXT: error: a.o:(.text.start+0xb): prohibited cross reference from '.text' to 'foo2' in '.text2'21# CHECK2-NEXT: error: a.o:(.text.start+0x11): prohibited cross reference from '.text' to 'data' in '.data'22# CHECK2-NEXT: error: a.o:(.text.start+0x17): prohibited cross reference from '.text' to 'str1' in '.rodata'23## .data occurs twice in the command, but the violation is only reported once.24# CHECK2-NEXT: error: a.o:(.text1+0x1): prohibited cross reference from '.text1' to '_edata' in '.data'25# CHECK2-NEXT: error: a.o:(.nonalloc+0x0): prohibited cross reference from '.nonalloc' to '.text' in '.text'26# CHECK2-NEXT: error: a.o:(.nonalloc+0x10): prohibited cross reference from '.nonalloc' to 'data' in '.data'27 28# RUN: not ld.lld a.o data.o -T 3.t 2>&1 | FileCheck %s --check-prefix=CHECK3 --implicit-check-not=error:29# CHECK3:      error: a.o:(.nonalloc+0x0): prohibited cross reference from '.nonalloc' to '.text' in '.text'30 31# RUN: not ld.lld a.o data.o -T overlay.t 2>&1 | FileCheck %s --check-prefix=OVERLAY --implicit-check-not=error:32# OVERLAY: error: a.o:(.text.start+0x11): prohibited cross reference from '.text' to 'data' in '.data'33# OVERLAY-NEXT: error: a.o:(.text.start+0x17): prohibited cross reference from '.text' to 'str1' in '.rodata'34 35#--- 0.t36## Some cases that do not cause errors.37abs = 42;38NOCROSSREFS()39NOCROSSREFS (.text)40NOCROSSREFS( .text .text3 );  ## ; is ignored41NOCROSSREFS_TO(.text .text2 .text3 .data );42NOCROSSREFS_TO (.data .text2 .text3)43 44#--- 1.t45abs = 42;46NOCROSSREFS(.text ".data")47 48#--- 2.t49abs = 42;50NOCROSSREFS(.text ".text1" .text ".text1" )51NOCROSSREFS(.text .text1 .text2 .data .rodata .data .nonalloc)52 53#--- 3.t54abs = 42;55NOCROSSREFS_TO(.text .text .text1 .text2 .data .nonalloc)56 57#--- overlay.t58abs = 42;59_edata = 43;60SECTIONS {61  OVERLAY : NOCROSSREFS {62    .text { *(.text*) }63    .data { *(.data*) }64    .rodata { *(.rodata*) }65  }66}67 68#--- err1.t69NOCROSSREFS )70 71# RUN: not ld.lld a.o data.o -T err1.t 2>&1 | FileCheck %s --check-prefix=ERR1 --implicit-check-not=error:72# ERR1: error: err1.t:1: ( expected, but got )73 74#--- err2.t75NOCROSSREFS(.text76 77# RUN: not ld.lld a.o data.o -T err2.t 2>&1 | FileCheck %s --check-prefix=ERR2 --implicit-check-not=error:78# ERR2: error: err2.t:1: unexpected EOF79 80#--- a.s81.global _start, foo1, foo2, foo382.section .text.start,"ax"83_start:84  call _start85  call .text186  call foo287  movl data(%rip), %eax88  movl str1(%rip), %eax89 90.section .text1,"ax"91foo1:92  call _edata93 94.section .text2,"ax"95foo2:96  call foo397 98.section .text3,"ax"99foo3:100  call foo2101 102.section .rodata.str1.1,"aMS",@progbits,1103str1:104  .asciz "abc"105 106.section .nonalloc,""107  .quad .text108  .quad .text3109  .quad data110 111#--- data.s112.section .data,"aw"113.globl data114data:115  .byte 0116  .quad abs117