History log of /u-boot/include/compiler.h
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# c9d6b5b5 25-Sep-2021 Simon Glass <sjg@chromium.org>

compiler: Rename host_build() to tools_build()

With the new TOOLS_LIBCRYPTO and some other changes, it seems that we are
heading towards calling this a tools build rather than a host build,
although of course it does happen on the host.

I cannot think of anything built by the host which cannot be described as
a tool, so rename this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 5a4f10d7 25-Sep-2021 Simon Glass <sjg@chromium.org>

gzip: Avoid use of u64

The gzip API uses the u64 type in it, which is not available in the host
build. This makes it impossible to include the header file.

We could make this type available, but it seems unnecessary. Limiting the
compression size to that of the 'unsigned long' type seems good enough. On
32-bit machines the limit then becomes 4GB, which likely exceeds available
RAM anyway, therefore it should be sufficient. On 64-bit machines this is
effectively u64 anyway.

Update the header file and implementation to use 'ulong' instead of 'u64'.

Add a definition of u32 for the cases that seem to need exactly that
length. This should be safe enough.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c45b7920 25-Sep-2021 Simon Glass <sjg@chromium.org>

compiler: Add a comment to host_build()

This function should have a comment explaining what it does. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# db43c0b7 14-Dec-2020 Sebastian Reichel <sebastian.reichel@collabora.com>

compiler.h: add host_build()

Add a host_build() function, so that it's possible to
check for software being build with USE_HOSTCC without
relying on preprocessor conditions. In other words

#ifdef USE_HOSTCC
host_only_code();
#endif

can be written like this instead:

if (host_build())
host_only_code();

This improves code readability and test coverage and
compiler will eleminate this unreachable code.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3428faf2 02-Jun-2020 Simon Glass <sjg@chromium.org>

Update MEM_SUPPORT_64BIT_DATA to be always defined

Define this macro always so we don't need the preprocessor to check it.
Convert the users to #if instead of #ifdef.

Note that '#if MEM_SUPPORT_64BIT_DATA' does not give an error if the
macro is not define. It just assumes zero.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 4d979bfd 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATA

This is not really a CONFIG since it is not intended to be set by boards.
Move it into the compiler header with other similar defines, and rename
it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d11fa9c1 30-Dec-2019 Sergei Trofimovich <slyfox@gentoo.org>

include: fix 'ulong' definition on musl targets

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>

# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# f29aa23b 29-Jan-2018 Justin Hibbits <chmeeedalf@gmail.com>

Fix FreeBSD endian checks

FreeBSD, like OpenBSD, uses BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER,
whereas Linux and compatibles use __-prefixed names. Define the names
the same as the OpenBSD block below it.

# fd184b9c 25-Nov-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use u-boot endian macros on OpenBSD

When building u-boot on sparc64 and powerpc hosts it became clear that
u-boot expects endian conversion defines to be macros:

lib/crc32.c:87: error: braced-group within expression allowed only inside a function

For OpenBSD switch from using system definitions equivalent to the u-boot ones
and define glibc __BYTE_ORDER __BIG_ENDIAN __LITTLE_ENDIAN names, as at least
some parts of the non-cross build assumes those names are present (ie crc32.c).

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 3715a540 02-Sep-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use system endian macros on OpenBSD

The u-boot endian macros map directly to system endian
macros on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 2e680f92 15-Dec-2015 York Sun <yorksun@freescale.com>

Revert "include/linux: move typdef for uintptr_t"

This reverts commit e8f954a756a825130d11b9c8fca70101dd8b3ac5, which
causes compiling errors on 32-bit hosts.

Acked-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Signed-off-by: York Sun <yorksun@freescale.com>

# e8f954a7 08-Dec-2015 Aneesh Bansal <aneesh.bansal@freescale.com>

include/linux: move typdef for uintptr_t

uintptr_t which is a typdef for unsigned long is needed for creating
pointers (32 or 64 bit depending on Core) from 32 bit variables
storing the address.
If a 32 bit variable (u32) is typecasted to a pointer (void *),
compiler gives a warning in case size of pointer on the core is 64 bit.

The typdef has been moved from include/compiler.h to include/linux/types.h

Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>

# ed8271d1 07-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: Fix build on FreeBSD

Commit 832472 "tools: socfpga: Add socfpga preloader signing
to mkimage" added tools/socfpga.c which relies on htole32,
le32toh and friends. While compiler.h includes these protypes
for linux from endian.h, it doesn't do so for FreeBSD. Hence
include <sys/endian.h> for FreeBSD.

Cc: Marek Vasut <marex@denx.de>
CC: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 87f13aa0 17-Sep-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

compiler.h: remove duplicated uninitialized_var

Since clang has a different definition for uninitialized_var
it will complain that it is redefined in include/compiler.h.
Since these are already defined in linux/compiler.h just remove
this instance.

Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 9d16e93d 25-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: add missing time.h

genimg_print_time uses time_t, but time.h is never included.
Linux gets away with this since types.h includes time.h.
Explicitly include the header file so building on e.g. FreeBSD
also works.

cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c9502f49 04-Nov-2011 Simon Glass <sjg@chromium.org>

Define uintptr_t as long int to simplify printf() format strings

If uintptr_t can be either an unsigned int or an unsigned long int, it is
tricky to use it in a printf() format string. This changes it to
unsigned long int consistently. This should do the right thing on both
32-bit and 64-bit architectures.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# a7551a3f 23-Sep-2011 Simon Glass <sjg@chromium.org>

sandbox: Add compiler defines to support a 64-bit x86_64 platform

This sets __WORDSIZE to 8 correctly on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5bce5dc3 19-Jul-2011 Jeroen Hofstee <jeroen@myspectrum.nl>

include/compiler.h: typedef ulong for FreeBSD

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 59336459 25-Sep-2010 Andreas Bießmann <andreas.devel@googlemail.com>

include/compiler.h: remove uint typedef for __MACH__

uint is typedefed twice if __MACH__ is defined. This generates an error
when calling MAKEALL for netstar bord on OS X.

