summaryrefslogtreecommitdiff
path: root/utils/porting.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/porting.h')
-rw-r--r--utils/porting.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/porting.h b/utils/porting.h
index f1fdc70aa..f83074111 100644
--- a/utils/porting.h
+++ b/utils/porting.h
@@ -41,6 +41,16 @@
#include "dl-defs.h"
#endif
+/* __WORDSIZE ist used for __ELF_NATIVE_CLASS, which is used for ElfW().
+ We want to provide the wordsize of the target, not of the host, when
+ compiling readelf.host
+ */
+#include <link.h>
+#ifdef ARCH_NATIVE_BIT
+#undef __WORDSIZE
+#define __WORDSIZE ARCH_NATIVE_BIT
+#endif
+
#ifdef DMALLOC
#include <dmalloc.h>
#endif