This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's host toolchain
ClosedPublic

Authored by leonardchan on Sep 2 2021, 2:35 PM.

Diff Detail

Event Timeline

leonardchan created this revision.Sep 2 2021, 2:35 PM
leonardchan requested review of this revision.Sep 2 2021, 2:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2021, 2:35 PM
Herald added subscribers: Restricted Project, cfe-commits. · View Herald Transcript
phosek added a comment.Sep 2 2021, 3:47 PM

@leonardchan would it be possible to break this up into 3 changes?

clang/cmake/caches/Fuchsia-stage2.cmake
123

This shouldn't be needed.

141

Don't we need the -static-libgcc flag here as well?

@leonardchan would it be possible to break this up into 3 changes?

Can do.

clang/cmake/caches/Fuchsia-stage2.cmake
123
141

When testing locally, there was actually a tsan test that wasn't working if -static-libgcc was here. I can try to reproduce it. I believe it had to do with static linking in an archive, but a particular object file in that archive wasn't getting linked in which changed some runtime logic and caused the test to fail.

leonardchan added inline comments.Sep 2 2021, 4:51 PM
clang/cmake/caches/Fuchsia-stage2.cmake
141

Oh ok. Disregard my last explanation. So the test is compiler-rt/test/tsan/Linux/check_memcpy.c, and the actual reason it failed is because the test just checks to make sure calls to memcpy/memset are not used at all (since tsan should intercept them and replace them with its own functions/code).

The issue is that if we statically link in an uninstrumented libunwind, then the test will fail bc it will find memcpy/set calls in that libunwind code. Removing the -static-libgcc seems to instead opt for dynamically linking against libunwind.so, and not linking in any uninstrumented code.

phosek added inline comments.Sep 2 2021, 6:59 PM
clang/cmake/caches/Fuchsia-stage2.cmake
123

We are already build builtins in a separate build so I think we should be running the tests there rather than building the twice.

leonardchan added inline comments.
clang/cmake/caches/Fuchsia-stage2.cmake
123

Ah, I didn't know that. Removed.

phosek accepted this revision.Sep 8 2021, 12:25 AM
This revision is now accepted and ready to land.Sep 8 2021, 12:25 AM
This revision was landed with ongoing or failed builds.Sep 8 2021, 11:33 AM
This revision was automatically updated to reflect the committed changes.