This patch removes the typedef for __MACH__ case in favor of general
definiton some lines below.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 9312bba0 19-Jun-2010 Wolfgang Denk <wd@denx.de>

include/compiler.h: remove redundant declaration of errno

Commit 37566090 "compiler.h: unify system ifdef cruft here" added both
a "#include <errno.h>" and a "extern int errno;" to include/compiler.h
which is causing build warnings for some systems, for example for the
"netstar" board:

In file included from /home/wd/git/u-boot/work/lib/crc32.c:15:
include/compiler.h:28: warning: function declaration isn't a prototype

The declaration of "errno" should be redundant, as <errno.h> is
supposed to provide a correct declaration, so drop it.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>

# b050c72d 20-Apr-2010 Mike Frysinger <vapier@gentoo.org>

compiler.h: add uint typedef

Recent crc changes started using the "uint" type in headers that are used
on the build system. This subsequently broke mingw targets as they do not
provide such a type. So add this basic typedef to compiler.h so that we
do not have to worry about this breaking again in the future.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# b63815e3 22-Dec-2009 Matthias Kaehlcke <matthias@kaehlcke.net>

move definition of macros likely and unlikely to compiler.h

the macros likely and unlikely were defined in include/linux/mtd/compat.h,
but used in code not related to MTD. moved the macro definitions to compiler.h

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>

# d8bc55a6 01-Sep-2009 Anton Vorontsov <avorontsov@ru.mvista.com>

Move uninitialized_var() macro from ubi_uboot.h to compiler.h

This is needed so that we could use this macro for non-UBI code.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>

# 37566090 02-Jul-2009 Mike Frysinger <vapier@gentoo.org>

compiler.h: unify system ifdef cruft here

Shove a lot of the HOSTCC and related #ifdef checking crap into the new
compiler.h header so that we can keep all other headers nice and clean.

Also introduce custom uswap functions so we don't have to rely on the non
standard implementations that a host may (or may not in the case of OS X)
provide. This allows mkimage to finally build cleanly on an OS X system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# c9d6b5b5 25-Sep-2021 Simon Glass <sjg@chromium.org>

compiler: Rename host_build() to tools_build()

With the new TOOLS_LIBCRYPTO and some other changes, it seems that we are
heading towards calling this a tools build rather than a host build,
although of course it does happen on the host.

I cannot think of anything built by the host which cannot be described as
a tool, so rename this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 5a4f10d7 25-Sep-2021 Simon Glass <sjg@chromium.org>

gzip: Avoid use of u64

The gzip API uses the u64 type in it, which is not available in the host
build. This makes it impossible to include the header file.

We could make this type available, but it seems unnecessary. Limiting the
compression size to that of the 'unsigned long' type seems good enough. On
32-bit machines the limit then becomes 4GB, which likely exceeds available
RAM anyway, therefore it should be sufficient. On 64-bit machines this is
effectively u64 anyway.

Update the header file and implementation to use 'ulong' instead of 'u64'.

Add a definition of u32 for the cases that seem to need exactly that
length. This should be safe enough.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c45b7920 25-Sep-2021 Simon Glass <sjg@chromium.org>

compiler: Add a comment to host_build()

This function should have a comment explaining what it does. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# db43c0b7 14-Dec-2020 Sebastian Reichel <sebastian.reichel@collabora.com>

compiler.h: add host_build()

Add a host_build() function, so that it's possible to
check for software being build with USE_HOSTCC without
relying on preprocessor conditions. In other words

#ifdef USE_HOSTCC
host_only_code();
#endif

can be written like this instead:

if (host_build())
host_only_code();

This improves code readability and test coverage and
compiler will eleminate this unreachable code.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3428faf2 02-Jun-2020 Simon Glass <sjg@chromium.org>

Update MEM_SUPPORT_64BIT_DATA to be always defined

Define this macro always so we don't need the preprocessor to check it.
Convert the users to #if instead of #ifdef.

Note that '#if MEM_SUPPORT_64BIT_DATA' does not give an error if the
macro is not define. It just assumes zero.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 4d979bfd 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATA

This is not really a CONFIG since it is not intended to be set by boards.
Move it into the compiler header with other similar defines, and rename
it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d11fa9c1 30-Dec-2019 Sergei Trofimovich <slyfox@gentoo.org>

include: fix 'ulong' definition on musl targets

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>

# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# f29aa23b 29-Jan-2018 Justin Hibbits <chmeeedalf@gmail.com>

Fix FreeBSD endian checks

FreeBSD, like OpenBSD, uses BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER,
whereas Linux and compatibles use __-prefixed names. Define the names
the same as the OpenBSD block below it.

# fd184b9c 25-Nov-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use u-boot endian macros on OpenBSD

When building u-boot on sparc64 and powerpc hosts it became clear that
u-boot expects endian conversion defines to be macros:

lib/crc32.c:87: error: braced-group within expression allowed only inside a function

For OpenBSD switch from using system definitions equivalent to the u-boot ones
and define glibc __BYTE_ORDER __BIG_ENDIAN __LITTLE_ENDIAN names, as at least
some parts of the non-cross build assumes those names are present (ie crc32.c).

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 3715a540 02-Sep-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use system endian macros on OpenBSD

The u-boot endian macros map directly to system endian
macros on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 2e680f92 15-Dec-2015 York Sun <yorksun@freescale.com>

Revert "include/linux: move typdef for uintptr_t"

This reverts commit e8f954a756a825130d11b9c8fca70101dd8b3ac5, which
causes compiling errors on 32-bit hosts.

Acked-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Signed-off-by: York Sun <yorksun@freescale.com>

# e8f954a7 08-Dec-2015 Aneesh Bansal <aneesh.bansal@freescale.com>

include/linux: move typdef for uintptr_t

uintptr_t which is a typdef for unsigned long is needed for creating
pointers (32 or 64 bit depending on Core) from 32 bit variables
storing the address.
If a 32 bit variable (u32) is typecasted to a pointer (void *),
compiler gives a warning in case size of pointer on the core is 64 bit.

