Page MenuHomePhabricator

[RISCV][ASAN] Fix TLS offsets

Authored by luismarques on Oct 12 2020, 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.Oct 12 2020, 8:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2020, 8:07 AM
Herald added subscribers: Restricted Project, evandro, sameer.abuasal and 8 others. · View Herald Transcript
luismarques requested review of this revision.Oct 12 2020, 8:07 AM
luismarques added inline comments.Oct 12 2020, 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.Oct 12 2020, 8:28 AM
lenary added inline comments.Oct 12 2020, 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.Oct 12 2020, 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.Oct 13 2020, 1:58 AM

Thanks for the info @kito-cheng

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