This is an archive of the discontinued LLVM Phabricator instance.

Enable compiler-rt on SPARC
ClosedPublic

Authored by ro on Dec 7 2017, 1:01 AM.

Details

Summary

This patch enables compiler-rt on SPARC targets. Most of the changes are straightforward:

  • Add 32 and 64-bit sparc to compiler-rt
  • lib/builtins/fp_lib.h needed to check if the int128_t and uint128_t types exist (which they don't on sparc)

There's one issue of note: many asan tests fail to compile on Solaris/SPARC:

fatal error: error in backend: Function "_ZN7testing8internal16BoolFromGTestEnvEPKcb": over-aligned dynamic alloca not supported.

Therefore, while asan is still built, both asan and ubsan-with-asan, is disabled. The
goal is to check if asan keeps compiling on Solaris/SPARC. This serves asan in gcc,
which doesn't have the problem above and works just fine.

With this patch, sparcv9-sun-solaris2.11 test results are pretty good:

Failing Tests (9):
    Builtins-sparc-sunos :: divtc3_test.c
    Builtins-sparcv9-sunos :: compiler_rt_logbl_test.c
    Builtins-sparcv9-sunos :: divtc3_test.c
[...]
    UBSan-Standalone-sparc :: TestCases/TypeCheck/misaligned.cpp
    UBSan-Standalone-sparcv9 :: TestCases/TypeCheck/misaligned.cpp

The builtin failures are due to Bugs 42493 and 42496. The tree contained a few additonal
patches either currently in review or about to be sumitted.

Tested on sparcv9-sun-solaris2.11. Ok for trunk?

Diff Detail

Repository
rL LLVM

Event Timeline

ro created this revision.Dec 7 2017, 1:01 AM
Herald added subscribers: Restricted Project, fedor.sergeev, aheejin and 3 others. · View Herald TranscriptDec 7 2017, 1:01 AM
ro updated this revision to Diff 173833.Nov 13 2018, 4:45 AM

Refreshed.

ro updated this revision to Diff 207243.Jul 1 2019, 2:02 AM

This slightly revised patch completely disabled asan testing since that would break the
build as described. It does build it to make sure that it keeps compiling for use in GCC
where it works just fine.

Apart from that, it includes GENERIC_TF_SOURCES in sparc*_SOURCES to avoid
a couple of builtin test link failures.

Also, on top of https://reviews.llvm.org/D63982, it disables SPARC ubsan-with-asan
testing.

This patch allows reasonable sparcv9-sun-solaris2.11 results. Ok for trunk?

Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2019, 2:02 AM
ro retitled this revision from [Sanitizers] Enable sanitizers on SPARC (PR 33274) to Enable compiler-rt on SPARC.Jul 11 2019, 4:50 AM
ro edited the summary of this revision. (Show Details)
ro added reviewers: howard.hinnant, rsmith.
ro added a comment.Jul 11 2019, 4:51 AM

Updated title and summary to reflect current status: ready to be reviewed.

eugenis accepted this revision.Jul 11 2019, 12:11 PM
eugenis added a subscriber: eugenis.

LGTM

This revision is now accepted and ready to land.Jul 11 2019, 12:11 PM
This revision was automatically updated to reflect the committed changes.