The typdef has been moved from include/compiler.h to include/linux/types.h

Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>

# ed8271d1 07-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: Fix build on FreeBSD

Commit 832472 "tools: socfpga: Add socfpga preloader signing
to mkimage" added tools/socfpga.c which relies on htole32,
le32toh and friends. While compiler.h includes these protypes
for linux from endian.h, it doesn't do so for FreeBSD. Hence
include <sys/endian.h> for FreeBSD.

Cc: Marek Vasut <marex@denx.de>
CC: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 87f13aa0 17-Sep-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

compiler.h: remove duplicated uninitialized_var

Since clang has a different definition for uninitialized_var
it will complain that it is redefined in include/compiler.h.
Since these are already defined in linux/compiler.h just remove
this instance.

Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 9d16e93d 25-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: add missing time.h

genimg_print_time uses time_t, but time.h is never included.
Linux gets away with this since types.h includes time.h.
Explicitly include the header file so building on e.g. FreeBSD
also works.

cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c9502f49 04-Nov-2011 Simon Glass <sjg@chromium.org>

Define uintptr_t as long int to simplify printf() format strings

If uintptr_t can be either an unsigned int or an unsigned long int, it is
tricky to use it in a printf() format string. This changes it to
unsigned long int consistently. This should do the right thing on both
32-bit and 64-bit architectures.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# a7551a3f 23-Sep-2011 Simon Glass <sjg@chromium.org>

sandbox: Add compiler defines to support a 64-bit x86_64 platform

This sets __WORDSIZE to 8 correctly on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5bce5dc3 19-Jul-2011 Jeroen Hofstee <jeroen@myspectrum.nl>

include/compiler.h: typedef ulong for FreeBSD

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 59336459 25-Sep-2010 Andreas Bießmann <andreas.devel@googlemail.com>

include/compiler.h: remove uint typedef for __MACH__

uint is typedefed twice if __MACH__ is defined. This generates an error
when calling MAKEALL for netstar bord on OS X.

This patch removes the typedef for __MACH__ case in favor of general
definiton some lines below.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 9312bba0 19-Jun-2010 Wolfgang Denk <wd@denx.de>

include/compiler.h: remove redundant declaration of errno

Commit 37566090 "compiler.h: unify system ifdef cruft here" added both
a "#include <errno.h>" and a "extern int errno;" to include/compiler.h
which is causing build warnings for some systems, for example for the
"netstar" board:

In file included from /home/wd/git/u-boot/work/lib/crc32.c:15:
include/compiler.h:28: warning: function declaration isn't a prototype

The declaration of "errno" should be redundant, as <errno.h> is
supposed to provide a correct declaration, so drop it.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>

# b050c72d 20-Apr-2010 Mike Frysinger <vapier@gentoo.org>

compiler.h: add uint typedef

Recent crc changes started using the "uint" type in headers that are used
on the build system. This subsequently broke mingw targets as they do not
provide such a type. So add this basic typedef to compiler.h so that we
do not have to worry about this breaking again in the future.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# b63815e3 22-Dec-2009 Matthias Kaehlcke <matthias@kaehlcke.net>

move definition of macros likely and unlikely to compiler.h

the macros likely and unlikely were defined in include/linux/mtd/compat.h,
but used in code not related to MTD. moved the macro definitions to compiler.h

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>

# d8bc55a6 01-Sep-2009 Anton Vorontsov <avorontsov@ru.mvista.com>

Move uninitialized_var() macro from ubi_uboot.h to compiler.h

This is needed so that we could use this macro for non-UBI code.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>

# 37566090 02-Jul-2009 Mike Frysinger <vapier@gentoo.org>

compiler.h: unify system ifdef cruft here

Shove a lot of the HOSTCC and related #ifdef checking crap into the new
compiler.h header so that we can keep all other headers nice and clean.

Also introduce custom uswap functions so we don't have to rely on the non
standard implementations that a host may (or may not in the case of OS X)
provide. This allows mkimage to finally build cleanly on an OS X system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# db43c0b7 14-Dec-2020 Sebastian Reichel <sebastian.reichel@collabora.com>

compiler.h: add host_build()

Add a host_build() function, so that it's possible to
check for software being build with USE_HOSTCC without
relying on preprocessor conditions. In other words

#ifdef USE_HOSTCC
host_only_code();
#endif

can be written like this instead:

if (host_build())
host_only_code();

This improves code readability and test coverage and
compiler will eleminate this unreachable code.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3428faf2 02-Jun-2020 Simon Glass <sjg@chromium.org>

Update MEM_SUPPORT_64BIT_DATA to be always defined

Define this macro always so we don't need the preprocessor to check it.
Convert the users to #if instead of #ifdef.

Note that '#if MEM_SUPPORT_64BIT_DATA' does not give an error if the
macro is not define. It just assumes zero.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 4d979bfd 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATA

This is not really a CONFIG since it is not intended to be set by boards.
Move it into the compiler header with other similar defines, and rename
it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d11fa9c1 30-Dec-2019 Sergei Trofimovich <slyfox@gentoo.org>

include: fix 'ulong' definition on musl targets

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>

# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# f29aa23b 29-Jan-2018 Justin Hibbits <chmeeedalf@gmail.com>

Fix FreeBSD endian checks

FreeBSD, like OpenBSD, uses BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER,
whereas Linux and compatibles use __-prefixed names. Define the names
the same as the OpenBSD block below it.

# fd184b9c 25-Nov-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use u-boot endian macros on OpenBSD

When building u-boot on sparc64 and powerpc hosts it became clear that
u-boot expects endian conversion defines to be macros:

lib/crc32.c:87: error: braced-group within expression allowed only inside a function

For OpenBSD switch from using system definitions equivalent to the u-boot ones
and define glibc __BYTE_ORDER __BIG_ENDIAN __LITTLE_ENDIAN names, as at least
some parts of the non-cross build assumes those names are present (ie crc32.c).

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 3715a540 02-Sep-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use system endian macros on OpenBSD

