On 23.10.2025 17:30, Andrew Cooper wrote: > On 23/10/2025 4:20 pm, Grygorii Strashko wrote: >> From: Grygorii Strashko <[email protected]> >> >> Functions: >> - vlapic_apicv_write() >> - vlapic_set_ppr() >> are used by Intel VMX code only, so move them under CONFIG_INTEL_VMX ifdef. >> >> Signed-off-by: Grygorii Strashko <[email protected]> > > Yes and no. Yes right now, but this is needed for AMD AVIC, which I > understand is one one of the plans. > > Throwing #ifdef's around like this in common files is fragile and will > lead to a randconfig nightmare. > > There is an alternative which ought to work. Turning on > -ffunction-sections (we already have this for livepatching), and > implementing link time --gc-sections (new work). > > That way, the compiler/linker simply drops functions that are not > referenced in the final binary. > > Personally I think it will be far nicer and more scalable than the > #ifdefary, (not to mention far easier - it gets rid of everything > unreferenced with one fell swoop). > > Thoughts?
We'd need to have Misra buy-off on such an approach. I'm not sure if Eclair's scanning would take --gc-sections effects into account. Jan
