[PATCH 1/3] mbedtls: Introduce subset of compiler-rt from LLVM

Raymond Mao raymond.mao at linaro.org
Fri Jun 20 21:08:22 CEST 2025


Hi Tom,

On Fri, 20 Jun 2025 at 15:00, Tom Rini <trini at konsulko.com> wrote:
>
> On Fri, Jun 20, 2025 at 02:00:09PM -0400, Raymond Mao wrote:
> > Hi Tom,
> >
> > On Fri, 20 Jun 2025 at 13:20, Tom Rini <trini at konsulko.com> wrote:
> > >
> > > On Fri, Jun 20, 2025 at 08:10:08AM -0700, Raymond Mao wrote:
> > > > Introduce the implementation of udivti3 and udivmodti4 from LLVM
> > > > compiler-rt builtins for building MbedTLS bignum module via Clang.
> > > >
> > > > Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
> > > > ---
> > > >  lib/mbedtls/port/compiler-rt/LICENSE.TXT      | 311 ++++++++++++++++++
> > > >  lib/mbedtls/port/compiler-rt/README.txt       |  11 +
> > > >  .../compiler-rt/lib/builtins/int_endianness.h | 114 +++++++
> > > >  .../port/compiler-rt/lib/builtins/int_lib.h   | 171 ++++++++++
> > > >  .../port/compiler-rt/lib/builtins/int_types.h | 276 ++++++++++++++++
> > > >  .../port/compiler-rt/lib/builtins/int_util.h  |  47 +++
> > > >  .../compiler-rt/lib/builtins/udivmodti4.c     | 158 +++++++++
> > > >  .../port/compiler-rt/lib/builtins/udivti3.c   |  23 ++
> > > >  8 files changed, 1111 insertions(+)
> > > >  create mode 100644 lib/mbedtls/port/compiler-rt/LICENSE.TXT
> > > >  create mode 100644 lib/mbedtls/port/compiler-rt/README.txt
> > > >  create mode 100644 lib/mbedtls/port/compiler-rt/lib/builtins/int_endianness.h
> > > >  create mode 100644 lib/mbedtls/port/compiler-rt/lib/builtins/int_lib.h
> > > >  create mode 100644 lib/mbedtls/port/compiler-rt/lib/builtins/int_types.h
> > > >  create mode 100644 lib/mbedtls/port/compiler-rt/lib/builtins/int_util.h
> > > >  create mode 100644 lib/mbedtls/port/compiler-rt/lib/builtins/udivmodti4.c
> > > >  create mode 100644 lib/mbedtls/port/compiler-rt/lib/builtins/udivti3.c
> > > >
> > > > diff --git a/lib/mbedtls/port/compiler-rt/LICENSE.TXT b/lib/mbedtls/port/compiler-rt/LICENSE.TXT
> > > > new file mode 100644
> > > > index 00000000000..5a79a1b9d5c
> > > > --- /dev/null
> > > > +++ b/lib/mbedtls/port/compiler-rt/LICENSE.TXT
> > > > @@ -0,0 +1,311 @@
> > > > +==============================================================================
> > > > +The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
> > > > +==============================================================================
> > > > +
> > > > +                                 Apache License
> > > > +                           Version 2.0, January 2004
> > > > +                        http://www.apache.org/licenses/
> > >
> > > I don't know that this is compatible for us. Looking at
> > > https://www.apache.org/licenses/GPL-compatibility.html it talks about
> > > how you can use it with GPLv3 (which we are *NOT*) but not GPLv2.
> > >
> > My bad didn't realize Apache 2.0 is not compatible with GPLv2...
> > I am not sure but it seems that this incompatibility does not even
> > allow static linking into a GPLv2 project.
> > Then, how to make it possible to use LLVM? Can we upgrade to GPLv2+?
>
> However the linux kernel people do it, we can do it too. And perhaps
> that's part of what's motivating LLVM to be able to disable these
> intrinsics that we don't actually need?
>
OP-TEE did the same thing, it is GPLv2 too.

Raymond


> --
> Tom


More information about the U-Boot mailing list