The u-boot endian macros map directly to system endian
macros on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 2e680f92 15-Dec-2015 York Sun <yorksun@freescale.com>

Revert "include/linux: move typdef for uintptr_t"

This reverts commit e8f954a756a825130d11b9c8fca70101dd8b3ac5, which
causes compiling errors on 32-bit hosts.

Acked-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Signed-off-by: York Sun <yorksun@freescale.com>

# e8f954a7 08-Dec-2015 Aneesh Bansal <aneesh.bansal@freescale.com>

include/linux: move typdef for uintptr_t

uintptr_t which is a typdef for unsigned long is needed for creating
pointers (32 or 64 bit depending on Core) from 32 bit variables
storing the address.
If a 32 bit variable (u32) is typecasted to a pointer (void *),
compiler gives a warning in case size of pointer on the core is 64 bit.

The typdef has been moved from include/compiler.h to include/linux/types.h

Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>

# ed8271d1 07-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: Fix build on FreeBSD

Commit 832472 "tools: socfpga: Add socfpga preloader signing
to mkimage" added tools/socfpga.c which relies on htole32,
le32toh and friends. While compiler.h includes these protypes
for linux from endian.h, it doesn't do so for FreeBSD. Hence
include <sys/endian.h> for FreeBSD.

Cc: Marek Vasut <marex@denx.de>
CC: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 87f13aa0 17-Sep-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

compiler.h: remove duplicated uninitialized_var

Since clang has a different definition for uninitialized_var
it will complain that it is redefined in include/compiler.h.
Since these are already defined in linux/compiler.h just remove
this instance.

Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 9d16e93d 25-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: add missing time.h

genimg_print_time uses time_t, but time.h is never included.
Linux gets away with this since types.h includes time.h.
Explicitly include the header file so building on e.g. FreeBSD
also works.

cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c9502f49 04-Nov-2011 Simon Glass <sjg@chromium.org>

Define uintptr_t as long int to simplify printf() format strings

If uintptr_t can be either an unsigned int or an unsigned long int, it is
tricky to use it in a printf() format string. This changes it to
unsigned long int consistently. This should do the right thing on both
32-bit and 64-bit architectures.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# a7551a3f 23-Sep-2011 Simon Glass <sjg@chromium.org>

sandbox: Add compiler defines to support a 64-bit x86_64 platform

This sets __WORDSIZE to 8 correctly on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5bce5dc3 19-Jul-2011 Jeroen Hofstee <jeroen@myspectrum.nl>

include/compiler.h: typedef ulong for FreeBSD

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 59336459 25-Sep-2010 Andreas Bießmann <andreas.devel@googlemail.com>

include/compiler.h: remove uint typedef for __MACH__

uint is typedefed twice if __MACH__ is defined. This generates an error
when calling MAKEALL for netstar bord on OS X.

This patch removes the typedef for __MACH__ case in favor of general
definiton some lines below.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 9312bba0 19-Jun-2010 Wolfgang Denk <wd@denx.de>

include/compiler.h: remove redundant declaration of errno

Commit 37566090 "compiler.h: unify system ifdef cruft here" added both
a "#include <errno.h>" and a "extern int errno;" to include/compiler.h
which is causing build warnings for some systems, for example for the
"netstar" board:

In file included from /home/wd/git/u-boot/work/lib/crc32.c:15:
include/compiler.h:28: warning: function declaration isn't a prototype

The declaration of "errno" should be redundant, as <errno.h> is
supposed to provide a correct declaration, so drop it.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>

# b050c72d 20-Apr-2010 Mike Frysinger <vapier@gentoo.org>

compiler.h: add uint typedef

Recent crc changes started using the "uint" type in headers that are used
on the build system. This subsequently broke mingw targets as they do not
provide such a type. So add this basic typedef to compiler.h so that we
do not have to worry about this breaking again in the future.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# b63815e3 22-Dec-2009 Matthias Kaehlcke <matthias@kaehlcke.net>

move definition of macros likely and unlikely to compiler.h

the macros likely and unlikely were defined in include/linux/mtd/compat.h,
but used in code not related to MTD. moved the macro definitions to compiler.h

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>

# d8bc55a6 01-Sep-2009 Anton Vorontsov <avorontsov@ru.mvista.com>

Move uninitialized_var() macro from ubi_uboot.h to compiler.h

This is needed so that we could use this macro for non-UBI code.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>

# 37566090 02-Jul-2009 Mike Frysinger <vapier@gentoo.org>

compiler.h: unify system ifdef cruft here

Shove a lot of the HOSTCC and related #ifdef checking crap into the new
compiler.h header so that we can keep all other headers nice and clean.

Also introduce custom uswap functions so we don't have to rely on the non
standard implementations that a host may (or may not in the case of OS X)
provide. This allows mkimage to finally build cleanly on an OS X system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 3428faf2 02-Jun-2020 Simon Glass <sjg@chromium.org>

Update MEM_SUPPORT_64BIT_DATA to be always defined

Define this macro always so we don't need the preprocessor to check it.
Convert the users to #if instead of #ifdef.

Note that '#if MEM_SUPPORT_64BIT_DATA' does not give an error if the
macro is not define. It just assumes zero.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 4d979bfd 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATA

This is not really a CONFIG since it is not intended to be set by boards.
Move it into the compiler header with other similar defines, and rename
it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d11fa9c1 30-Dec-2019 Sergei Trofimovich <slyfox@gentoo.org>

include: fix 'ulong' definition on musl targets

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>

# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# f29aa23b 29-Jan-2018 Justin Hibbits <chmeeedalf@gmail.com>

Fix FreeBSD endian checks

FreeBSD, like OpenBSD, uses BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER,
whereas Linux and compatibles use __-prefixed names. Define the names
the same as the OpenBSD block below it.

# fd184b9c 25-Nov-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use u-boot endian macros on OpenBSD

When building u-boot on sparc64 and powerpc hosts it became clear that
u-boot expects endian conversion defines to be macros:

