Skip to content

Geant4 LTO Improvements / Fixes, main branch (2024.05.10.)

As @elmsheus found in ATLINFR-5372, !71255 (merged) managed to break our Clang nightly.

https://bigpanda.cern.ch/nview/?nightly=main_Athena_x86_64-el9-clang17-opt

It turns out that LTO doesn't come as easily to Clang as it does to GCC. 🤔

As described in ATLINFR-5372, I found that I would need to do two things:

  • Turn off ATLAS_GEANT4_USE_LTO when check_ipo_supported(...) tells us to do so. This is what I did in Athena/CMakeLists.txt and AthSimulation/CMakeLists.txt.
  • Make sure that INTERPROCEDURAL_OPTIMIZATION would be set explicitly on all clients of the G4 OBJECT libraries. Since IPO/LTO is not a transitive property in CMake, and Clang's linking needs LTO to be enabled to understand what to do with the object files that were created using LTO.

During the latter I also found a package that escaped being merged into AtlasGeant4: MuonSensitiveDetectorsR4. In this MR I'm adding that to AtlasGeant4 as well. But I'm not absolutely sure that I should... 🤔 So I'd need some input from @mbandier, @bmorgan and @jchapman on that. (I also have to admit that I didn't test that change properly. So the CI may very well complain...)

Merge request reports