diff options
author | Stephen Webb <swebb@blackberry.com> | 2020-06-11 17:52:49 -0400 |
---|---|---|
committer | Dave Watson <dade.watson@gmail.com> | 2020-06-18 13:42:19 -0700 |
commit | 12e70a59df9a2e1c436c79c1dba941ca555db843 (patch) | |
tree | d0f9cc95ba9c54d22f8de5fbbf731f076ebadd5c /src/ppc64 | |
parent | 77dfbd60e715399f06b3e823fdffa5d9c658caf2 (diff) | |
download | libunwind-12e70a59df9a2e1c436c79c1dba941ca555db843.tar.gz |
Rationalize endianness macros
Extend the endianness macros to support systems that define them in
<sys/param.h> and replace the use of names that violate ISO/IEC 9899.
Rename endianness macros used in code to use properly-namespaced macros for
portability and cross-hosting compatibility. Add inline functions to perform
common operations with the macros.
Diffstat (limited to 'src/ppc64')
-rw-r--r-- | src/ppc64/Gcreate_addr_space.c | 8 | ||||
-rw-r--r-- | src/ppc64/Ginit.c | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/ppc64/Gcreate_addr_space.c b/src/ppc64/Gcreate_addr_space.c index bd48555d..77ccc05d 100644 --- a/src/ppc64/Gcreate_addr_space.c +++ b/src/ppc64/Gcreate_addr_space.c @@ -40,9 +40,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order) /* * We support both big- and little-endian on Linux ppc64. */ - if (byte_order != 0 - && byte_order != __LITTLE_ENDIAN - && byte_order != __BIG_ENDIAN) + if (byte_order != 0 && byte_order_is_valid(byte_order) == 0); return NULL; as = malloc (sizeof (*as)); @@ -55,9 +53,9 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order) if (byte_order == 0) /* use host default: */ - as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN); + as->big_endian = target_is_big_endian(); else - as->big_endian = (byte_order == __BIG_ENDIAN); + as->big_endian = order_is_big_endian(byte_order); /* FIXME! There is no way to specify the ABI. Default to ELFv1 on big-endian and ELFv2 on little-endian. */ diff --git a/src/ppc64/Ginit.c b/src/ppc64/Ginit.c index 7bfb395a..530c731f 100644 --- a/src/ppc64/Ginit.c +++ b/src/ppc64/Ginit.c @@ -211,7 +211,7 @@ HIDDEN void ppc64_local_addr_space_init (void) { memset (&local_addr_space, 0, sizeof (local_addr_space)); - local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN); + local_addr_space.big_endian = target_is_big_endian(); #if _CALL_ELF == 2 local_addr_space.abi = UNW_PPC64_ABI_ELFv2; #else |