This is an archive of the discontinued LLVM Phabricator instance.

[cmake] [compiler-rt] Remove duplicate CMAKE_CXX_FLAGS.
AbandonedPublic

Authored by hintonda on Jan 22 2018, 4:08 PM.

Details

Summary

set_target_compile_flags() ultimately sets COMPILE_FLAGS which are
added to CMAKE_CXX_FLAGS in the compile rule, so passing
CMAKE_CXX_FLAGS causes them to be duplicated.

Diff Detail

Repository
rL LLVM

Event Timeline

hintonda created this revision.Jan 22 2018, 4:08 PM
Herald added subscribers: Restricted Project, llvm-commits, mgorny. · View Herald TranscriptJan 22 2018, 4:08 PM
phosek accepted this revision.Jan 28 2018, 6:36 PM
phosek added a subscriber: phosek.

LGTM

This revision is now accepted and ready to land.Jan 28 2018, 6:36 PM
hintonda retitled this revision from [cmake] Remove duplicate CMAKE_CXX_FLAGS. to [cmake] [compiler-rt] Remove duplicate CMAKE_CXX_FLAGS..Jan 28 2018, 9:06 PM
This revision was automatically updated to reflect the committed changes.
hintonda reopened this revision.Jan 29 2018, 3:00 PM

This patch caused http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/7195 to fail and was reverted.

The problem seems to be that this buildbot invokes cmake with --target= and --sysroot= added to only CMAKE_CXX_FLAGS, and relies on set_target_flags to add them to COMPILE_FLAGS so it can be used for every compiler, e.g., C, CXX, and ASM. That's why the build broke when CMAKE_CXX_FLAGS was no longer added to COMPILE_FLAGS, i.e., the target= and --sysroot= flags weren't passed to ASM.

A better way to do this is to pass CMAKE_SYSROOT= and CMAKE_<lang>_COMPILER_TARGET=, which is how llvm/runtime/CMakeLists.txt does it.

Also, darwin_add_builtin_libraries() and darwin_add_embedded_builtin_libraries() currently reset CMAKE_<lang>_FLAGS, which means they must come from COMPILE_FLAGS.

This revision is now accepted and ready to land.Jan 29 2018, 3:00 PM
hintonda abandoned this revision.Mar 24 2018, 9:02 AM

Not absolutely needed, and no time to work on this right now.