This is an archive of the discontinued LLVM Phabricator instance.

[SE] Stop using llvm-config --cxxflags
ClosedPublic

Authored by jhen on Sep 12 2016, 2:40 PM.

Details

Summary

Build configuration was adding $(llvm-config --cxxflags) to the
StreamExecutor CXXFLAGS, but this was causing "-O3" to be passed even
for debug builds, and was making debugging difficult.

The llvm-config call was originally introduced to handle the -fno-rtti
flag because an RTTI StreamExecutor could not link with a no-RTTI LLVM.
This patch converts to using the --has-rtti flag to llvm-config and
only adding the -fno-rtti flag if needed, not all the rest of the LLVM
CXXFLAGS.

I have tested this with clang-4.0 and gcc-4.8 on Ubuntu. Some work will
probably have to be done to support MSVC.

Diff Detail

Repository
rL LLVM

Event Timeline

jhen updated this revision to Diff 71057.Sep 12 2016, 2:40 PM
jhen retitled this revision from to [SE] Stop using llvm-config --cxxflags.
jhen updated this object.
jhen added a reviewer: jlebar.
jhen added subscribers: parallel_libs-commits, jprice.

I believe LLVMConfig.cmake defines an LLVM_ENABLE_RTTI variable which can give you this information directly, without the need for the execute_process().

jhen updated this revision to Diff 71065.Sep 12 2016, 3:45 PM
  • LLVM_ENABLE_RTTI
jhen added a comment.Sep 12 2016, 3:45 PM

I believe LLVMConfig.cmake defines an LLVM_ENABLE_RTTI variable which can give you this information directly, without the need for the execute_process().

Oh cool! That's much better. Thanks!

jlebar accepted this revision.Sep 12 2016, 5:31 PM
jlebar edited edge metadata.
This revision is now accepted and ready to land.Sep 12 2016, 5:31 PM
This revision was automatically updated to reflect the committed changes.