Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lld-macho] Allow order files and call graph sorting to be used together
If both an order file and a call graph profile are present, the edges of the call graph which use symbols present in the order file are not used. All of the symbols in the order file will appear at the beginning of the section just as they do currently. In other words, the highest priority derived from the call graph will be below the lowest priority derived from the order file. Practically, this change renames CallGraphSort.{h,cpp} to SectionPriorities.{h,cpp}, and most order file and call graph profile related code is moved into the new file to reduce duplication. Differential Revision: https://reviews.llvm.org/D117354
- Loading branch information
1 parent
f56cb52
commit a52b910
Showing
4 changed files
with
84 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# REQUIRES: x86 | ||
|
||
# RUN: rm -rf %t; split-file %s %t | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o | ||
|
||
# RUN: %lld -e A %t/test.o -order_file %t/order_file -o %t/test | ||
# RUN: llvm-nm --numeric-sort %t/test | FileCheck %s | ||
# RUN: %lld -e A %t/test.o -o %t/test | ||
# RUN: llvm-nm --numeric-sort %t/test | FileCheck %s --check-prefix NO-ORDER | ||
|
||
|
||
#--- order_file | ||
B | ||
A | ||
|
||
#--- test.s | ||
|
||
.text | ||
.globl D | ||
D: | ||
retq | ||
|
||
.globl C | ||
C: | ||
retq | ||
|
||
.globl B | ||
B: | ||
retq | ||
|
||
.globl A | ||
A: | ||
retq | ||
|
||
.cg_profile A, B, 100 | ||
.cg_profile A, C, 40 | ||
.cg_profile C, D, 61 | ||
|
||
.subsections_via_symbols | ||
|
||
# CHECK: T B | ||
# CHECK-NEXT: T A | ||
# CHECK-NEXT: T C | ||
# CHECK-NEXT: T D | ||
|
||
# NO-ORDER: T A | ||
# NO-ORDER-NEXT: T B | ||
# NO-ORDER-NEXT: T C | ||
# NO-ORDER-NEXT: T D | ||
|