Re: [PATCH 2/2] [RFC] iommu: io-pgtable-arm-v7s: avoid gcc-16.0.1 section mismatch

From: Arnd Bergmann

Date: Tue Mar 10 2026 - 15:28:20 EST


On Tue, Mar 10, 2026, at 17:40, Will Deacon wrote:
> On Tue, Feb 03, 2026 at 05:24:00PM +0100, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@xxxxxxxx>
>>
>> gcc-16 has gained some more advanced inlining techniques that enable
>> it to inline the dummy_tlb_add_page() and dummy_tlb_flush() function
>> pointers into a specialized version of __arm_v7s_unmap:
>>
>> WARNING: modpost: vmlinux: section mismatch in reference: __arm_v7s_unmap+0x2cc (section: .text) -> dummy_tlb_add_page (section: .init.text)
>>
>> From what I can tell, the transformation is correct, as this
>> is only called when __arm_v7s_unmap() is called from
>> arm_v7s_do_selftests(), which is also __init.
>>
>> I have not come up with a good workaround, so this simply marks
>> dummy_tlb_add_page() as not __init. Since there are currently only two
>> files where this happens, that may be an easy way out.
>>
>> If anyone has a better idea for how to deal with that, let me know!
>
> Can we mark the dummy_* functions as 'noinline' instead? We shouldn't
> have to keep the selftest code kicking around in memory after boot.

I think that would work as well, but I'd have to test it properly,
as the gcc behavior was already not what I had expected.

Another option may be to take this a bit further and do the
same for the arm_v7s selftest that Mostafa did in the lpae
selftest with 7e06063a43d3 ("iommu/io-pgtable-arm-selftests:
Use KUnit") and a3c24b6d7cd6 ("iommu/io-pgtable-arm-selftests:
Modularize the test").

I think that would be the most logical step, but it's also
beyond what I can do as a simple build fix.

Arnd