-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
RISC-V TLSDESC support #1041
RISC-V TLSDESC support #1041
Conversation
18d911c
to
d8e6edc
Compare
Added relaxation support. Tested with basic assembly, with WIP gas tree (should upload in a few minutes) at https://github.com/ishitatsuyuki/binutils/tree/rv-tlsdesc. |
u64 A = rel2.r_addend; | ||
if (!sym2.has_tlsdesc(ctx)) { | ||
u64 val = S + A - ctx.tp_addr; | ||
if (sign_extend(val, 11) == val) |
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.
Not satisfied with how we're computing this twice (here and in shrink_section), so I'm open to suggestions for how to deduplicate this logic.
That's my feeling too. If it had four slots from the beginning, it would have been simpler. But we already have code for two-slots design, so it doesn't make much difference anyway. And if it doesn't make much difference, I'd make it consist with others than diverging from them. |
d8e6edc
to
3972467
Compare
Signed-off-by: Tatsuyuki Ishi <[email protected]>
Signed-off-by: Tatsuyuki Ishi <[email protected]>
Signed-off-by: Tatsuyuki Ishi <[email protected]>
We have spec approved now. I'll rebase and undraft this soon. |
Signed-off-by: Tatsuyuki Ishi <[email protected]>
For example, when the leader's instruction is removed and a follower is right next to it, the follower's relocation can point to the follower's address itself. In this case the leader's relocation may lie before or after the follower, so just search for both. Signed-off-by: Tatsuyuki Ishi <[email protected]>
3972467
to
424e28d
Compare
TODO: We should probably get tests on this (right now I do it manually with my PoC). I'd expect portable C ones to work once we have compiler support shipped. |
Actually, I think I need to look a bit more how to deal with IE relaxation (now that it's in the common framework). |
Yup. But as long as it works with your wip patches, I don't care too much about writing tests in assembly. The feature will eventually be tested once your patches are merged. |
As to relaxation, you can just mimic what we are doing for ARM64, can't you? |
Yeah, it should be doable. |
Signed-off-by: Tatsuyuki Ishi <[email protected]>
424e28d
to
fed9508
Compare
IE is now working, I've also got the testsuite to pass with a few hacks to use locally built toolchain. |
write_utype(loc, desc + A - P); | ||
} else { | ||
if (removed_bytes == 0) { | ||
*(ul32 *)loc = 0x537; // lui a0,<hi20> |
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.
Not directly related to this change, but I think there's one more relaxation opportunity here. If the hi20 bits are small enough, you can use C.LUI instead of LUI if the C extension is available, which should save two bytes.
TODO: