[5/7] Strip __ prefix from __BYTE_ORDER __LITTLE_ENDIAN and __BIG_ENDIAN
Commit Message
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
lib/system.h | 4 ++--
libcpu/i386_disasm.c | 2 +-
libcpu/memory-access.h | 26 +++++++++++++-------------
libcpu/riscv_disasm.c | 2 +-
libdw/memory-access.h | 8 ++++----
libdwfl/dwfl_segment_report_module.c | 2 +-
libelf/common.h | 2 +-
libelf/elf32_checksum.c | 4 ++--
libelf/elf32_xlatetof.c | 4 ++--
libelf/elf_getarsym.c | 6 +++---
src/arlib.h | 2 +-
11 files changed, 31 insertions(+), 31 deletions(-)
Comments
Hi,
This seems to work and is probably OK. But do you know when/what the
__ prefix versions are defined and when/what defines the non-prefixed
versions?
Thanks,
Mark
On Tue, Sep 20, 2022 at 04:43:05PM +0800, Yonggang Luo via Elfutils-devel wrote:
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
> lib/system.h | 4 ++--
> libcpu/i386_disasm.c | 2 +-
> libcpu/memory-access.h | 26 +++++++++++++-------------
> libcpu/riscv_disasm.c | 2 +-
> libdw/memory-access.h | 8 ++++----
> libdwfl/dwfl_segment_report_module.c | 2 +-
> libelf/common.h | 2 +-
> libelf/elf32_checksum.c | 4 ++--
> libelf/elf32_xlatetof.c | 4 ++--
> libelf/elf_getarsym.c | 6 +++---
> src/arlib.h | 2 +-
> 11 files changed, 31 insertions(+), 31 deletions(-)
>
> diff --git a/lib/system.h b/lib/system.h
> index 48004df1..bbbe06c4 100644
> --- a/lib/system.h
> +++ b/lib/system.h
> @@ -64,12 +64,12 @@ void error(int status, int errnum, const char *format, ...);
> exit (EXIT_FAILURE); \
> } while (0)
>
> -#if __BYTE_ORDER == __LITTLE_ENDIAN
> +#if BYTE_ORDER == LITTLE_ENDIAN
> # define LE32(n) (n)
> # define LE64(n) (n)
> # define BE32(n) bswap_32 (n)
> # define BE64(n) bswap_64 (n)
> -#elif __BYTE_ORDER == __BIG_ENDIAN
> +#elif BYTE_ORDER == BIG_ENDIAN
> # define BE32(n) (n)
> # define BE64(n) (n)
> # define LE32(n) bswap_32 (n)
> diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
> index fd7340cc..40475b81 100644
> --- a/libcpu/i386_disasm.c
> +++ b/libcpu/i386_disasm.c
> @@ -44,7 +44,7 @@
>
> #include "../libebl/libeblP.h"
>
> -#define MACHINE_ENCODING __LITTLE_ENDIAN
> +#define MACHINE_ENCODING LITTLE_ENDIAN
> #include "memory-access.h"
>
>
> diff --git a/libcpu/memory-access.h b/libcpu/memory-access.h
> index 779825fa..3b6ca19b 100644
> --- a/libcpu/memory-access.h
> +++ b/libcpu/memory-access.h
> @@ -41,7 +41,7 @@
> #ifndef MACHINE_ENCODING
> # error "MACHINE_ENCODING needs to be defined"
> #endif
> -#if MACHINE_ENCODING != __BIG_ENDIAN && MACHINE_ENCODING != __LITTLE_ENDIAN
> +#if MACHINE_ENCODING != BIG_ENDIAN && MACHINE_ENCODING != LITTLE_ENDIAN
> # error "MACHINE_ENCODING must signal either big or little endian"
> #endif
>
> @@ -51,31 +51,31 @@
> #if ALLOW_UNALIGNED
>
> # define read_2ubyte_unaligned(Addr) \
> - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
> + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
> ? bswap_16 (*((const uint16_t *) (Addr))) \
> : *((const uint16_t *) (Addr)))
> # define read_2sbyte_unaligned(Addr) \
> - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
> + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
> ? (int16_t) bswap_16 (*((const int16_t *) (Addr))) \
> : *((const int16_t *) (Addr)))
>
> # define read_4ubyte_unaligned_noncvt(Addr) \
> *((const uint32_t *) (Addr))
> # define read_4ubyte_unaligned(Addr) \
> - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
> + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
> ? bswap_32 (*((const uint32_t *) (Addr))) \
> : *((const uint32_t *) (Addr)))
> # define read_4sbyte_unaligned(Addr) \
> - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
> + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
> ? (int32_t) bswap_32 (*((const int32_t *) (Addr))) \
> : *((const int32_t *) (Addr)))
>
> # define read_8ubyte_unaligned(Addr) \
> - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
> + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
> ? bswap_64 (*((const uint64_t *) (Addr))) \
> : *((const uint64_t *) (Addr)))
> # define read_8sbyte_unaligned(Addr) \
> - (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
> + (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
> ? (int64_t) bswap_64 (*((const int64_t *) (Addr))) \
> : *((const int64_t *) (Addr)))
>
> @@ -96,7 +96,7 @@ static inline uint16_t
> read_2ubyte_unaligned (const void *p)
> {
> const union unaligned *up = p;
> - if (MACHINE_ENCODING != __BYTE_ORDER)
> + if (MACHINE_ENCODING != BYTE_ORDER)
> return bswap_16 (up->u2);
> return up->u2;
> }
> @@ -104,7 +104,7 @@ static inline int16_t
> read_2sbyte_unaligned (const void *p)
> {
> const union unaligned *up = p;
> - if (MACHINE_ENCODING != __BYTE_ORDER)
> + if (MACHINE_ENCODING != BYTE_ORDER)
> return (int16_t) bswap_16 (up->u2);
> return up->s2;
> }
> @@ -119,7 +119,7 @@ static inline uint32_t
> read_4ubyte_unaligned (const void *p)
> {
> const union unaligned *up = p;
> - if (MACHINE_ENCODING != __BYTE_ORDER)
> + if (MACHINE_ENCODING != BYTE_ORDER)
> return bswap_32 (up->u4);
> return up->u4;
> }
> @@ -127,7 +127,7 @@ static inline int32_t
> read_4sbyte_unaligned (const void *p)
> {
> const union unaligned *up = p;
> - if (MACHINE_ENCODING != __BYTE_ORDER)
> + if (MACHINE_ENCODING != BYTE_ORDER)
> return (int32_t) bswap_32 (up->u4);
> return up->s4;
> }
> @@ -136,7 +136,7 @@ static inline uint64_t
> read_8ubyte_unaligned (const void *p)
> {
> const union unaligned *up = p;
> - if (MACHINE_ENCODING != __BYTE_ORDER)
> + if (MACHINE_ENCODING != BYTE_ORDER)
> return bswap_64 (up->u8);
> return up->u8;
> }
> @@ -144,7 +144,7 @@ static inline int64_t
> read_8sbyte_unaligned (const void *p)
> {
> const union unaligned *up = p;
> - if (MACHINE_ENCODING != __BYTE_ORDER)
> + if (MACHINE_ENCODING != BYTE_ORDER)
> return (int64_t) bswap_64 (up->u8);
> return up->s8;
> }
> diff --git a/libcpu/riscv_disasm.c b/libcpu/riscv_disasm.c
> index bc0d8f37..7175c077 100644
> --- a/libcpu/riscv_disasm.c
> +++ b/libcpu/riscv_disasm.c
> @@ -41,7 +41,7 @@
>
> #include "../libebl/libeblP.h"
>
> -#define MACHINE_ENCODING __LITTLE_ENDIAN
> +#define MACHINE_ENCODING LITTLE_ENDIAN
> #include "memory-access.h"
>
>
> diff --git a/libdw/memory-access.h b/libdw/memory-access.h
> index 8b2386ee..800b517c 100644
> --- a/libdw/memory-access.h
> +++ b/libdw/memory-access.h
> @@ -355,10 +355,10 @@ read_8sbyte_unaligned_1 (bool other_byte_order, const void *p)
> static inline int
> file_byte_order (bool other_byte_order)
> {
> -#if __BYTE_ORDER == __LITTLE_ENDIAN
> - return other_byte_order ? __BIG_ENDIAN : __LITTLE_ENDIAN;
> +#if BYTE_ORDER == LITTLE_ENDIAN
> + return other_byte_order ? BIG_ENDIAN : LITTLE_ENDIAN;
> #else
> - return other_byte_order ? __LITTLE_ENDIAN : __BIG_ENDIAN;
> + return other_byte_order ? LITTLE_ENDIAN : BIG_ENDIAN;
> #endif
> }
>
> @@ -372,7 +372,7 @@ read_3ubyte_unaligned (Dwarf *dbg, const unsigned char *p)
> } d;
> bool other_byte_order = dbg->other_byte_order;
>
> - if (file_byte_order (other_byte_order) == __BIG_ENDIAN)
> + if (file_byte_order (other_byte_order) == BIG_ENDIAN)
> {
> d.c[0] = 0x00;
> d.c[1] = p[0];
> diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
> index 1461ae26..28f87f10 100644
> --- a/libdwfl/dwfl_segment_report_module.c
> +++ b/libdwfl/dwfl_segment_report_module.c
> @@ -49,7 +49,7 @@
>
> #define INITIAL_READ 1024
>
> -#if __BYTE_ORDER == __LITTLE_ENDIAN
> +#if BYTE_ORDER == LITTLE_ENDIAN
> # define MY_ELFDATA ELFDATA2LSB
> #else
> # define MY_ELFDATA ELFDATA2MSB
> diff --git a/libelf/common.h b/libelf/common.h
> index 4561854f..9b2a856d 100644
> --- a/libelf/common.h
> +++ b/libelf/common.h
> @@ -151,7 +151,7 @@ libelf_release_all (Elf *elf)
> : bswap_64 (Var))))
>
>
> -#if __BYTE_ORDER == __LITTLE_ENDIAN
> +#if BYTE_ORDER == LITTLE_ENDIAN
> # define MY_ELFDATA ELFDATA2LSB
> #else
> # define MY_ELFDATA ELFDATA2MSB
> diff --git a/libelf/elf32_checksum.c b/libelf/elf32_checksum.c
> index 521668a7..a47b307d 100644
> --- a/libelf/elf32_checksum.c
> +++ b/libelf/elf32_checksum.c
> @@ -73,9 +73,9 @@ elfw2(LIBELFBITS,checksum) (Elf *elf)
> is the same. */
> ident = elf->state.ELFW(elf,LIBELFBITS).ehdr->e_ident;
> same_byte_order = ((ident[EI_DATA] == ELFDATA2LSB
> - && __BYTE_ORDER == __LITTLE_ENDIAN)
> + && BYTE_ORDER == LITTLE_ENDIAN)
> || (ident[EI_DATA] == ELFDATA2MSB
> - && __BYTE_ORDER == __BIG_ENDIAN));
> + && BYTE_ORDER == BIG_ENDIAN));
>
> /* If we don't have native byte order, we will likely need to
> convert the data with xlate functions. We do it upfront instead
> diff --git a/libelf/elf32_xlatetof.c b/libelf/elf32_xlatetof.c
> index 377659c8..ab857409 100644
> --- a/libelf/elf32_xlatetof.c
> +++ b/libelf/elf32_xlatetof.c
> @@ -82,8 +82,8 @@ elfw2(LIBELFBITS, xlatetof) (Elf_Data *dest, const Elf_Data *src,
> and vice versa since the function only has to copy and/or
> change the byte order.
> */
> - if ((__BYTE_ORDER == __LITTLE_ENDIAN && encode == ELFDATA2LSB)
> - || (__BYTE_ORDER == __BIG_ENDIAN && encode == ELFDATA2MSB))
> + if ((BYTE_ORDER == LITTLE_ENDIAN && encode == ELFDATA2LSB)
> + || (BYTE_ORDER == BIG_ENDIAN && encode == ELFDATA2MSB))
> {
> /* We simply have to copy since the byte order is the same. */
> if (src->d_buf != dest->d_buf)
> diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
> index 2203521f..281f0c1c 100644
> --- a/libelf/elf_getarsym.c
> +++ b/libelf/elf_getarsym.c
> @@ -61,7 +61,7 @@ read_number_entries (uint64_t *nump, Elf *elf, size_t *offp, bool index64_p)
>
> *offp += w;
>
> - if (__BYTE_ORDER == __LITTLE_ENDIAN)
> + if (BYTE_ORDER == LITTLE_ENDIAN)
> *nump = index64_p ? bswap_64 (u.ret64) : bswap_32 (u.ret32);
> else
> *nump = index64_p ? u.ret64 : u.ret32;
> @@ -266,7 +266,7 @@ elf_getarsym (Elf *elf, size_t *ptr)
> if (index64_p)
> {
> uint64_t tmp = (*u64)[cnt];
> - if (__BYTE_ORDER == __LITTLE_ENDIAN)
> + if (BYTE_ORDER == LITTLE_ENDIAN)
> tmp = bswap_64 (tmp);
>
> arsym[cnt].as_off = tmp;
> @@ -286,7 +286,7 @@ elf_getarsym (Elf *elf, size_t *ptr)
> goto out;
> }
> }
> - else if (__BYTE_ORDER == __LITTLE_ENDIAN)
> + else if (BYTE_ORDER == LITTLE_ENDIAN)
> arsym[cnt].as_off = bswap_32 ((*u32)[cnt]);
> else
> arsym[cnt].as_off = (*u32)[cnt];
> diff --git a/src/arlib.h b/src/arlib.h
> index e117166e..d4a42210 100644
> --- a/src/arlib.h
> +++ b/src/arlib.h
> @@ -46,7 +46,7 @@ extern const struct argp_child arlib_argp_children[];
> #define AR_HDR_WORDS (sizeof (struct ar_hdr) / sizeof (uint32_t))
>
>
> -#if __BYTE_ORDER == __LITTLE_ENDIAN
> +#if BYTE_ORDER == LITTLE_ENDIAN
> # define le_bswap_32(val) bswap_32 (val)
> #else
> # define le_bswap_32(val) (val)
> --
> 2.36.1.windows.1
>
On Mon, Oct 17, 2022 at 5:11 AM Mark Wielaard <mark@klomp.org> wrote:
>
> Hi,
>
> This seems to work and is probably OK. But do you know when/what the
> __ prefix versions are defined and when/what defines the non-prefixed
> versions?
>
__BYTE_ORDER__ is a predefined macro by gcc/clang,
BYTE_ORDER is defined in <endian.h>
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
Hi,
On Mon, Oct 17, 2022 at 11:40:11AM +0800, 罗勇刚(Yonggang Luo) wrote:
> > This seems to work and is probably OK. But do you know when/what the
> > __ prefix versions are defined and when/what defines the non-prefixed
> > versions?
>
> __BYTE_ORDER__ is a predefined macro by gcc/clang,
>
> BYTE_ORDER is defined in <endian.h>
Aha, thanks. I added that to the commit message and pushed the change.
Cheers,
Mark
@@ -64,12 +64,12 @@ void error(int status, int errnum, const char *format, ...);
exit (EXIT_FAILURE); \
} while (0)
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
# define LE32(n) (n)
# define LE64(n) (n)
# define BE32(n) bswap_32 (n)
# define BE64(n) bswap_64 (n)
-#elif __BYTE_ORDER == __BIG_ENDIAN
+#elif BYTE_ORDER == BIG_ENDIAN
# define BE32(n) (n)
# define BE64(n) (n)
# define LE32(n) bswap_32 (n)
@@ -44,7 +44,7 @@
#include "../libebl/libeblP.h"
-#define MACHINE_ENCODING __LITTLE_ENDIAN
+#define MACHINE_ENCODING LITTLE_ENDIAN
#include "memory-access.h"
@@ -41,7 +41,7 @@
#ifndef MACHINE_ENCODING
# error "MACHINE_ENCODING needs to be defined"
#endif
-#if MACHINE_ENCODING != __BIG_ENDIAN && MACHINE_ENCODING != __LITTLE_ENDIAN
+#if MACHINE_ENCODING != BIG_ENDIAN && MACHINE_ENCODING != LITTLE_ENDIAN
# error "MACHINE_ENCODING must signal either big or little endian"
#endif
@@ -51,31 +51,31 @@
#if ALLOW_UNALIGNED
# define read_2ubyte_unaligned(Addr) \
- (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
+ (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
? bswap_16 (*((const uint16_t *) (Addr))) \
: *((const uint16_t *) (Addr)))
# define read_2sbyte_unaligned(Addr) \
- (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
+ (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
? (int16_t) bswap_16 (*((const int16_t *) (Addr))) \
: *((const int16_t *) (Addr)))
# define read_4ubyte_unaligned_noncvt(Addr) \
*((const uint32_t *) (Addr))
# define read_4ubyte_unaligned(Addr) \
- (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
+ (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
? bswap_32 (*((const uint32_t *) (Addr))) \
: *((const uint32_t *) (Addr)))
# define read_4sbyte_unaligned(Addr) \
- (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
+ (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
? (int32_t) bswap_32 (*((const int32_t *) (Addr))) \
: *((const int32_t *) (Addr)))
# define read_8ubyte_unaligned(Addr) \
- (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
+ (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
? bswap_64 (*((const uint64_t *) (Addr))) \
: *((const uint64_t *) (Addr)))
# define read_8sbyte_unaligned(Addr) \
- (unlikely (MACHINE_ENCODING != __BYTE_ORDER) \
+ (unlikely (MACHINE_ENCODING != BYTE_ORDER) \
? (int64_t) bswap_64 (*((const int64_t *) (Addr))) \
: *((const int64_t *) (Addr)))
@@ -96,7 +96,7 @@ static inline uint16_t
read_2ubyte_unaligned (const void *p)
{
const union unaligned *up = p;
- if (MACHINE_ENCODING != __BYTE_ORDER)
+ if (MACHINE_ENCODING != BYTE_ORDER)
return bswap_16 (up->u2);
return up->u2;
}
@@ -104,7 +104,7 @@ static inline int16_t
read_2sbyte_unaligned (const void *p)
{
const union unaligned *up = p;
- if (MACHINE_ENCODING != __BYTE_ORDER)
+ if (MACHINE_ENCODING != BYTE_ORDER)
return (int16_t) bswap_16 (up->u2);
return up->s2;
}
@@ -119,7 +119,7 @@ static inline uint32_t
read_4ubyte_unaligned (const void *p)
{
const union unaligned *up = p;
- if (MACHINE_ENCODING != __BYTE_ORDER)
+ if (MACHINE_ENCODING != BYTE_ORDER)
return bswap_32 (up->u4);
return up->u4;
}
@@ -127,7 +127,7 @@ static inline int32_t
read_4sbyte_unaligned (const void *p)
{
const union unaligned *up = p;
- if (MACHINE_ENCODING != __BYTE_ORDER)
+ if (MACHINE_ENCODING != BYTE_ORDER)
return (int32_t) bswap_32 (up->u4);
return up->s4;
}
@@ -136,7 +136,7 @@ static inline uint64_t
read_8ubyte_unaligned (const void *p)
{
const union unaligned *up = p;
- if (MACHINE_ENCODING != __BYTE_ORDER)
+ if (MACHINE_ENCODING != BYTE_ORDER)
return bswap_64 (up->u8);
return up->u8;
}
@@ -144,7 +144,7 @@ static inline int64_t
read_8sbyte_unaligned (const void *p)
{
const union unaligned *up = p;
- if (MACHINE_ENCODING != __BYTE_ORDER)
+ if (MACHINE_ENCODING != BYTE_ORDER)
return (int64_t) bswap_64 (up->u8);
return up->s8;
}
@@ -41,7 +41,7 @@
#include "../libebl/libeblP.h"
-#define MACHINE_ENCODING __LITTLE_ENDIAN
+#define MACHINE_ENCODING LITTLE_ENDIAN
#include "memory-access.h"
@@ -355,10 +355,10 @@ read_8sbyte_unaligned_1 (bool other_byte_order, const void *p)
static inline int
file_byte_order (bool other_byte_order)
{
-#if __BYTE_ORDER == __LITTLE_ENDIAN
- return other_byte_order ? __BIG_ENDIAN : __LITTLE_ENDIAN;
+#if BYTE_ORDER == LITTLE_ENDIAN
+ return other_byte_order ? BIG_ENDIAN : LITTLE_ENDIAN;
#else
- return other_byte_order ? __LITTLE_ENDIAN : __BIG_ENDIAN;
+ return other_byte_order ? LITTLE_ENDIAN : BIG_ENDIAN;
#endif
}
@@ -372,7 +372,7 @@ read_3ubyte_unaligned (Dwarf *dbg, const unsigned char *p)
} d;
bool other_byte_order = dbg->other_byte_order;
- if (file_byte_order (other_byte_order) == __BIG_ENDIAN)
+ if (file_byte_order (other_byte_order) == BIG_ENDIAN)
{
d.c[0] = 0x00;
d.c[1] = p[0];
@@ -49,7 +49,7 @@
#define INITIAL_READ 1024
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
# define MY_ELFDATA ELFDATA2LSB
#else
# define MY_ELFDATA ELFDATA2MSB
@@ -151,7 +151,7 @@ libelf_release_all (Elf *elf)
: bswap_64 (Var))))
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
# define MY_ELFDATA ELFDATA2LSB
#else
# define MY_ELFDATA ELFDATA2MSB
@@ -73,9 +73,9 @@ elfw2(LIBELFBITS,checksum) (Elf *elf)
is the same. */
ident = elf->state.ELFW(elf,LIBELFBITS).ehdr->e_ident;
same_byte_order = ((ident[EI_DATA] == ELFDATA2LSB
- && __BYTE_ORDER == __LITTLE_ENDIAN)
+ && BYTE_ORDER == LITTLE_ENDIAN)
|| (ident[EI_DATA] == ELFDATA2MSB
- && __BYTE_ORDER == __BIG_ENDIAN));
+ && BYTE_ORDER == BIG_ENDIAN));
/* If we don't have native byte order, we will likely need to
convert the data with xlate functions. We do it upfront instead
@@ -82,8 +82,8 @@ elfw2(LIBELFBITS, xlatetof) (Elf_Data *dest, const Elf_Data *src,
and vice versa since the function only has to copy and/or
change the byte order.
*/
- if ((__BYTE_ORDER == __LITTLE_ENDIAN && encode == ELFDATA2LSB)
- || (__BYTE_ORDER == __BIG_ENDIAN && encode == ELFDATA2MSB))
+ if ((BYTE_ORDER == LITTLE_ENDIAN && encode == ELFDATA2LSB)
+ || (BYTE_ORDER == BIG_ENDIAN && encode == ELFDATA2MSB))
{
/* We simply have to copy since the byte order is the same. */
if (src->d_buf != dest->d_buf)
@@ -61,7 +61,7 @@ read_number_entries (uint64_t *nump, Elf *elf, size_t *offp, bool index64_p)
*offp += w;
- if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ if (BYTE_ORDER == LITTLE_ENDIAN)
*nump = index64_p ? bswap_64 (u.ret64) : bswap_32 (u.ret32);
else
*nump = index64_p ? u.ret64 : u.ret32;
@@ -266,7 +266,7 @@ elf_getarsym (Elf *elf, size_t *ptr)
if (index64_p)
{
uint64_t tmp = (*u64)[cnt];
- if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ if (BYTE_ORDER == LITTLE_ENDIAN)
tmp = bswap_64 (tmp);
arsym[cnt].as_off = tmp;
@@ -286,7 +286,7 @@ elf_getarsym (Elf *elf, size_t *ptr)
goto out;
}
}
- else if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ else if (BYTE_ORDER == LITTLE_ENDIAN)
arsym[cnt].as_off = bswap_32 ((*u32)[cnt]);
else
arsym[cnt].as_off = (*u32)[cnt];
@@ -46,7 +46,7 @@ extern const struct argp_child arlib_argp_children[];
#define AR_HDR_WORDS (sizeof (struct ar_hdr) / sizeof (uint32_t))
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
# define le_bswap_32(val) bswap_32 (val)
#else
# define le_bswap_32(val) (val)