[libcamera-devel] [PATCH] libcamera: base: Remove ARM clang-11 compile error

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Jul 13 03:44:13 CEST 2022


Hi Naush,

On Tue, Jul 12, 2022 at 03:38:53PM +0100, Naushir Patuck via libcamera-devel wrote:
> On Tue, 12 Jul 2022 at 15:24, Jacopo Mondi wrote:
> > On Tue, Jul 12, 2022 at 02:01:38PM +0100, Naushir Patuck via libcamera-devel wrote:
> > > Compiling backtrace.cpp produces the follwing error with the ARM clang-11 (and
> > > later) compiler:
> >
> > Let's add "on arm32 systems"
> 
> Sure, no problem.  Presumably this can be done while applying?

Absolutely. I'll s/ARM/ARM32/ here and in the subject line, and will
also fix the "follwing" typo.

> > >
> > > --------------------
> > > ../src/libcamera/base/backtrace.cpp:195:12: error: use of SP or PC in the list is deprecated [-Werror,-Winline-asm]
> > >         int ret = unw_getcontext(&uc);
> > >                   ^
> > > /usr/include/arm-linux-gnueabihf/libunwind-common.h:114:29: note: expanded from macro 'unw_getcontext'
> > >                                         ^
> > > /usr/include/arm-linux-gnueabihf/libunwind-arm.h:270:5: note: expanded
> > from macro 'unw_tdep_getcontext'
> > >     "stmia %[base], {r0-r15}"                                           \
> > >     ^
> > > <inline asm>:1:2: note: instantiated into assembly here
> > >         stmia r0, {r0-r15}
> > > --------------------
> > >
> > > Suppress this compilation error with a clang specific pragma around the
> > > offending statements.
> > >
> > > Further information about this error can be found here:
> > > https://github.com/dotnet/runtime/issues/5
> > >

And I'll add

Bug: https://bugs.libcamera.org/show_bug.cgi?id=136

> > > Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> >
> > Great, it fixes the build indeed!
> >
> > Tested-by: Jacopo Mondi <jacopo at jmondi.org>
> >
> > > ---
> > >  src/libcamera/base/backtrace.cpp | 10 ++++++++++
> > >  1 file changed, 10 insertions(+)
> > >
> > > diff --git a/src/libcamera/base/backtrace.cpp b/src/libcamera/base/backtrace.cpp
> > > index 483492c390c3..b8ae2f6dc331 100644
> > > --- a/src/libcamera/base/backtrace.cpp
> > > +++ b/src/libcamera/base/backtrace.cpp
> > > @@ -191,11 +191,21 @@ __attribute__((__noinline__))
> > >  bool Backtrace::unwindTrace()
> > >  {
> > >  #if HAVE_UNWIND
> > > +
> > > +#if __clang__
> > > +#pragma clang diagnostic push
> > > +#pragma clang diagnostic ignored "-Winline-asm"
> > > +#endif
> > > +
> > >       unw_context_t uc;
> > >       int ret = unw_getcontext(&uc);
> > >       if (ret)
> > >               return false;
> > >
> > > +#if __clang__
> > > +#pragma clang diagnostic pop
> > > +#endif
> > > +
> > >       unw_cursor_t cursor;
> > >       ret = unw_init_local(&cursor, &uc);
> > >       if (ret)

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list