Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ELF: Place ordered sections in the middle of the unordered section li…
…st on targets with limited-range branches. It generally does not matter much where we place sections ordered by --symbol-ordering-file relative to other sections. But if the ordered sections are hot (which is the case already for some users of --symbol-ordering-file, and is increasingly more likely to be the case once profile-guided section layout lands) and the target has limited-range branches, it is beneficial to place the ordered sections in the middle of the output section in order to decrease the likelihood that a range extension thunk will be required to call a hot function from a cold function or vice versa. That is what this patch does. After D44966 it reduces the size of Chromium for Android's .text section by 60KB. Differential Revision: https://reviews.llvm.org/D44969 llvm-svn: 328905
- Loading branch information
Showing
2 changed files
with
101 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# REQUIRES: arm | ||
# RUN: llvm-mc -filetype=obj -triple=armv7-unknown-linux %s -o %t.o | ||
|
||
# RUN: echo ordered > %t_order.txt | ||
# RUN: ld.lld --symbol-ordering-file %t_order.txt %t.o -o %t2.out | ||
# RUN: llvm-nm -n %t2.out | FileCheck %s | ||
|
||
# CHECK: unordered1 | ||
# CHECK-NEXT: unordered2 | ||
# CHECK-NEXT: unordered3 | ||
# CHECK-NEXT: ordered | ||
# CHECK-NEXT: unordered4 | ||
|
||
.section .foo,"ax",%progbits,unique,1 | ||
unordered1: | ||
.zero 1 | ||
|
||
.section .foo,"ax",%progbits,unique,2 | ||
unordered2: | ||
.zero 1 | ||
|
||
.section .foo,"ax",%progbits,unique,3 | ||
unordered3: | ||
.zero 2 | ||
|
||
.section .foo,"ax",%progbits,unique,4 | ||
unordered4: | ||
.zero 4 | ||
|
||
.section .foo,"ax",%progbits,unique,5 | ||
ordered: | ||
.zero 1 |