This is an archive of the discontinued LLVM Phabricator instance.

Fix build on sparc64-linux-gnu.
ClosedPublic

Authored by marxin on Nov 2 2018, 2:12 AM.

Details

Summary

Following fixes build on Debian buster/sid NA
4.16.0-1-sparc64-smp.

As seen on the system sparcv9 macro is not defined, arch64__ is.
ifdef SANITIZER_SOLARIS is wrong as it's always defined (0/1 values).

The issue was introduced in r320740.

Diff Detail

Repository
rL LLVM

Event Timeline

marxin created this revision.Nov 2 2018, 2:12 AM
krytarowski edited reviewers, added: ro; removed: krytarowski.Nov 2 2018, 11:02 AM
krytarowski added a subscriber: ro.

Adding @ro for check whether it's fine for Solaris and SPARC.

I'm not sure entirely whether this is fine for all supported OSes so I will let others to review.

ro added a comment.Nov 4 2018, 11:51 AM

Overall, this looks good to me, with the nits noted.

However, I wonder how you tested this:

  • SPARC isn't among cmake/config-ix.cmake (ALL_ASAN_SUPPORTED_ARCH); in fact there's no compiler-rt support for SPARC at all.
  • In gcc, it's similar: there's no definition of TARGET_ASAN_SHADOW_OFFSET in the SPARC backend yet. I've submitted one for Solaris/SPARC in PR sanitizer/80953 and hope to finish and post it soon, but right now there's nothing.

Wondering...

lib/sanitizer_common/sanitizer_linux.cc
1949 ↗(On Diff #172324)

Could you please remove the blank before (__sparcv9)? My mistake.

I've checked both gcc and clang and those two cover all OSes with
SPARC support.

1956 ↗(On Diff #172324)

Good catch. Prompted by this, I checked the rest of compiler-rt
and there's only one other instance of #ifdef SANITIZER_<PLATFORM>
in lib/sanitizer_common/sanitizer_symbolizer.h with SANITIZER_WINDOWS.

In D54030#1286807, @ro wrote:

Overall, this looks good to me, with the nits noted.

However, I wonder how you tested this:

  • SPARC isn't among cmake/config-ix.cmake (ALL_ASAN_SUPPORTED_ARCH); in fact there's no compiler-rt support for SPARC at all.
  • In gcc, it's similar: there's no definition of TARGET_ASAN_SHADOW_OFFSET in the SPARC backend yet. I've submitted one for Solaris/SPARC in PR sanitizer/80953 and hope to finish and post it soon, but right now there's nothing.

Wondering...

I just built GCC on gcc202 machine of Compile farm. Even though the target is not supported, the libsanitizer runtime library is still built in GCC.

marxin updated this revision to Diff 172546.Nov 4 2018, 11:45 PM
marxin marked an inline comment as done.
ro accepted this revision.Nov 5 2018, 1:20 AM

I just built GCC on gcc202 machine of Compile farm. Even though the target is not supported, the libsanitizer runtime library is still built in GCC.

I see. Forgot to mention that I tested the patch myself on Solaris/SPARC in GCC mainline without regressions.

LGTM.

Thanks.

Rainer
This revision is now accepted and ready to land.Nov 5 2018, 1:20 AM
This revision was automatically updated to reflect the committed changes.
marxin marked an inline comment as done.