[libc-commits] [PATCH] D159110: [libc] Fix set_thread_ptr call in rv32 start up code
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Aug 29 17:13:08 PDT 2023
sivachandra added a comment.
In D159110#4626744 <https://reviews.llvm.org/D159110#4626744>, @jrtc27 wrote:
>> Yes, it writes to `tp` (which is currently junk / 0), with the result of `*(void *)val`, where `val` points into the allocated TLS region, at the first byte of the static TLS block within it. Therefore it does exactly what I have now twice said it does.
>
> That is, currently the code does `tp = *(void **)val;`, but it should do `tp = val;`.
What I am not getting is why should we even consider a dereference operation in the `ld` case. They way I understand, this is what is happening with `ld`:
1. Store `val` (which is in `a0`) on the stack.
2. Load `tp` with the value stored on the stack in the above step.
So, there is no dereference happening anywhere?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159110/new/
https://reviews.llvm.org/D159110
More information about the libc-commits
mailing list