Re: [Linux v5.8-rc4] objtool warnings with gcc-10

From: Sedat Dilek
Date: Mon Jul 06 2020 - 05:02:59 EST


On Mon, Jul 6, 2020 at 10:43 AM Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
>
> On Mon, Jul 6, 2020 at 10:39 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > On Mon, Jul 06, 2020 at 09:09:55AM +0200, Sedat Dilek wrote:
> > > [ Please CC me I am not subscribed to this mailing-list ]
> > >
> > > Hi Josh and Peter,
> > >
> > > today I switched over from Linux v5.7.y to Linux v5.8-rc4 and built
> > > the first time with GCC version 10 on Debian/testing AMD64.
> > >
> > > $ cat /proc/version
> > > Linux version 5.8.0-rc4-1-amd64-gcc10 (sedat.dilek@xxxxxxxxx@iniza)
> > > (gcc-10 (Debian 10.1.0-4) 10.1.0, GNU ld (GNU Binutils for Debian)
> > > 2.34) #1~bullseye+dileks1 SMP 2020-07-06
> > >
> > > I see these objtool warnings (which are new to me):
> > >
> > > $ grep warning: build-log_5.8.0-rc4-1-amd64-gcc10.txt | sort
> > > arch/x86/kernel/cpu/mce/core.o: warning: objtool: mce_panic()+0x118: unreachable instruction
> > > drivers/atm/horizon.o: warning: objtool: interrupt_handler()+0x19f: unreachable instruction
> > > drivers/message/fusion/mptbase.o: warning: objtool: mpt_Soft_Hard_ResetHandler()+0x33a: unreachable instruction
> > > drivers/scsi/aic7xxx/aic79xx_core.o: warning: objtool: ahd_intr.part.0()+0x10f: unreachable instruction
> > > drivers/scsi/pcmcia/aha152x_core.o: warning: objtool: run()+0x4c0: unreachable instruction
> > > fs/btrfs/backref.o: warning: objtool: btrfs_backref_finish_upper_links()+0x309: unreachable instruction
> > > fs/btrfs/extent_io.o: warning: objtool: __set_extent_bit.cold()+0xc: unreachable instruction
> > > fs/btrfs/relocation.o: warning: objtool: update_backref_cache.part.0()+0x1de: unreachable instruction
> > > kernel/exit.o: warning: objtool: __x64_sys_exit_group()+0x14: unreachable instruction
> > > net/core/skbuff.o: warning: objtool: skb_push.cold()+0x15: unreachable instruction
> >
> > That's more CONFIG_LIVEPATCH=y wreckage I expect. The problem is that
> > GCC -flive-patching= thing wreck the propagation of the noreturn.
> >
> > This really is a compiler issue and we've not managed a sensible
> > work-around in objtool.
>
> Thanks for the quick response.
>
> I have...
>
> CONFIG_LIVEPATCH=y
>
> ...and see in my build-log:
>
> -flive-patching=inline-clone
>
> - Sedat -

OK, I found some discussions in "Re: linux-next: Tree for May 21
(objtool warnings)" [1].

GCC docs say [2]:
- BOQ (Begin Of Quote) -
[ -flive-patching=level ]

The level argument should be one of the following:

[ âinline-cloneâ ]

Only enable inlining and cloning optimizations, which includes
inlining, cloning, interprocedural scalar replacement of aggregates
and partial inlining. As a result, when patching a function, all its
callers and its clonesâ callers are impacted, therefore need to be
patched as well.

-flive-patching=inline-clone disables the following optimization flags:

-fwhole-program -fipa-pta -fipa-reference -fipa-ra
-fipa-icf -fipa-icf-functions -fipa-icf-variables
-fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable
-fipa-stack-alignment

[ âinline-only-staticâ ]

Only enable inlining of static functions. As a result, when patching a
static function, all its callers are impacted and so need to be
patched as well.

In addition to all the flags that -flive-patching=inline-clone
disables, -flive-patching=inline-only-static disables the following
additional optimization flags:

-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp

When -flive-patching is specified without any value, the default value
is inline-clone.

This flag is disabled by default.

Note that -flive-patching is not supported with link-time optimization (-flto).
- EOQ (End of Quote) -

Josh says in [3]:

> The issue here is that with -fno-ipa-pure-const, GCC no longer
> automatically detects that the static inline function is noreturn, so it
> emits unreachable instructions after a call to it.

- Sedat -

[1] https://marc.info/?t=159011496400002&r=1&w=2
[2] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
[3] https://marc.info/?l=linux-next&m=159059217601108&w=2