2 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t1.o
3 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-sort-small-cm-relocs-input2.s -o %t2.o
4 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-sort-small-cm-relocs-input3.s -o %t3.o
5 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-sort-small-cm-relocs-input4.s -o %t4.o
7 # RUN: ld.lld %t1.o %t2.o %t3.o %t4.o -o %t -Map=%t.map
8 # RUN: FileCheck %s < %t.map
10 # Test an alternate link order.
11 # RUN: ld.lld %t2.o %t3.o %t4.o %t1.o -o %t -Map=%t.map
12 # RUN: FileCheck %s -check-prefix=ALTERNATE < %t.map
14 # If a linker script has a sections command then allow that to override the
15 # default sorting behavior.
16 # RUN: echo "SECTIONS { \
18 # RUN: *ppc64-sort-small-cm-relocs.s.tmp4.o(.toc*) \
19 # RUN: *ppc64-sort-small-cm-relocs.s.tmp1.o(.toc*) \
22 # RUN: } " > %t.script
23 # RUN: ld.lld %t1.o %t2.o %t3.o %t4.o -o %t -script %t.script -Map=%t.map
24 # RUN: FileCheck %s -check-prefix=SEC-CMD < %t.map
26 # RUN: echo "SECTIONS { .text : {*(.text*)} } " > %t.script
27 # RUN: ld.lld %t1.o %t2.o %t3.o %t4.o -o %t -script %t.script -Map=%t.map
28 # RUN: FileCheck %s -check-prefix=SEC-CMD2 < %t.map
30 # Default sort if the linker script does not have a sections command.
31 # RUN: echo "" > %t.script
32 # RUN: ld.lld %t1.o %t2.o %t3.o %t4.o -o %t -script %t.script -Map=%t.map
33 # RUN: FileCheck %s -check-prefix=NOSEC < %t.map
37 .type _start,@function
62 # .toc section contains only some constants.
63 .section .toc,"aw",@progbits
64 .quad 0xa1a1a1a1a1a1a1a1
65 .quad 0xb2b2b2b2b2b2b2b2
67 # Input files tmp3.o and tmp4.o contain small code model relocs.
70 # CHECK-NEXT: <internal>:(.got)
72 # CHECK-NEXT: {{.*}}3.o:(.toc)
73 # CHECK-NEXT: {{.*}}4.o:(.toc)
74 # CHECK-NEXT: {{.*}}1.o:(.toc)
75 # CHECK-NEXT: {{.*}}2.o:(.toc)
78 # ALTERNATE-NEXT: <internal>:(.got)
79 # ALTERNATE-NEXT: .toc
80 # ALTERNATE-NEXT: {{.*}}3.o:(.toc)
81 # ALTERNATE-NEXT: {{.*}}4.o:(.toc)
82 # ALTERNATE-NEXT: {{.*}}2.o:(.toc)
83 # ALTERNATE-NEXT: {{.*}}1.o:(.toc)
86 # SEC-CMD-NEXT: <internal>:(.got)
88 # 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)
94 # SEC-CMD2-NEXT: <internal>:(.got)
96 # 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)
102 # NOSEC-NEXT: <internal>:(.got)
104 # NOSEC-NEXT: {{.*}}3.o:(.toc)
105 # NOSEC-NEXT: {{.*}}4.o:(.toc)
106 # NOSEC-NEXT: {{.*}}1.o:(.toc)
107 # NOSEC-NEXT: {{.*}}2.o:(.toc)