forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nanoMIPS][LLD] emit relocs with transformations
Similar to RISC-V relaxations, nanoMIPS transformations change relocations and they need to be updated before writing them down to output. One difference is that nanoMIPS can add new relocations, not just change them like RISC-V, so during linker transformations size of reloc sections need to be updated if --emit-relocs option is on.
- Loading branch information
1 parent
9a45484
commit 215483b
Showing
3 changed files
with
58 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# REQUIRES: nanomips | ||
|
||
# RUN: llvm-mc -filetype=obj -triple nanomips-elf -mcpu=i7200 -mattr=+pcrel %s -o %t.o | ||
# RUN: ld.lld --emit-relocs --section-start .text=0x1000 --defsym far=0x04000000 --defsym bbeqzc_far=0x4000 %t.o -o %t | ||
# RUN: llvm-objdump -dr %t | FileCheck %s | ||
|
||
# CHECK: beqic | ||
# CHECK-NEXT: R_NANOMIPS_PC11_S1 label | ||
# CHECK: lapc | ||
# CHECK-NEXT: R_NANOMIPS_PC_I32 far | ||
# CHECK: bbnezc | ||
# CHECK-NEXT: R_NANOMIPS_PC11_S1 {{.*}}skip_bc | ||
# CHECK-NEXT: bc | ||
# CHECK-NEXT: R_NANOMIPS_PC25_S1 bbeqzc_far | ||
|
||
|
||
.linkrelax | ||
.section .text, "ax", @progbits | ||
.align 1 | ||
.globl _start | ||
.ent _start | ||
|
||
_start: | ||
beqic $a2, 2, label | ||
addiu $a1, $a2, 3 | ||
lapc $a1, far | ||
label: | ||
bbeqzc $a1, 2, bbeqzc_far | ||
addiu $a1, $a2, 3 | ||
|
||
.end _start | ||
.size _start, .-_start | ||
|