lib/crc32.c:87: error: braced-group within expression allowed only inside a function

For OpenBSD switch from using system definitions equivalent to the u-boot ones
and define glibc __BYTE_ORDER __BIG_ENDIAN __LITTLE_ENDIAN names, as at least
some parts of the non-cross build assumes those names are present (ie crc32.c).

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 3715a540 02-Sep-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use system endian macros on OpenBSD

The u-boot endian macros map directly to system endian
macros on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 2e680f92 15-Dec-2015 York Sun <yorksun@freescale.com>

Revert "include/linux: move typdef for uintptr_t"

This reverts commit e8f954a756a825130d11b9c8fca70101dd8b3ac5, which
causes compiling errors on 32-bit hosts.

Acked-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Signed-off-by: York Sun <yorksun@freescale.com>

# e8f954a7 08-Dec-2015 Aneesh Bansal <aneesh.bansal@freescale.com>

include/linux: move typdef for uintptr_t

uintptr_t which is a typdef for unsigned long is needed for creating
pointers (32 or 64 bit depending on Core) from 32 bit variables
storing the address.
If a 32 bit variable (u32) is typecasted to a pointer (void *),
compiler gives a warning in case size of pointer on the core is 64 bit.

The typdef has been moved from include/compiler.h to include/linux/types.h

Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>

# ed8271d1 07-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: Fix build on FreeBSD

Commit 832472 "tools: socfpga: Add socfpga preloader signing
to mkimage" added tools/socfpga.c which relies on htole32,
le32toh and friends. While compiler.h includes these protypes
for linux from endian.h, it doesn't do so for FreeBSD. Hence
include <sys/endian.h> for FreeBSD.

Cc: Marek Vasut <marex@denx.de>
CC: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 87f13aa0 17-Sep-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

compiler.h: remove duplicated uninitialized_var

Since clang has a different definition for uninitialized_var
it will complain that it is redefined in include/compiler.h.
Since these are already defined in linux/compiler.h just remove
this instance.

Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 9d16e93d 25-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: add missing time.h

genimg_print_time uses time_t, but time.h is never included.
Linux gets away with this since types.h includes time.h.
Explicitly include the header file so building on e.g. FreeBSD
also works.

cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c9502f49 04-Nov-2011 Simon Glass <sjg@chromium.org>

Define uintptr_t as long int to simplify printf() format strings

If uintptr_t can be either an unsigned int or an unsigned long int, it is
tricky to use it in a printf() format string. This changes it to
unsigned long int consistently. This should do the right thing on both
32-bit and 64-bit architectures.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# a7551a3f 23-Sep-2011 Simon Glass <sjg@chromium.org>

sandbox: Add compiler defines to support a 64-bit x86_64 platform

This sets __WORDSIZE to 8 correctly on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5bce5dc3 19-Jul-2011 Jeroen Hofstee <jeroen@myspectrum.nl>

include/compiler.h: typedef ulong for FreeBSD

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 59336459 25-Sep-2010 Andreas Bießmann <andreas.devel@googlemail.com>

include/compiler.h: remove uint typedef for __MACH__

uint is typedefed twice if __MACH__ is defined. This generates an error
when calling MAKEALL for netstar bord on OS X.

This patch removes the typedef for __MACH__ case in favor of general
definiton some lines below.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 9312bba0 19-Jun-2010 Wolfgang Denk <wd@denx.de>

include/compiler.h: remove redundant declaration of errno

Commit 37566090 "compiler.h: unify system ifdef cruft here" added both
a "#include <errno.h>" and a "extern int errno;" to include/compiler.h
which is causing build warnings for some systems, for example for the
"netstar" board:

In file included from /home/wd/git/u-boot/work/lib/crc32.c:15:
include/compiler.h:28: warning: function declaration isn't a prototype

The declaration of "errno" should be redundant, as <errno.h> is
supposed to provide a correct declaration, so drop it.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>

# b050c72d 20-Apr-2010 Mike Frysinger <vapier@gentoo.org>

compiler.h: add uint typedef

Recent crc changes started using the "uint" type in headers that are used
on the build system. This subsequently broke mingw targets as they do not
provide such a type. So add this basic typedef to compiler.h so that we
do not have to worry about this breaking again in the future.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# b63815e3 22-Dec-2009 Matthias Kaehlcke <matthias@kaehlcke.net>

move definition of macros likely and unlikely to compiler.h

the macros likely and unlikely were defined in include/linux/mtd/compat.h,
but used in code not related to MTD. moved the macro definitions to compiler.h

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>

# d8bc55a6 01-Sep-2009 Anton Vorontsov <avorontsov@ru.mvista.com>

Move uninitialized_var() macro from ubi_uboot.h to compiler.h

This is needed so that we could use this macro for non-UBI code.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>

# 37566090 02-Jul-2009 Mike Frysinger <vapier@gentoo.org>

compiler.h: unify system ifdef cruft here

Shove a lot of the HOSTCC and related #ifdef checking crap into the new
compiler.h header so that we can keep all other headers nice and clean.

Also introduce custom uswap functions so we don't have to rely on the non
standard implementations that a host may (or may not in the case of OS X)
provide. This allows mkimage to finally build cleanly on an OS X system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 4d979bfd 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATA

This is not really a CONFIG since it is not intended to be set by boards.
Move it into the compiler header with other similar defines, and rename
it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d11fa9c1 30-Dec-2019 Sergei Trofimovich <slyfox@gentoo.org>

include: fix 'ulong' definition on musl targets

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>

# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# f29aa23b 29-Jan-2018 Justin Hibbits <chmeeedalf@gmail.com>

Fix FreeBSD endian checks

FreeBSD, like OpenBSD, uses BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER,
whereas Linux and compatibles use __-prefixed names. Define the names
the same as the OpenBSD block below it.

# fd184b9c 25-Nov-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use u-boot endian macros on OpenBSD

When building u-boot on sparc64 and powerpc hosts it became clear that
u-boot expects endian conversion defines to be macros:

lib/crc32.c:87: error: braced-group within expression allowed only inside a function

