Linker generated attributes for LTO - does lld already do this?

Hello,

To the best of my knowledge upstream LLD doesn’t do anything like this at the moment. There was a talk some years ago at an LLVM dev meeting that did something like this in https://llvm.org/devmtg/2017-10/slides/LTOLinkerScriptsEdlerVonKoch.pdf however there wasn’t any upstream work that came of this.

LTO and the challenges of linker scripts did come up at the last LLVM Embedded Toolchains meeting LLVM Embedded Toolchains Working Group sync up - #10 by voltur01 I think that good linker script support will be necessary for LTO to see wide spread use in embedded systems, so I’m looking forward to seeing this happen. I’m more of a linker person than compiler, so I can offer to help with LLD reviews.

From memory LLD assigns input sections to output sections fairly late, certainly after LTO code-generation. Although I think it does scan the linker script early for some things, and it may be the case that only a small amount of section assignment needs to be done prior to LTO.