109 lines · plain
1# REQUIRES: ppc2# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t1.o3# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-sort-small-cm-relocs-input2.s -o %t2.o4# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-sort-small-cm-relocs-input3.s -o %t3.o5# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-sort-small-cm-relocs-input4.s -o %t4.o6 7# RUN: ld.lld %t1.o %t2.o %t3.o %t4.o -o %t -Map=%t.map8# RUN: FileCheck %s < %t.map9 10# Test an alternate link order.11# RUN: ld.lld %t2.o %t3.o %t4.o %t1.o -o %t -Map=%t.map12# RUN: FileCheck %s -check-prefix=ALTERNATE < %t.map13 14# If a linker script has a sections command then allow that to override the15# default sorting behavior.16# RUN: echo "SECTIONS { \17# RUN: .toc : { \18# RUN: *ppc64-sort-small-cm-relocs.s.tmp4.o(.toc*) \19# RUN: *ppc64-sort-small-cm-relocs.s.tmp1.o(.toc*) \20# RUN: *(.toc*) \21# RUN: } \22# RUN: } " > %t.script23# RUN: ld.lld %t1.o %t2.o %t3.o %t4.o -o %t -script %t.script -Map=%t.map24# RUN: FileCheck %s -check-prefix=SEC-CMD < %t.map25 26# RUN: echo "SECTIONS { .text : {*(.text*)} } " > %t.script27# RUN: ld.lld %t1.o %t2.o %t3.o %t4.o -o %t -script %t.script -Map=%t.map28# RUN: FileCheck %s -check-prefix=SEC-CMD2 < %t.map29 30# Default sort if the linker script does not have a sections command.31# RUN: echo "" > %t.script32# RUN: ld.lld %t1.o %t2.o %t3.o %t4.o -o %t -script %t.script -Map=%t.map33# RUN: FileCheck %s -check-prefix=NOSEC < %t.map34 .text35 36 .global _start37 .type _start,@function38_start:39 li 3, 5540 blr41 42 .type a,@object43 .data44 .global a45a:46 .long 1047 .size a, 448 49 .type c,@object50 .data51 .global c52c:53 .long 5554 .size c, 455 56 .type d,@object57 .global d58d:59 .long 3360 .size d, 461 62 # .toc section contains only some constants.63 .section .toc,"aw",@progbits64 .quad 0xa1a1a1a1a1a1a1a165 .quad 0xb2b2b2b2b2b2b2b266 67# Input files tmp3.o and tmp4.o contain small code model relocs.68 69# CHECK: .got70# CHECK-NEXT: <internal>:(.got)71# CHECK-NEXT: .toc72# CHECK-NEXT: {{.*}}3.o:(.toc)73# CHECK-NEXT: {{.*}}4.o:(.toc)74# CHECK-NEXT: {{.*}}1.o:(.toc)75# CHECK-NEXT: {{.*}}2.o:(.toc)76 77# ALTERNATE: .got78# ALTERNATE-NEXT: <internal>:(.got)79# ALTERNATE-NEXT: .toc80# ALTERNATE-NEXT: {{.*}}3.o:(.toc)81# ALTERNATE-NEXT: {{.*}}4.o:(.toc)82# ALTERNATE-NEXT: {{.*}}2.o:(.toc)83# ALTERNATE-NEXT: {{.*}}1.o:(.toc)84 85# SEC-CMD: .got86# SEC-CMD-NEXT: <internal>:(.got)87# SEC-CMD-NEXT: .toc88# SEC-CMD-NEXT: {{.*}}4.o:(.toc)89# SEC-CMD-NEXT: {{.*}}1.o:(.toc)90# SEC-CMD-NEXT: {{.*}}2.o:(.toc)91# SEC-CMD-NEXT: {{.*}}3.o:(.toc)92 93# SEC-CMD2: .got94# SEC-CMD2-NEXT: <internal>:(.got)95# SEC-CMD2-NEXT: .toc96# SEC-CMD2-NEXT: {{.*}}1.o:(.toc)97# SEC-CMD2-NEXT: {{.*}}2.o:(.toc)98# SEC-CMD2-NEXT: {{.*}}3.o:(.toc)99# SEC-CMD2-NEXT: {{.*}}4.o:(.toc)100 101# NOSEC: .got102# NOSEC-NEXT: <internal>:(.got)103# NOSEC-NEXT: .toc104# NOSEC-NEXT: {{.*}}3.o:(.toc)105# NOSEC-NEXT: {{.*}}4.o:(.toc)106# NOSEC-NEXT: {{.*}}1.o:(.toc)107# NOSEC-NEXT: {{.*}}2.o:(.toc)108 109