Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RISCV] Support linker relax function call from auipc and jalr to jal
To do this: 1. Add fixup_riscv_relax fixup types which eventually will transfer to R_RISCV_RELAX relocation types. 2. Insert R_RISCV_RELAX relocation types to auipc function call expression when linker relaxation enabled. Differential Revision: https://reviews.llvm.org/D44886 llvm-svn: 333158
- Loading branch information
Showing
5 changed files
with
43 additions
and
2 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
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,26 @@ | ||
# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+relax < %s \ | ||
# RUN: | llvm-readobj -r | FileCheck -check-prefix=RELAX-RELOC %s | ||
# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=-relax < %s \ | ||
# RUN: | llvm-readobj -r | FileCheck -check-prefix=NORELAX-RELOC %s | ||
# RUN: llvm-mc -triple riscv32 -mattr=+relax < %s -show-encoding \ | ||
# RUN: | FileCheck -check-prefix=RELAX-FIXUP %s | ||
# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+relax < %s \ | ||
# RUN: | llvm-readobj -r | FileCheck -check-prefix=RELAX-RELOC %s | ||
# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=-relax < %s \ | ||
# RUN: | llvm-readobj -r | FileCheck -check-prefix=NORELAX-RELOC %s | ||
# RUN: llvm-mc -triple riscv64 -mattr=+relax < %s -show-encoding \ | ||
# RUN: | FileCheck -check-prefix=RELAX-FIXUP %s | ||
|
||
.long foo | ||
|
||
.L1: | ||
call foo | ||
# NORELAX-RELOC: R_RISCV_CALL foo 0x0 | ||
# NORELAX-RELOC-NOT: R_RISCV_RELAX | ||
# RELAX-RELOC: R_RISCV_CALL foo 0x0 | ||
# RELAX-RELOC: R_RISCV_RELAX foo 0x0 | ||
# RELAX-FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_relax | ||
# RELAX-FIXUP: fixup B - offset: 0, value: foo, kind: | ||
beq s1, s1, .L1 | ||
# RELAX-RELOC: R_RISCV_BRANCH .L1 0x0 | ||
# RELAX-FIXUP: fixup A - offset: 0, value: .L1, kind: fixup_riscv_branch |