Page MenuHomePhabricator

[RISCV][ASAN] Fix TLS offsets

Authored by luismarques on Mon, Oct 12, 8:07 AM.



This fixes an ASan test failure: TestCases/Linux/static_tls.cpp.
The original code was introduced by rG809a42e3d535.

Diff Detail

Event Timeline

luismarques created this revision.Mon, Oct 12, 8:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptMon, Oct 12, 8:07 AM
Herald added subscribers: Restricted Project, evandro, sameer.abuasal and 8 others. · View Herald Transcript
luismarques requested review of this revision.Mon, Oct 12, 8:07 AM
luismarques added inline comments.Mon, Oct 12, 8:12 AM

(I would use __builtin_thread_pointer, but IIRC that's not supported by GCC for RISC-V, and the code for the sanitizers is shared between codebases)

This revision is now accepted and ready to land.Mon, Oct 12, 8:28 AM
lenary added inline comments.Mon, Oct 12, 8:28 AM

We should leave a TODO, I think we've (recently) agreed that __builtin_thread_pointer will always return tp.

Harbormaster completed remote builds in B74803: Diff 297596.
kito-cheng added inline comments.Mon, Oct 12, 7:59 PM

RISC-V GCC has implemented __builtin_thread_pointer, so I think it's fine to use that.

Use __builtin_thread_pointer.

luismarques marked 2 inline comments as done.Tue, Oct 13, 1:58 AM

Thanks for the info @kito-cheng

This revision was landed with ongoing or failed builds.Mon, Oct 19, 5:42 AM
This revision was automatically updated to reflect the committed changes.