brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · bb716a5 Raw
64 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t && split-file %s %t && cd %t3# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o4# RUN: ld.lld --default-script=def.t b.t -T a.t a.o -o out5# RUN: llvm-readelf -Ss out | FileCheck %s6 7# CHECK:      Name8# CHECK:      .foo29# CHECK-NEXT: .foo010# CHECK-NEXT: .foo111# CHECK:      1: 000000000000000c     0 NOTYPE  GLOBAL DEFAULT     4 _start12# CHECK-NEXT: 2: 000000000000002a     0 NOTYPE  GLOBAL DEFAULT   ABS b13# CHECK-NEXT: 3: 000000000000002a     0 NOTYPE  GLOBAL DEFAULT   ABS a14# CHECK-EMPTY:15 16## In the absence of --script options, the default linker script is read.17# RUN: ld.lld --default-script def.t b.t a.o -o out118# RUN: llvm-readelf -Ss out1 | FileCheck %s --check-prefix=CHECK119# RUN: ld.lld -dT def.t b.t a.o -o out1a && cmp out1 out1a20## If multiple -dT options are specified, the last -dT wins.21# RUN: ld.lld -dT a.t -dT def.t b.t a.o -o out1a && cmp out1 out1a22 23# RUN: mkdir d && cp def.t d/default.t24# RUN: ld.lld -L d -dT default.t b.t a.o -o out1a && cmp out1 out1a25 26# CHECK1:      Name27# CHECK1:      .foo228# CHECK1-NEXT: .foo129# CHECK1-NEXT: .foo030# CHECK1:      1: 000000000000000c     0 NOTYPE  GLOBAL DEFAULT     4 _start31# CHECK1-NEXT: 2: 000000000000002a     0 NOTYPE  GLOBAL DEFAULT   ABS b32# CHECK1-NEXT: 3: 000000000000002a     0 NOTYPE  GLOBAL DEFAULT   ABS def33# CHECK1-EMPTY:34 35# RUN: not ld.lld --default-script not-exist.t b.t -T a.t a.o 2>&1 | FileCheck %s --check-prefix=ERR36# ERR: error: cannot find linker script not-exist.t37 38#--- a.s39.globl _start40_start:41 42.section .foo0,"a"; .long 043.section .foo1,"a"; .long 044.section .foo2,"a"; .long 045 46#--- a.t47a = 42;48SECTIONS {49  .foo2 : {}50  .foo0 : {}51  .foo1 : {}52}53 54#--- b.t55b = 42;56 57#--- def.t58def = 42;59SECTIONS {60  .foo2 : {}61  .foo1 : {}62  .foo0 : {}63}64