section mismatch test doesn't work reliably on arm64

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Fri Sep 29 10:41:01 PDT 2023


Hello,

On Fri, Sep 29, 2023 at 10:15:40AM +0200, Uwe Kleine-König wrote:
> by manual inspection I found a section mismatch in
> drivers/hwtracing/coresight/coresight-etm4x-core.c where
> etm4_platform_driver (which lives in ".data") contains a reference to
> etm4_remove_platform_dev() (which lives in ".exit.text").
> 
> However building with CONFIG_DEBUG_SECTION_MISMATCH=y +
> CONFIG_CORESIGHT_SOURCE_ETM4X=y doesn't warn about that one.

Arnd had the right hint in irc: If I do

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 34a5386d444a..070e53be1ea2 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1017,7 +1017,7 @@ static int secref_whitelist(const char *fromsec, const char *fromsym,
 
 	/* symbols in data sections that may refer to meminit/exit sections */
 	if (match(fromsec, PATTERNS(DATA_SECTIONS)) &&
-	    match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_EXIT_SECTIONS)) &&
+	    match(tosec, PATTERNS(ALL_XXXINIT_SECTIONS, ALL_XXXEXIT_SECTIONS)) &&
 	    match(fromsym, PATTERNS("*driver")))
 		return 0;
 
I get a mismatch warning:

WARNING: modpost: vmlinux: section mismatch in reference: etm4x_amba_driver+0x98 (section: .data) -> etm4_remove_amba (section: .exit.text)
WARNING: modpost: vmlinux: section mismatch in reference: etm4_platform_driver+0x8 (section: .data) -> etm4_remove_platform_dev (section: .exit.text)
ERROR: modpost: Section mismatches detected.

I remember that back in the times of CONFIG_HOTPLUG references to
".devinit.text" and ".devexit.text" were ok. Is a reference to
.exit.text ever ok?

I started an allyesconfig build on a few archs with the above patch
applied. This will take some time, when it's done I will report what it
found.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20230929/309f7874/attachment.sig>


More information about the linux-arm-kernel mailing list