Messages in this thread | | | Date | Mon, 5 Feb 2018 08:22:11 -0800 | From | Andi Kleen <> | Subject | Re: [PATCH 1/2] modpost: don't add warnings for LTO-generated symbols |
| |
On Mon, Feb 05, 2018 at 04:59:32PM +0100, Arnd Bergmann wrote: > On Mon, Feb 5, 2018 at 4:50 PM, Andi Kleen <ak@linux.intel.com> wrote: > > On Mon, Feb 05, 2018 at 04:12:52PM +0100, Arnd Bergmann wrote: > >> WARNING: vmlinux.o(.data+0x12e0): Section mismatch in reference from the variable pfkey_net_ops.lto_priv.2992 to the function .init.text:pfkey_net_init.lto_priv.2977() > >> The variable pfkey_net_ops.lto_priv.2992 references > >> the function __init pfkey_net_init.lto_priv.2977() > >> If the reference is valid then annotate the > >> variable with __init* or __refdata (see linux/init.h) or name the variable: > >> *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console > > > > A better fix would be to ensure modpost always runs on already LD_FINALed > > objects, so it never sees LTO. > > > > Otherwise you would need to teach modpost about the LTO symbol table > > and some other magic. I did that once, but it turned out to be very > > ugly. > > I'm not sure I understand what that means. Do you mean that with LD_FINAL, > those symbol references are completely eliminated so we don't need to worry > about them any more?
Yes there should not be any .lto_priv references after LDFINAL, it will be just like any other ELF object. We also need to do the same thing before objtool.
> > I got about a dozen section mismatch errors with LTO in cases where the > calling function gets a specialized version of a structure, and my oneline > patch above addresses them all.
Not sure I follow here. .lto_priv should be anything LTO, not just some specific optimizations.
-Andi
| |