Currently we do not collect stats during the link step, if -flto is
added to the build-type dependent CMAKE_C/CXX_FLAGS variables. We should
check those variables as well.
Details
- Reviewers
MatzeB cmatthews lebedev.ri
Diff Detail
- Repository
- rOLDT svn-test-suite
- Build Status
Buildable 31075 Build 31074: arc lint + arc unit
Event Timeline
Two thoughts:
- Why is LDFLAGS being set conditionally, is there a warning otherwise?
- I wonder, why it's {C,CXX,LD}FLAGS, and not CMAKE_*_FLAGS directly.
I think it is set conditionally, because the selected linker exe may not support it. When doing LTO and saving stats, the assumption is that people are using clang for linking.
- I wonder, why it's {C,CXX,LD}FLAGS, and not CMAKE_*_FLAGS directly.
Not sure, TBH.
Unless it is intentionally overridden along the way by the user, CMake is always using the compiler as the linker.
- I wonder, why it's {C,CXX,LD}FLAGS, and not CMAKE_*_FLAGS directly.
Not sure, TBH.
https://github.com/Kitware/CMake/blob/c4b4d8b3a67718e29edb5676273e528dab566672/Modules/CMakeCXXInformation.cmake#L268-L271
so i'd really recommend to try to always set it, and see if that works
I just realised that this patch was still around!
That makes sense, thanks! But I think moving away from CFLAGS, CXXFLAGS and LDFLAGS is an orthogonal change to this one and there potentially are additional things that can go wrong there. Do you think that and the change as is makes sense?
I don't think the change as-is is bad. Though i'm not sure it will catch everything - it can be set in subdirectory too.
Have you checked what happens if you do list(APPEND LDFLAGS -save-stats=obj) unconditionally?
I wonder, why it's {C,CXX,LD}FLAGS, and not CMAKE_*_FLAGS directly.
Not sure, TBH.
As far as I know the idea is that CFLAGS/CXXFLAGS/LDFLAGS are maintained as cmake lists so you can do stuff like list(FILTER on them. CMAKE_xxx_FLAGS are strings so it's harder to do it there.
The desire to have them as lists stems from the fact that the first version of the test-suite cmake files were mostly created by an automatic script reading the Makefiles needing to translate stuff like $(filter -lstdc++,$(LDFLAGS))...
So no strong reason, but will be annoying to change now.