Re: section mismatch test doesn't work reliably on arm64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 30, 2023 at 2:41 AM Uwe Kleine-König
<u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
>
> 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?


No. I do not think it has ever been OK.

I guess this issue has been hidden for a long time.


The following commit disallows the reference to .init.*
but nothing happened to .exit.*



commit 0db252452378aa7a9e001a13226e1cd1dc61453d
Author: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
Date:   Sat Jan 30 21:14:23 2010 +0100

    modpost: don't allow *driver to reference .init.*

    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>





-- 
Best Regards
Masahiro Yamada




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux