Clean up endianness macros a bit. Now pub_tool_basics.h defines
VG_LITTLEENDIAN or VG_BIGENDIAN and that's what should be used.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4142 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_debuginfo/symtab.c b/coregrind/m_debuginfo/symtab.c
index a807ee8..80d2539 100644
--- a/coregrind/m_debuginfo/symtab.c
+++ b/coregrind/m_debuginfo/symtab.c
@@ -906,7 +906,7 @@
&& ehdr->e_ident[EI_MAG2] == 'L'
&& ehdr->e_ident[EI_MAG3] == 'F');
ok &= (ehdr->e_ident[EI_CLASS] == VG_ELF_CLASS
- && ehdr->e_ident[EI_DATA] == VG_ELF_ENDIANNESS
+ && ehdr->e_ident[EI_DATA] == VG_ELF_DATA2XXX
&& ehdr->e_ident[EI_VERSION] == EV_CURRENT);
ok &= (ehdr->e_type == ET_EXEC || ehdr->e_type == ET_DYN);
ok &= (ehdr->e_machine == VG_ELF_MACHINE);
diff --git a/coregrind/m_ume.c b/coregrind/m_ume.c
index 8bf91d1..6b0cbd1 100644
--- a/coregrind/m_ume.c
+++ b/coregrind/m_ume.c
@@ -288,7 +288,7 @@
"(eg. 32-bit instead of 64-bit)\n");
goto bad;
}
- if (e->e.e_ident[EI_DATA] != VG_ELF_ENDIANNESS) {
+ if (e->e.e_ident[EI_DATA] != VG_ELF_DATA2XXX) {
fprintf(stderr, "valgrind: executable has wrong endian-ness\n");
goto bad;
}
diff --git a/coregrind/pub_core_machine.h b/coregrind/pub_core_machine.h
index 3604ea4..8b9cdba 100644
--- a/coregrind/pub_core_machine.h
+++ b/coregrind/pub_core_machine.h
@@ -40,15 +40,15 @@
#include "pub_tool_machine.h"
#if defined(VGA_x86)
-# define VG_ELF_ENDIANNESS ELFDATA2LSB
+# define VG_ELF_DATA2XXX ELFDATA2LSB
# define VG_ELF_MACHINE EM_386
# define VG_ELF_CLASS ELFCLASS32
#elif defined(VGA_amd64)
-# define VG_ELF_ENDIANNESS ELFDATA2LSB
+# define VG_ELF_DATA2XXX ELFDATA2LSB
# define VG_ELF_MACHINE EM_X86_64
# define VG_ELF_CLASS ELFCLASS64
#elif defined(VGA_ppc32)
-# define VG_ELF_ENDIANNESS ELFDATA2MSB
+# define VG_ELF_DATA2XXX ELFDATA2MSB
# define VG_ELF_MACHINE EM_PPC
# define VG_ELF_CLASS ELFCLASS32
#else
diff --git a/include/pub_tool_basics.h b/include/pub_tool_basics.h
index 67345b8..90882e4 100644
--- a/include/pub_tool_basics.h
+++ b/include/pub_tool_basics.h
@@ -109,13 +109,24 @@
SysRes;
/* ---------------------------------------------------------------------
- Miscellaneous
+ Miscellaneous (word size, endianness, regparmness)
------------------------------------------------------------------ */
-/* This is going to be either 4 or 8. */
+/* Word size: this is going to be either 4 or 8. */
// It should probably be in m_machine.
#define VG_WORDSIZE VEX_HOST_WORDSIZE
+/* Endianness */
+#undef VG_BIGENDIAN
+#undef VG_LITTLEENDIAN
+
+#if defined(VGA_x86) || defined(VGA_amd64)
+# define VG_LITTLEENDIAN 1
+#elif defined(VGA_ppc32)
+# define VG_BIGENDIAN 1
+#endif
+
+/* Regparmness */
#if defined(VGA_x86)
# define VG_REGPARM(n) __attribute__((regparm(n)))
#elif defined(VGA_amd64) || defined(VGA_ppc32)
diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c
index 49590ee..0579897 100644
--- a/memcheck/mc_translate.c
+++ b/memcheck/mc_translate.c
@@ -2367,9 +2367,9 @@
IREndness end;
/* What's the native endianness? We need to know this. */
-# if defined(VKI_BIG_ENDIAN)
+# if defined(VG_BIGENDIAN)
end = Iend_BE;
-# elif defined(VKI_LITTLE_ENDIAN)
+# elif defined(VG_LITTLEENDIAN)
end = Iend_LE;
# else
# error "Unknown endianness"