mosquitto
mosquitto copied to clipboard
Please enable building with LTO support
When trying to build mosquitto with LTO support Debian bug #1015547 happens. This is still exactly the same with 2.0.21. Enabling LTO adds the flags -flto=auto -ffat-lto-objects to CFLAGS, CXXFLAGS, OBJCFLAGS ... and the flag -flto=auto to LDFLAGS.
This can be fixed by marking the missing methods with __attribute__((used)), see the associated Salsa MR 30. This is of course compiler specific and I am unsure how to do it in a portable way.
Thank you. As far as I can tell __attribute__((used)) is valid for both gcc and clang, so for the moment a macro for this which is defined based on the absence of _MSC_VER should do the job.