Page MenuHomePhabricator

[RISCV][ASAN] Fix TLS offsets
ClosedPublic

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

Details

Summary

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
compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
379–381

(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
compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
379–381

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
compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
379–381

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

https://github.com/gcc-mirror/gcc/commit/1073b500e5d33af8b75567108a8c04fe2598df2b

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.