Re: warning: objtool: fn1 uses BP as a scratch register

From: Josh Poimboeuf
Date: Fri Jul 19 2019 - 14:31:30 EST


On Fri, Jul 19, 2019 at 11:23:16AM -0700, Nick Desaulniers wrote:
> On Fri, Jul 19, 2019 at 11:10 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> >
> > A lot of objtool fixes showed up in linux-next, so I looked at some
> > remaining ones.
> > This one comes a lot up in some configurations
> >
> > https://godbolt.org/z/ZZLVD-
> >
> > struct ov7670_win_size {
> > int width;
> > int height;
> > };
> > struct ov7670_devtype {
> > struct ov7670_win_size *win_sizes;
> > unsigned n_win_sizes;
> > };
> > struct ov7670_info {
> > int min_width;
> > int min_height;
> > struct ov7670_devtype devtype;
> > } a;
> > int b;
> > int fn1() {
> > struct ov7670_info c = a;
> > int i = 0;
> > for (; i < c.devtype.n_win_sizes; i++) {
> > struct ov7670_win_size d = c.devtype.win_sizes[i];
> > if (c.min_width && d.width < d.height < c.min_height)
> > if (b)
> > return 0;
> > }
> > return 2;
> > }
> >
> > $ clang-8 -O2 -fno-omit-frame-pointer -fno-strict-overflow -c ov7670.i
> > $ objtool check --no-unreachable --uaccess ov7670.o
> > ov7670.o: warning: objtool: fn1 uses BP as a scratch register
>
> Thanks for the report and reduced test case. From the godbolt link, I
> don't see %rbp, %ebp, %bp, or %bpl being referenced (other that %rbp
> in the typical epilogue). Am I missing something? Is objtool maybe
> not reporting the precise function at fault?

I haven't looked, but it could very well be an objtool bug (surprise).

--
Josh