For OpenBSD switch from using system definitions equivalent to the u-boot ones
and define glibc __BYTE_ORDER __BIG_ENDIAN __LITTLE_ENDIAN names, as at least
some parts of the non-cross build assumes those names are present (ie crc32.c).

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 3715a540 02-Sep-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use system endian macros on OpenBSD

The u-boot endian macros map directly to system endian
macros on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 2e680f92 15-Dec-2015 York Sun <yorksun@freescale.com>

Revert "include/linux: move typdef for uintptr_t"

This reverts commit e8f954a756a825130d11b9c8fca70101dd8b3ac5, which
causes compiling errors on 32-bit hosts.

Acked-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Signed-off-by: York Sun <yorksun@freescale.com>

# e8f954a7 08-Dec-2015 Aneesh Bansal <aneesh.bansal@freescale.com>

include/linux: move typdef for uintptr_t

uintptr_t which is a typdef for unsigned long is needed for creating
pointers (32 or 64 bit depending on Core) from 32 bit variables
storing the address.
If a 32 bit variable (u32) is typecasted to a pointer (void *),
compiler gives a warning in case size of pointer on the core is 64 bit.

The typdef has been moved from include/compiler.h to include/linux/types.h

Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>

# ed8271d1 07-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: Fix build on FreeBSD

Commit 832472 "tools: socfpga: Add socfpga preloader signing
to mkimage" added tools/socfpga.c which relies on htole32,
le32toh and friends. While compiler.h includes these protypes
for linux from endian.h, it doesn't do so for FreeBSD. Hence
include <sys/endian.h> for FreeBSD.

Cc: Marek Vasut <marex@denx.de>
CC: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 87f13aa0 17-Sep-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

compiler.h: remove duplicated uninitialized_var

Since clang has a different definition for uninitialized_var
it will complain that it is redefined in include/compiler.h.
Since these are already defined in linux/compiler.h just remove
this instance.

Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 9d16e93d 25-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: add missing time.h

genimg_print_time uses time_t, but time.h is never included.
Linux gets away with this since types.h includes time.h.
Explicitly include the header file so building on e.g. FreeBSD
also works.

cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c9502f49 04-Nov-2011 Simon Glass <sjg@chromium.org>

Define uintptr_t as long int to simplify printf() format strings

If uintptr_t can be either an unsigned int or an unsigned long int, it is
tricky to use it in a printf() format string. This changes it to
unsigned long int consistently. This should do the right thing on both
32-bit and 64-bit architectures.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# a7551a3f 23-Sep-2011 Simon Glass <sjg@chromium.org>

sandbox: Add compiler defines to support a 64-bit x86_64 platform

This sets __WORDSIZE to 8 correctly on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5bce5dc3 19-Jul-2011 Jeroen Hofstee <jeroen@myspectrum.nl>

include/compiler.h: typedef ulong for FreeBSD

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 59336459 25-Sep-2010 Andreas Bießmann <andreas.devel@googlemail.com>

include/compiler.h: remove uint typedef for __MACH__

uint is typedefed twice if __MACH__ is defined. This generates an error
when calling MAKEALL for netstar bord on OS X.

This patch removes the typedef for __MACH__ case in favor of general
definiton some lines below.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 9312bba0 19-Jun-2010 Wolfgang Denk <wd@denx.de>

include/compiler.h: remove redundant declaration of errno

Commit 37566090 "compiler.h: unify system ifdef cruft here" added both
a "#include <errno.h>" and a "extern int errno;" to include/compiler.h
which is causing build warnings for some systems, for example for the
"netstar" board:

In file included from /home/wd/git/u-boot/work/lib/crc32.c:15:
include/compiler.h:28: warning: function declaration isn't a prototype

The declaration of "errno" should be redundant, as <errno.h> is
supposed to provide a correct declaration, so drop it.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>

# b050c72d 20-Apr-2010 Mike Frysinger <vapier@gentoo.org>

compiler.h: add uint typedef

Recent crc changes started using the "uint" type in headers that are used
on the build system. This subsequently broke mingw targets as they do not
provide such a type. So add this basic typedef to compiler.h so that we
do not have to worry about this breaking again in the future.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# b63815e3 22-Dec-2009 Matthias Kaehlcke <matthias@kaehlcke.net>

move definition of macros likely and unlikely to compiler.h

the macros likely and unlikely were defined in include/linux/mtd/compat.h,
but used in code not related to MTD. moved the macro definitions to compiler.h

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>

# d8bc55a6 01-Sep-2009 Anton Vorontsov <avorontsov@ru.mvista.com>

Move uninitialized_var() macro from ubi_uboot.h to compiler.h

This is needed so that we could use this macro for non-UBI code.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>

# 37566090 02-Jul-2009 Mike Frysinger <vapier@gentoo.org>

compiler.h: unify system ifdef cruft here

Shove a lot of the HOSTCC and related #ifdef checking crap into the new
compiler.h header so that we can keep all other headers nice and clean.

Also introduce custom uswap functions so we don't have to rely on the non
standard implementations that a host may (or may not in the case of OS X)
provide. This allows mkimage to finally build cleanly on an OS X system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# d11fa9c1 30-Dec-2019 Sergei Trofimovich <slyfox@gentoo.org>

include: fix 'ulong' definition on musl targets

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>

# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# f29aa23b 29-Jan-2018 Justin Hibbits <chmeeedalf@gmail.com>

Fix FreeBSD endian checks

FreeBSD, like OpenBSD, uses BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER,
whereas Linux and compatibles use __-prefixed names. Define the names
the same as the OpenBSD block below it.

# fd184b9c 25-Nov-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use u-boot endian macros on OpenBSD

When building u-boot on sparc64 and powerpc hosts it became clear that
u-boot expects endian conversion defines to be macros:

lib/crc32.c:87: error: braced-group within expression allowed only inside a function

