Skip to content
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

Remove further reference to R_RISCV_GPREL_[IS] #205

Closed
jrtc27 opened this issue Aug 10, 2021 · 4 comments · Fixed by #216
Closed

Remove further reference to R_RISCV_GPREL_[IS] #205

jrtc27 opened this issue Aug 10, 2021 · 4 comments · Fixed by #216
Assignees
Milestone

Comments

@jrtc27
Copy link
Collaborator

jrtc27 commented Aug 10, 2021

We currently still say the following:

GP-Relative Relocations: If symbol is within the range of a signed 12-bit
immediate offset from __global_pointer$, then the address can be loaded with a
single instruction which has one relocation, a R_RISCV_GPREL_I or
R_RISCV_GPREL_S.

The instruction is an I-Type instruction (add immediate or load) with an
R_RISCV_GPREL_I or an S-type instruction (store) with an R_RISCV_GPREL_S
relocation. The following assembly show loading a gp-relative address:

     addi a0, gp, 0          # R_RISCV_GPREL_I (symbol)

This relies on the value of __global_pointer$ being loaded into gp (aka
x3). This can be used by linker relaxation to delete the lui instruction.

There was never any assembly syntax for that and the relocations have since been removed due to being internal binutils relocations. We should remove this section.

@jrtc27 jrtc27 self-assigned this Aug 10, 2021
@jrtc27 jrtc27 added this to the First Release milestone Aug 10, 2021
@kito-cheng
Copy link
Collaborator

kito-cheng commented Aug 23, 2021

I believe this issue is resolved by #199 :)

@jrtc27
Copy link
Collaborator Author

jrtc27 commented Aug 23, 2021

No, that's why this issue says "further". I missed this in my original PR.

@jrtc27 jrtc27 reopened this Aug 23, 2021
@kito-cheng
Copy link
Collaborator

kito-cheng commented Aug 23, 2021

Oh, I got your point, I guess I can working on writing __global_pointer$ in next few days and remove those sentence about R_RISCV_GPREL_[IS], or are you already working on that?

@jrtc27
Copy link
Collaborator Author

jrtc27 commented Aug 23, 2021

We already have https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#calculation-symbols, I think the quoted section just needs deleting.

kito-cheng added a commit that referenced this issue Sep 24, 2021
MaskRay added a commit to MaskRay/musl that referenced this issue Jan 26, 2024
Note:sSome relocation types were only used by binutils and accidentally
exposed to previous versions of psABI (e.g.
riscv-non-isa/riscv-elf-psabi-doc#205
riscv-non-isa/riscv-elf-psabi-doc#323). One of
the value has been has been reused by GOT32_PCREL.
MaskRay added a commit to MaskRay/musl that referenced this issue Jan 26, 2024
Note: Some relocation types were only used by binutils and accidentally
exposed to previous versions of psABI (e.g.
riscv-non-isa/riscv-elf-psabi-doc#205
riscv-non-isa/riscv-elf-psabi-doc#323). One of
the values has been reused by GOT32_PCREL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants