On 2025-10-23 17:37, Jan Beulich wrote:
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
Currently it doesn't, but we do have plans to implement something
similar in the future. What might help in the meantime is using ECLAIR
Code Scout to tag and hide unused program entities. Not sure if the
mailing list is the best place to present the idea, but I'd be happy to
illustrate it in a community call or something similar.
Basically the idea is that if something is possibly reachable it will be
captured by Code Scout, and then a second analysis can use that input to
selectively find and tag (e.g. "unused") the definitely unreachable
entities. This could be limited to functions for instance, and then when
the rule for unreachable code finds something unreachable, it can be
silenced selectively for tagged functions, because we know that these
are unreachable due to that reason. It's not 1:1 with the --gc-sections
behaviour, but realistically it's much closer without resorting to
#ifdefary all over the place.
--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253