Page MenuHomePhabricator

[compiler-rt][builtins] Provide __clear_cache for SPARC
ClosedPublic

Authored by ro on Jul 10 2019, 7:38 AM.

Details

Summary

While working on https://reviews.llvm.org/D40900 (which now is effectively about
enabling compiler-rt on sparc in general, two tests were failing since __clear_cache
aborted. While libgcc's __clear_cache is just empty, this only happens because
gcc ( in gcc/config/sparc/sparc.c (sparc32_initialize_trampoline, sparc64_initialize_trampoline)
emits flush insns directly.

The following patch mimics that.

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

Diff Detail

Repository
rL LLVM

Event Timeline

ro created this revision.Jul 10 2019, 7:38 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 10 2019, 7:38 AM
Herald added subscribers: Restricted Project, dberris, jyknight. · View Herald Transcript
ro added a reviewer: jyknight.Jul 16 2019, 1:09 AM

Ping? It's been a week.

ro added a comment.Jul 23 2019, 4:20 AM

Ping^2? Two weeks now; anyone else who could review this?

jyknight accepted this revision.Jul 23 2019, 7:06 AM

The code you reference in GCC is only for trampolines, while this function is used to implement builtin_clear_cache. AFAICT GCC is just wrong to implement this as a no-op.

Anyways, looks OK.

This revision is now accepted and ready to land.Jul 23 2019, 7:06 AM
ro added a comment.Jul 23 2019, 9:28 AM

The code you reference in GCC is only for trampolines, while this function is used to implement builtin_clear_cache. AFAICT GCC is just wrong to implement this as a no-op.

I think you're right: I missed the __builtin___clear_cache part on the GCC side. I'll file a GCC PR for the issue. Thanks.

This revision was automatically updated to reflect the committed changes.