This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][crt] Pass -fno-lto in check_cxx_section_exists
AcceptedPublic

Authored by hans on May 23 2019, 7:16 AM.

Details

Reviewers
phosek
thakis
Summary

Otherwise it doesn't work when building with -DLLVM_ENABLE_LTO=thin

(We hit this in Chromium in https://bugs.chromium.org/p/chromium/issues/detail?id=966403)

Diff Detail

Event Timeline

hans created this revision.May 23 2019, 7:16 AM
thakis accepted this revision.May 23 2019, 7:26 AM

This lgtm, but it suggests there's no upstream bot building llvm with lto, and running tests with it. I'm not sure I want to be in the business of owning test coverage for that config -- should we have an LTO bot on the llvm buildbot master?

This revision is now accepted and ready to land.May 23 2019, 7:26 AM
phosek added inline comments.May 24 2019, 8:32 AM
compiler-rt/lib/crt/CMakeLists.txt
22

I believe this should be done on line 79 as append_list_if(COMPILER_RT_HAS_FNO_LTO_FLAG -fno-lto CRT_CFLAGS), try_compile_flags is only used to test whether the compiler supports .init/.fini section but doesn't change flags used to compile crtbegin.o/crtend.o.

hans marked an inline comment as done.May 27 2019, 9:00 AM

This lgtm, but it suggests there's no upstream bot building llvm with lto, and running tests with it. I'm not sure I want to be in the business of owning test coverage for that config -- should we have an LTO bot on the llvm buildbot master?

As Bob pointed out on the Chromium bug, there is http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu but that doesn't include compiler-rt. It's Sony's bot. I'll ask if they want to include compiler-rt.

compiler-rt/lib/crt/CMakeLists.txt
22

We're already building crtbegin.o/crtend.o with -fno-lto -- I think it gets appended to all runtime build targets at some point.

It's really the "check whether .init/.fini is support" part I'm going after here, because that doesn't build with the normal compiler-rt flags, and so it doesn't work in thin-lto builds.

hans marked an inline comment as done.Jun 21 2019, 5:23 AM
hans added inline comments.
compiler-rt/lib/crt/CMakeLists.txt
22

Ping?

The ping is for phosek, right?

hans added a comment.Aug 2 2019, 12:20 AM

The ping is for phosek, right?

Yes.

phosek accepted this revision.Aug 15 2019, 11:22 AM

LGTM