This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer_common][test] Enable tests on SPARC
ClosedPublic

Authored by ro on Nov 17 2020, 3:23 AM.

Details

Summary

Unfortunately, the sanitizer_common tests are disabled on many targets that are supported by sanitizer_common, making it easy to miss issues with that support. This patch enables SPARC testing.

Beside the enabling proper, the patch fixes (together with D91607) the failures of the symbolize_pc.cpp and symbolize_pc_inline.cpp tests. Those tests PASS when compiled with gcc, which happens because clang incorrectly doesn't implement a non-default __builtin_extract_return_addr on several targets, SPARC included.

Because __builtin_extract_return_addr(__builtin_return_addr(0)) is quite a mouthful and I'm uncertain if the code needs to compile with msvc which appparently has it's own _ReturnAddres, I've introduced __sanitizer_return_addr to hide the difference and complexity. Because on 32-bit SPARC __builtin_extract_return_addr differs when the calling funtion returns a struct, I've added a testcase for that.

There are a couple more tests failing on SPARC that I will deal with separately.

Tested on sparcv9-sun-solaris2.11, amd64-pc-solaris2.11, and x86_64-pc-linux-gnu.

Diff Detail

Event Timeline

ro created this revision.Nov 17 2020, 3:23 AM
Herald added subscribers: Restricted Project, pengfei, s.egerton and 4 others. · View Herald TranscriptNov 17 2020, 3:23 AM
ro requested review of this revision.Nov 17 2020, 3:23 AM
vitalybuka accepted this revision.Feb 17 2021, 1:53 PM
vitalybuka added inline comments.
compiler-rt/include/sanitizer/common_interface_defs.h
211–219

gcc also supports __builtin_extract_return_addr

This revision is now accepted and ready to land.Feb 17 2021, 1:53 PM
ro updated this revision to Diff 403958.Jan 28 2022, 3:50 AM

Handle new symbolize_pc_demangle.cpp

I hadn't applied this yet, hoping to get D91607. In the meantime, a new affected testcase came up, handled in this version. I hope that's still ok.

This revision was automatically updated to reflect the committed changes.