This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][ASAN] Fix TLS offsets
ClosedPublic

Authored by luismarques on Oct 12 2020, 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.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
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.Oct 12 2020, 8:28 AM
lenary added inline comments.Oct 12 2020, 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.Oct 12 2020, 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.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.