For OpenBSD switch from using system definitions equivalent to the u-boot ones
and define glibc __BYTE_ORDER __BIG_ENDIAN __LITTLE_ENDIAN names, as at least
some parts of the non-cross build assumes those names are present (ie crc32.c).

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 3715a540 02-Sep-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use system endian macros on OpenBSD

The u-boot endian macros map directly to system endian
macros on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>

# 2e680f92 15-Dec-2015 York Sun <yorksun@freescale.com>

Revert "include/linux: move typdef for uintptr_t"

This reverts commit e8f954a756a825130d11b9c8fca70101dd8b3ac5, which
causes compiling errors on 32-bit hosts.

Acked-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Signed-off-by: York Sun <yorksun@freescale.com>

# e8f954a7 08-Dec-2015 Aneesh Bansal <aneesh.bansal@freescale.com>

include/linux: move typdef for uintptr_t

uintptr_t which is a typdef for unsigned long is needed for creating
pointers (32 or 64 bit depending on Core) from 32 bit variables
storing the address.
If a 32 bit variable (u32) is typecasted to a pointer (void *),
compiler gives a warning in case size of pointer on the core is 64 bit.

The typdef has been moved from include/compiler.h to include/linux/types.h

Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>

# ed8271d1 07-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: Fix build on FreeBSD

Commit 832472 "tools: socfpga: Add socfpga preloader signing
to mkimage" added tools/socfpga.c which relies on htole32,
le32toh and friends. While compiler.h includes these protypes
for linux from endian.h, it doesn't do so for FreeBSD. Hence
include <sys/endian.h> for FreeBSD.

Cc: Marek Vasut <marex@denx.de>
CC: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 87f13aa0 17-Sep-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

compiler.h: remove duplicated uninitialized_var

Since clang has a different definition for uninitialized_var
it will complain that it is redefined in include/compiler.h.
Since these are already defined in linux/compiler.h just remove
this instance.

Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 9d16e93d 25-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: add missing time.h

genimg_print_time uses time_t, but time.h is never included.
Linux gets away with this since types.h includes time.h.
Explicitly include the header file so building on e.g. FreeBSD
also works.

cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c9502f49 04-Nov-2011 Simon Glass <sjg@chromium.org>

Define uintptr_t as long int to simplify printf() format strings

If uintptr_t can be either an unsigned int or an unsigned long int, it is
tricky to use it in a printf() format string. This changes it to
unsigned long int consistently. This should do the right thing on both
32-bit and 64-bit architectures.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>

# a7551a3f 23-Sep-2011 Simon Glass <sjg@chromium.org>

sandbox: Add compiler defines to support a 64-bit x86_64 platform

This sets __WORDSIZE to 8 correctly on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5bce5dc3 19-Jul-2011 Jeroen Hofstee <jeroen@myspectrum.nl>

include/compiler.h: typedef ulong for FreeBSD

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# 59336459 25-Sep-2010 Andreas Bießmann <andreas.devel@googlemail.com>

include/compiler.h: remove uint typedef for __MACH__

uint is typedefed twice if __MACH__ is defined. This generates an error
when calling MAKEALL for netstar bord on OS X.

This patch removes the typedef for __MACH__ case in favor of general
definiton some lines below.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 9312bba0 19-Jun-2010 Wolfgang Denk <wd@denx.de>

include/compiler.h: remove redundant declaration of errno

Commit 37566090 "compiler.h: unify system ifdef cruft here" added both
a "#include <errno.h>" and a "extern int errno;" to include/compiler.h
which is causing build warnings for some systems, for example for the
"netstar" board:

In file included from /home/wd/git/u-boot/work/lib/crc32.c:15:
include/compiler.h:28: warning: function declaration isn't a prototype

The declaration of "errno" should be redundant, as <errno.h> is
supposed to provide a correct declaration, so drop it.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>

# b050c72d 20-Apr-2010 Mike Frysinger <vapier@gentoo.org>

compiler.h: add uint typedef

Recent crc changes started using the "uint" type in headers that are used
on the build system. This subsequently broke mingw targets as they do not
provide such a type. So add this basic typedef to compiler.h so that we
do not have to worry about this breaking again in the future.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# b63815e3 22-Dec-2009 Matthias Kaehlcke <matthias@kaehlcke.net>

move definition of macros likely and unlikely to compiler.h

the macros likely and unlikely were defined in include/linux/mtd/compat.h,
but used in code not related to MTD. moved the macro definitions to compiler.h

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>

# d8bc55a6 01-Sep-2009 Anton Vorontsov <avorontsov@ru.mvista.com>

Move uninitialized_var() macro from ubi_uboot.h to compiler.h

This is needed so that we could use this macro for non-UBI code.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>

# 37566090 02-Jul-2009 Mike Frysinger <vapier@gentoo.org>

compiler.h: unify system ifdef cruft here

Shove a lot of the HOSTCC and related #ifdef checking crap into the new
compiler.h header so that we can keep all other headers nice and clean.

Also introduce custom uswap functions so we don't have to rely on the non
standard implementations that a host may (or may not in the case of OS X)
provide. This allows mkimage to finally build cleanly on an OS X system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

# 9865543a 06-Aug-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

Remove CONFIG_USE_STDINT

You do not need to use the typedefs provided by compiler.

Our compilers are either IPL32 or LP64. Hence, U-Boot can/should
always use int-ll64.h typedefs like Linux kernel, whatever the
typedefs the compiler internally uses.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# f29aa23b 29-Jan-2018 Justin Hibbits <chmeeedalf@gmail.com>

Fix FreeBSD endian checks

FreeBSD, like OpenBSD, uses BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER,
whereas Linux and compatibles use __-prefixed names. Define the names
the same as the OpenBSD block below it.


# fd184b9c 25-Nov-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use u-boot endian macros on OpenBSD

When building u-boot on sparc64 and powerpc hosts it became clear that
u-boot expects endian conversion defines to be macros:

lib/crc32.c:87: error: braced-group within expression allowed only inside a function

For OpenBSD switch from using system definitions equivalent to the u-boot ones
and define glibc __BYTE_ORDER __BIG_ENDIAN __LITTLE_ENDIAN names, as at least
some parts of the non-cross build assumes those names are present (ie crc32.c).

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>


