Re: [PATCH v4 01/11] macintosh/via-pmu: Fix section mismatch warning

From: Finn Thain
Date: Mon Jul 02 2018 - 08:06:30 EST


On Mon, 2 Jul 2018, Mathieu Malaterre wrote:

> On Mon, Jul 2, 2018 at 10:25 AM Finn Thain <fthain@xxxxxxxxxxxxxxxxxxx>
> wrote:
> >
> > The pmu_init() function has the __init qualifier, but the ops struct
> > that holds a pointer to it does not. This causes a build warning. The
> > driver works fine because the pointer is only dereferenced early.
> >
> > The function is so small that there's negligible benefit from using
> > the __init qualifier. Remove it to fix the warning, consistent with
> > the other ADB drivers.
>
> Would you mind copy/pasting the warning you are seeing.
>
> Make sure you have:
>
> 58935176ad17 powerpc/via-pmu: Fix section mismatch warning
>
> Thanks
>

It's true, the section mismatch warning from 'make' has disappeared since
I wrote this patch, but that doesn't mean it is wrong.

Before this patch:

$ powerpc-linux-gnu-objdump -xda vmlinux |egrep -w "via_pmu_driver|pmu_init"
c0711c84 l F .init.text 0000001c pmu_init
c05eb408 g O .rodata 00000028 via_pmu_driver
c0711c84 <pmu_init>:
$

After:

$ powerpc-linux-gnu-objdump -xda vmlinux |egrep -w "via_pmu_driver|pmu_init"
c038e42c l F .text 0000001c pmu_init
c05e1e58 g O .rodata 00000028 via_pmu_driver
c038e42c <pmu_init>:
$

I gather that commit 58935176ad17 ("powerpc/via-pmu: Fix section mismatch
warning") has moved via_pmu_driver from .data to .rodata, but I'm afraid I
don't see the point of that change. The commit log entry doesn't explain
it either.

If .rodata is not discarded then the dangling pointer remains, right?

--