Enabling LTO for new target

Hi,
Can anyone guide on how to enable LTO and Thin LTO for a new backend target ?
Thanks,
Siddharth

Can you be more specific? LTO/ThinLTO are target independent. You just need to be using a linker that supports *LTO (gold, lld, ld64, eg).
Teresa

yeah so when LTO runs, in the linker, it uses the target to produce object code. In the sense of code generation for target arch.
Thanks,
Siddharth

yeah so when LTO runs, in the linker, it uses the target to produce
object code. In the sense of code generation for target arch.

The linker invokes the LTO code which is in LLVM itself, and this just
invokes the standard code generation code
(LLVMTargetMachine::addPassesToEmitFile). So you shouldn't need to do
anything specific to add support for a new target with LTO/ThinLTO.

Teresa

Thanks,