# 3715a540 02-Sep-2016 Jonathan Gray <jsg@jsg.id.au>

compiler.h: use system endian macros on OpenBSD

The u-boot endian macros map directly to system endian
macros on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>


# 2e680f92 15-Dec-2015 York Sun <yorksun@freescale.com>

Revert "include/linux: move typdef for uintptr_t"

This reverts commit e8f954a756a825130d11b9c8fca70101dd8b3ac5, which
causes compiling errors on 32-bit hosts.

Acked-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Signed-off-by: York Sun <yorksun@freescale.com>


# e8f954a7 08-Dec-2015 Aneesh Bansal <aneesh.bansal@freescale.com>

include/linux: move typdef for uintptr_t

uintptr_t which is a typdef for unsigned long is needed for creating
pointers (32 or 64 bit depending on Core) from 32 bit variables
storing the address.
If a 32 bit variable (u32) is typecasted to a pointer (void *),
compiler gives a warning in case size of pointer on the core is 64 bit.

The typdef has been moved from include/compiler.h to include/linux/types.h

Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>


# 0d296cc2 15-Oct-2014 Gabe Black <gabeblack@chromium.org>

Provide option to avoid defining a custom version of uintptr_t.

There's a definition in stdint.h (provided by gcc) which will be more correct
if available.

Define CONFIG_USE_STDINT to use this feature, or USE_STDINT=1 on the 'make'
commmand.

This adjusts the settings for x86 and sandbox, with both have 64-bit options.

Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@google.com>
Rewritten to be an option, since stdint.h is often available only in glibc.
Changed to preserve a clear boundary between stdint and non-stdint
Signed-off-by: Simon Glass <sjg@chromium.org>


# ed8271d1 07-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: Fix build on FreeBSD

Commit 832472 "tools: socfpga: Add socfpga preloader signing
to mkimage" added tools/socfpga.c which relies on htole32,
le32toh and friends. While compiler.h includes these protypes
for linux from endian.h, it doesn't do so for FreeBSD. Hence
include <sys/endian.h> for FreeBSD.

Cc: Marek Vasut <marex@denx.de>
CC: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>


# 87f13aa0 17-Sep-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

compiler.h: remove duplicated uninitialized_var

Since clang has a different definition for uninitialized_var
it will complain that it is redefined in include/compiler.h.
Since these are already defined in linux/compiler.h just remove
this instance.

Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>


# 9d16e93d 25-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

tools: compiler.h: add missing time.h

genimg_print_time uses time_t, but time.h is never included.
Linux gets away with this since types.h includes time.h.
Explicitly include the header file so building on e.g. FreeBSD
also works.

cc: Tom Rini <trini@ti.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>


# c9502f49 04-Nov-2011 Simon Glass <sjg@chromium.org>

Define uintptr_t as long int to simplify printf() format strings

If uintptr_t can be either an unsigned int or an unsigned long int, it is
tricky to use it in a printf() format string. This changes it to
unsigned long int consistently. This should do the right thing on both
32-bit and 64-bit architectures.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>


# a7551a3f 23-Sep-2011 Simon Glass <sjg@chromium.org>

sandbox: Add compiler defines to support a 64-bit x86_64 platform

This sets __WORDSIZE to 8 correctly on 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 5bce5dc3 19-Jul-2011 Jeroen Hofstee <jeroen@myspectrum.nl>

include/compiler.h: typedef ulong for FreeBSD

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>


# 59336459 25-Sep-2010 Andreas Bießmann <andreas.devel@googlemail.com>

include/compiler.h: remove uint typedef for __MACH__

uint is typedefed twice if __MACH__ is defined. This generates an error
when calling MAKEALL for netstar bord on OS X.

This patch removes the typedef for __MACH__ case in favor of general
definiton some lines below.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>


# 9312bba0 19-Jun-2010 Wolfgang Denk <wd@denx.de>

include/compiler.h: remove redundant declaration of errno

Commit 37566090 "compiler.h: unify system ifdef cruft here" added both
a "#include <errno.h>" and a "extern int errno;" to include/compiler.h
which is causing build warnings for some systems, for example for the
"netstar" board:

In file included from /home/wd/git/u-boot/work/lib/crc32.c:15:
include/compiler.h:28: warning: function declaration isn't a prototype

The declaration of "errno" should be redundant, as <errno.h> is
supposed to provide a correct declaration, so drop it.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>


# b050c72d 20-Apr-2010 Mike Frysinger <vapier@gentoo.org>

compiler.h: add uint typedef

Recent crc changes started using the "uint" type in headers that are used
on the build system. This subsequently broke mingw targets as they do not
provide such a type. So add this basic typedef to compiler.h so that we
do not have to worry about this breaking again in the future.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>


# b63815e3 22-Dec-2009 Matthias Kaehlcke <matthias@kaehlcke.net>

move definition of macros likely and unlikely to compiler.h

the macros likely and unlikely were defined in include/linux/mtd/compat.h,
but used in code not related to MTD. moved the macro definitions to compiler.h

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>


# 88f9d60b 01-Sep-2009 Anton Vorontsov <avorontsov@ru.mvista.com>

Move uninitialized_var() macro from ubi_uboot.h to compiler.h

This is needed so that we could use this macro for non-UBI code.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>


# d8bc55a6 01-Sep-2009 Anton Vorontsov <avorontsov@ru.mvista.com>

Move uninitialized_var() macro from ubi_uboot.h to compiler.h

This is needed so that we could use this macro for non-UBI code.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>


# 37566090 02-Jul-2009 Mike Frysinger <vapier@gentoo.org>

compiler.h: unify system ifdef cruft here

Shove a lot of the HOSTCC and related #ifdef checking crap into the new
compiler.h header so that we can keep all other headers nice and clean.

Also introduce custom uswap functions so we don't have to rely on the non
standard implementations that a host may (or may not in the case of OS X)
provide. This allows mkimage to finally build cleanly on an OS X system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>