-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lld][LoongArch] Convert TLS IE to LE in the normal or medium code model #123680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9d29d9b
Relax TLSDESC code sequence.
ylzsx 0f58056
Convert TLS IE to LE in the normal or medium code model.
ylzsx 441f1bc
Test loongarch-tls-ie.s pass.
ylzsx d17de78
Add test loongarch-relax-tls-ie.s
ylzsx 20b544c
modify RE_LOONGARCH_GOT.
ylzsx 5dafc66
Fix bug.
ylzsx 46f34a9
Fixes for review
ylzsx 6b567c2
code format
ylzsx 351a9c2
modify `tlsIeToLe` type to static
ylzsx a11db93
Merge branch 'main' into users/ylzsx/r-tls-ie-to-le-norelax
ylzsx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,70 @@ | ||
# REQUIRES: loongarch | ||
## Test LA64 IE -> LE in various cases. | ||
|
||
# RUN: llvm-mc --filetype=obj --triple=loongarch64 -mattr=+relax %s -o %t.o | ||
|
||
## FIXME: IE relaxation has not yet been implemented. | ||
## --relax/--no-relax has the same result. Also check --emit-relocs. | ||
# RUN: ld.lld --emit-relocs %t.o -o %t | ||
# RUN: llvm-readelf -x .got %t 2>&1 | FileCheck --check-prefix=LE-GOT %s | ||
# RUN: llvm-objdump -dr --no-show-raw-insn %t | FileCheck --check-prefixes=LE %s | ||
|
||
# RUN: ld.lld --emit-relocs --no-relax %t.o -o %t.norelax | ||
# RUN: llvm-readelf -x .got %t.norelax 2>&1 | FileCheck --check-prefix=LE-GOT %s | ||
# RUN: llvm-objdump -dr --no-show-raw-insn %t.norelax | FileCheck --check-prefixes=LE %s | ||
|
||
# LE-GOT: could not find section '.got' | ||
|
||
# a@tprel = st_value(a) = 0xfff | ||
# b@tprel = st_value(a) = 0x1000 | ||
# LE: 20158: nop | ||
# LE-NEXT: R_LARCH_TLS_IE_PC_HI20 a | ||
# LE-NEXT: R_LARCH_RELAX *ABS* | ||
# LE-NEXT: ori $a0, $zero, 4095 | ||
# LE-NEXT: R_LARCH_TLS_IE_PC_LO12 a | ||
# LE-NEXT: R_LARCH_RELAX *ABS* | ||
# LE-NEXT: add.d $a0, $a0, $tp | ||
# LE-NEXT: 20164: lu12i.w $a1, 1 | ||
# LE-NEXT: R_LARCH_TLS_IE_PC_HI20 b | ||
# LE-NEXT: ori $a1, $a1, 0 | ||
# LE-NEXT: R_LARCH_TLS_IE_PC_LO12 b | ||
# LE-NEXT: add.d $a1, $a1, $tp | ||
# LE-NEXT: 20170: nop | ||
# LE-NEXT: R_LARCH_TLS_IE_PC_HI20 a | ||
# LE-NEXT: R_LARCH_RELAX *ABS* | ||
# LE-NEXT: lu12i.w $a3, 1 | ||
# LE-NEXT: R_LARCH_TLS_IE_PC_HI20 b | ||
# LE-NEXT: R_LARCH_RELAX *ABS* | ||
# LE-NEXT: ori $a2, $zero, 4095 | ||
# LE-NEXT: R_LARCH_TLS_IE_PC_LO12 a | ||
# LE-NEXT: ori $a3, $a3, 0 | ||
# LE-NEXT: R_LARCH_TLS_IE_PC_LO12 b | ||
# LE-NEXT: add.d $a2, $a2, $tp | ||
# LE-NEXT: add.d $a3, $a3, $tp | ||
|
||
la.tls.ie $a0, a # relax | ||
add.d $a0, $a0, $tp | ||
|
||
# PCALAU12I does not have R_LARCH_RELAX. No relaxation. | ||
pcalau12i $a1, %ie_pc_hi20(b) | ||
ld.d $a1, $a1, %ie_pc_lo12(b) | ||
add.d $a1, $a1, $tp | ||
|
||
# Test instructions are interleaved. | ||
# PCALAU12I has an R_LARCH_RELAX. We perform relaxation. | ||
pcalau12i $a2, %ie_pc_hi20(a) | ||
.reloc .-4, R_LARCH_RELAX, 0 | ||
pcalau12i $a3, %ie_pc_hi20(b) | ||
.reloc .-4, R_LARCH_RELAX, 0 | ||
ld.d $a2, $a2, %ie_pc_lo12(a) | ||
ld.d $a3, $a3, %ie_pc_lo12(b) | ||
add.d $a2, $a2, $tp | ||
add.d $a3, $a3, $tp | ||
|
||
.section .tbss,"awT",@nobits | ||
.globl a | ||
.zero 0xfff ## Place a at 0xfff, LE needs only one ins. | ||
a: | ||
.zero 1 ## Place b at 0x1000, LE needs two ins. | ||
b: | ||
.zero 4 |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.