1// REQUIRES: x86 2// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o 3// RUN: ld.lld -e A %t.o --no-call-graph-profile-sort -o %t 4// RUN: llvm-nm --numeric-sort %t | FileCheck %s --check-prefix=NO_ORDERING 5// NO_ORDERING: 0000000000201120 t D 6// NO_ORDERING-NEXT: 0000000000201121 T C 7// NO_ORDERING-NEXT: 0000000000201122 T B 8// NO_ORDERING-NEXT: 0000000000201123 T A 9 10// RUN: ld.lld -e A %t.o -o %t 11// RUN: llvm-nm --numeric-sort %t | FileCheck %s --check-prefix=CALL_GRAPH 12// CALL_GRAPH: 0000000000201120 T A 13// CALL_GRAPH-NEXT: 0000000000201120 t Aa 14// CALL_GRAPH-NEXT: 0000000000201121 T B 15// CALL_GRAPH-NEXT: 0000000000201122 T C 16// CALL_GRAPH-NEXT: 0000000000201123 t D 17 18// RUN: rm -f %t.symbol_order 19// RUN: echo "C" >> %t.symbol_order 20// RUN: echo "B" >> %t.symbol_order 21// RUN: echo "D" >> %t.symbol_order 22// RUN: echo "A" >> %t.symbol_order 23 24// RUN: ld.lld -e A %t.o --symbol-ordering-file %t.symbol_order -o %t 25// RUN: llvm-nm --numeric-sort %t | FileCheck %s --check-prefix=SYMBOL_ORDER 26// SYMBOL_ORDER: 0000000000201120 T C 27// SYMBOL_ORDER-NEXT: 0000000000201121 T B 28// SYMBOL_ORDER-NEXT: 0000000000201122 t D 29// SYMBOL_ORDER-NEXT: 0000000000201123 T A 30 31// RUN: rm -f %t.call_graph 32// RUN: echo "A B 5" > %t.call_graph 33// RUN: echo "B C 50" >> %t.call_graph 34// RUN: echo "C D 40" >> %t.call_graph 35// RUN: echo "D B 10" >> %t.call_graph 36 37// RUN: not ld.lld -e A %t.o --symbol-ordering-file %t.symbol_order --call-graph-ordering-file %t.call_graph -o /dev/null 2>&1 | FileCheck %s 38// RUN: not ld.lld -e A %t.o --call-graph-ordering-file %t.call_graph --symbol-ordering-file %t.symbol_order -o /dev/null 2>&1 | FileCheck %s 39// CHECK: error: --symbol-ordering-file and --call-graph-order-file may not be used together 40 41 .section .text.D,"ax",@progbits 42D: 43 retq 44 45 .section .text.C,"ax",@progbits 46 .globl C 47C: 48 retq 49 50 .section .text.B,"ax",@progbits 51 .globl B 52B: 53 retq 54 55 .section .text.A,"ax",@progbits 56 .globl A 57A: 58Aa: 59 retq 60 61 .cg_profile A, B, 10 62 .cg_profile A, B, 10 63 .cg_profile Aa, B, 80 64 .cg_profile A, C, 40 65 .cg_profile B, C, 30 66 .cg_profile C, D, 90 67