-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[ELF] Implement R_RISCV_TLSDESC for RISC-V #79239
Closed
MaskRay
wants to merge
8
commits into
main
from
users/MaskRay/spr/elf-implement-r_riscv_tlsdesc-for-risc-v
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3725fa4
[𝘀𝗽𝗿] initial version
MaskRay c52f753
supported interleaved unrelated insn
MaskRay de407fd
.
MaskRay e984f0f
relaxation -> optimization while making changes
MaskRay 2e2c42f
rebase on simplification. only check R_RISCV_RELAX for R_RISCV_TLSDES…
MaskRay aa4749c
move a comment
MaskRay 18019ad
rebase
MaskRay 1caa094
rebase
MaskRay 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 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 @@ | ||
# REQUIRES: riscv | ||
# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.o | ||
# RUN: ld.lld -shared %t.o -o %t.so | ||
# RUN: llvm-readobj -r %t.so | FileCheck %s --check-prefix=RELA | ||
|
||
## Both TLSDESC and DTPMOD64/DTPREL64 should be present. | ||
# RELA: .rela.dyn { | ||
# RELA-NEXT: 0x[[#%X,ADDR:]] R_RISCV_TLSDESC a 0x0 | ||
# RELA-NEXT: 0x[[#ADDR+16]] R_RISCV_TLS_DTPMOD64 a 0x0 | ||
# RELA-NEXT: 0x[[#ADDR+24]] R_RISCV_TLS_DTPREL64 a 0x0 | ||
# RELA-NEXT: } | ||
|
||
la.tls.gd a0,a | ||
call __tls_get_addr@plt | ||
|
||
.Ltlsdesc_hi0: | ||
auipc a2, %tlsdesc_hi(a) | ||
ld a3, %tlsdesc_load_lo(.Ltlsdesc_hi0)(a2) | ||
addi a0, a2, %tlsdesc_add_lo(.Ltlsdesc_hi0) | ||
jalr t0, 0(a3), %tlsdesc_call(.Ltlsdesc_hi0) | ||
|
||
.section .tbss,"awT",@nobits | ||
.globl a | ||
.zero 8 | ||
a: | ||
.zero 4 |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it handles the long form, but there is a short form that can be used when the offset from TP is w/in 2KB. Is that something we need to handle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this. Implemented the short form.