Open microbit-carlos opened 10 months ago
@Johnn333 could you apply the same dwarf flags to the LLVM PR and ensure they compile correctly?
BTW, if you set the build mode to regular 'debug' you will also need these flags set:
Looking at the docs it looks like CMAKE_<lang>_FLAGS_DEBUG_INIT
initialise the flags for CMAKE_<lang>_FLAGS_DEBUG
, so that should be fine?
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS_CONFIG_INIT.html
However, the docs indicate that it was only introduced in CMake v3.11 and we need to support 3.6, so maybe we need to replace the CMAKE_<lang>_FLAGS_<config>_INIT
entries with CMAKE_<lang>_FLAGS_<config>
anyway.
Looking at the docs it looks like CMAKE_
_FLAGS_DEBUGINIT initialise the flags for CMAKE _FLAGS_DEBUG, so that should be fine?
This didn't work for me, perhaps because versions
@Johnn333 could you apply the same dwarf flags to the LLVM PR and ensure they compile correctly?
Seems okay on my end, it still compiles, full of warnings as ever. I'm hoping to spend some time at some point getting the GCC built libraries to be compatiable with LLD (currently Clang has to build all of CODAL and use those libraries), but with some of the changes to CODAL its much closer to being able to digest the default GCC ones. Wouldn't worry too much about the LLVM build :).
Okay, so essentially the CMAKE_<LANG>_FLAGS_<CONFIG>_INIT
CMake variables didn't seem to be working, and they weren't overwriting the default values for CMAKE_<LANG>_FLAGS_<CONFIG>
.
More info can be found in:
Since we have to support older version of CMake anyway, I've replace CMAKE_<LANG>_FLAGS_<CONFIG>_INIT
with CMAKE_<LANG>_FLAGS_<CONFIG>
(setting the variable, rather than appending to it, as we want these to be the starting values).
With this change and comparing the before and after this patch, there are significant changes in the build. That's because until now we've been building with -O2
instead of -Os
.
As a quick test, I've change the optimisation level on top of this patch to O2
, built again, and compared that with a build from master.
With this patch + O2, doing a diff of this map file and the map from master, and the only difference is the size of the debug strings, everything else is the same, so that's a decent test that this PR is working as expected.
Before we can merge this PR with -Os, we should have a look at the affected components, as listed in https://github.com/lancaster-university/codal-microbit-v2/issues/373#issuecomment-1712037165 to see if anything that might be performance critical could be negatively affected.
@JohnVidler could you have a look at the list there and confirm if we are relatively safe to introduce performance issues?
As done by @thegecko in https://github.com/lancaster-university/microbit-v2-samples/commit/b0ab5ffeafe6b3a47a11d65f611fe289feff4df0.
This should also help with some of the issues I've seen with bloaty parsing DWARF v5 files produced by arm-none-eabi-gcc v12.3.