public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sergei Trofimovich <slyfox@gentoo.org>
To: u-boot@lists.denx.de
Subject: [PATCH] include: fix 'ulong' definition on musl targets
Date: Mon, 30 Dec 2019 11:38:48 +0000	[thread overview]
Message-ID: <20191230113848.0a440f58@sf> (raw)
In-Reply-To: <CAK7LNATxTCXh_d6hMbC-s60c3vKtEXvXH180Si1orrCvSU_h8g@mail.gmail.com>

On Mon, 30 Dec 2019 20:24:08 +0900
Masahiro Yamada <masahiroy@kernel.org> wrote:

> On Tue, Dec 17, 2019 at 9:37 PM Sergei Trofimovich <slyfox@gentoo.org> wrote:
> >
> > The build failure was originally reported on arm64-musl
> > target at https://bugs.gentoo.org/703132. Here is the amd64-musl
> > variant:
> >
> > ```
> > $ LANG=C make CROSS_COMPILE=x86_64-gentoo-linux-musl- tools-only_defconfig -j$(nproc)
> > $ LANG=C make CROSS_COMPILE=x86_64-gentoo-linux-musl- tools-all            -j$(nproc)
> > ...
> > In file included from tools/env/../../env/flags.c:7,
> >                  from tools/env/env_flags.c:1:
> > include/env.h:159:1: error: unknown type name 'ulong'; did you mean 'long'?
> >   159 | ulong env_get_ulong(const char *name, int base, ulong default_val);
> >       | ^~~~~
> >       | long
> > ```
> >
> > Note: 'ulong' is not defined there.
> >
> > On glibc 'ulong' comes from <sys/types.h>:
> >
> > ```c
> > /* Old compatibility names for C types.  */
> > typedef unsigned long int ulong;
> > ```
> >
> > On musl it comes from <sys/types.h> as well but from under different guards:
> >
> > ```c
> > typedef unsigned long u_long, ulong;
> > ```
> >
> > The change inlines 'ulong' define similar to 'uint' define.
> >
> > Bug: https://bugs.gentoo.org/703132
> > Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
> > ---
> >  include/compiler.h   | 2 +-
> >  include/u-boot/crc.h | 2 ++
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/compiler.h b/include/compiler.h
> > index 29507f9840..90372f239c 100644
> > --- a/include/compiler.h
> > +++ b/include/compiler.h
> > @@ -46,7 +46,6 @@
> >  # include <byteswap.h>
> >  #elif defined(__MACH__) || defined(__FreeBSD__)
> >  # include <machine/endian.h>
> > -typedef unsigned long ulong;
> >  #endif
> >  #ifdef __FreeBSD__
> >  # include <sys/endian.h> /* htole32 and friends */
> > @@ -66,6 +65,7 @@ typedef uint8_t __u8;
> >  typedef uint16_t __u16;
> >  typedef uint32_t __u32;
> >  typedef unsigned int uint;
> > +typedef unsigned long ulong;
> >
> >  #define uswap_16(x) \
> >         ((((x) & 0xff00) >> 8) | \
> > diff --git a/include/u-boot/crc.h b/include/u-boot/crc.h
> > index 1086d2168c..b96b50d98b 100644
> > --- a/include/u-boot/crc.h
> > +++ b/include/u-boot/crc.h
> > @@ -8,6 +8,8 @@
> >  #ifndef _UBOOT_CRC_H
> >  #define _UBOOT_CRC_H
> >
> > +#include <compiler.h> /* unit definition */
> > +
> >  /**
> >   * crc8() - Calculate and return CRC-8 of the data
> >   *  
> 
> 
> From the build log, 'ulong' in include/env.h is causing the error.
> So, 664689f1dcb178ccb36842d0564ea8a6e8a7e648
> added <compiler.h> to it.
> 
> 
> I do not see 'ulong' in include/u-boot/crc.h at all.
> Why do you need to touch include/u-boot/crc.h ?

Oh, I forgot to post another build failure in commit message:

```
include/u-boot/crc.h:37:44: error: unknown type name 'uint'; did you mean 'int'?
   37 | void crc16_ccitt_wd_buf(const uint8_t *in, uint len,
      |                                            ^~~~
      |                                            int
```

-- 

  Sergei

  reply	other threads:[~2019-12-30 11:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 23:36 [PATCH] include: fix 'ulong' definition on musl targets Sergei Trofimovich
2019-12-30 11:24 ` Masahiro Yamada
2019-12-30 11:38   ` Sergei Trofimovich [this message]
2019-12-30 12:16     ` Masahiro Yamada
2019-12-30 15:53       ` [PATCH v2 1/2] " Sergei Trofimovich
2019-12-30 15:53         ` [PATCH v2 2/2] include/u-boot/crc.h: pull 'uint' " Sergei Trofimovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191230113848.0a440f58@sf \
    --to=slyfox@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox