x86/apic: Mark lapic_cal_handler() __noipa to avoid GCC 16 section mismatch
PATCH 1/1 x86/apic: Mark lapic_cal_handler() __noipa to avoid GCC 16 section mismatch
During APIC timer calibration lapic_cal_handler() is temporarily installed as global_clock_event->event_handler and called from the timer interrupt path. GCC 16's more aggressive interprocedural analysis specializes that indirect call into a direct reference from the non-__init interrupt handler to the __init lapic_cal_handler(), which modpost rejects:
WARNING: modpost: vmlinux: section mismatch in reference:
__sysvec_apic_timer_interrupt+0x59 (section: .text) -> lapic_cal_handler (section: .init.text)
ERROR: modpost: Section mismatches detected.
The reference only exists during the __init calibration window, so it is harmless at runtime, but the direct .text -> .init.text reference GCC 16 synthesises is not allowed. Mark lapic_cal_handler() __noipa so the compiler keeps it as its own init-section function instead of cloning it into the interrupt path, while preserving the correct __init annotation.
This is the same approach used for the equivalent GCC 16 section mismatches in commit 4c9ad387aa2d ("iommu, debugobjects: avoid gcc-16.1 section mismatch warnings").
--- arch/x86/kernel/apic/apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/apic/apic.c +1 -1
@@ -660,7 +660,7 @@ static __initdata unsigned long lapic_cal_j1, lapic_cal_j2;/* * Temporary interrupt handler and polled calibration function. */ -static void __init lapic_cal_handler (struct clock_event_device *dev) +static __noipa void __init lapic_cal_handler(struct clock_event_device *dev) {unsigned long long tsc =0 ;long tapic =apic_read (APIC_TMCCT );
base-commit: 48a5a7ab8d6ab7090564339e039c421f315de912
Signature · 1 line
2.41.0
Quoted 17 lines · Jan Brzezanski
During APIC timer calibration
lapic_cal_handler()is temporarily installed asglobal_clock_event->event_handlerand called from the timer interrupt path. GCC 16's more aggressive interprocedural analysis specializes that indirect call into a direct reference from the non-__init interrupt handler to the__initlapic_cal_handler(), which modpost rejects:WARNING: modpost: vmlinux: section mismatch in reference:
__sysvec_apic_timer_interrupt+0x59(section: .text) ->lapic_cal_handler(section: .init.text)
ERROR: modpost: Section mismatches detected.The reference only exists during the
__initcalibration window, so it is harmless at runtime, but the direct .text -> .init.text reference GCC 16 synthesises is not allowed. Marklapic_cal_handler()__noipaso the compiler keeps it as its own init-section function instead of cloning it into the interrupt path, while preserving the correct__initannotation.
Quoted 5 lines
This is the same approach used for the equivalent GCC 16 section mismatches in commit
4c9ad387aa2d("iommu, debugobjects: avoid gcc-16.1 section mismatch warnings").Signed-off-by Jan Brzezanski <[email protected]>
Looks good to me, lets hope we don't get a lot more of these.