summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeCompilerABI.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-11-03 21:57:16 (GMT)
committerBrad King <brad.king@kitware.com>2020-11-04 15:08:13 (GMT)
commitf511a1c00912f3e1d368a423b07bd1a1ab57fab3 (patch)
treee4feec49632b94694eb09fbfaef8cc57debf0aec /Modules/CMakeCompilerABI.h
parent606b34b3a6eeac1bcd64c274b5407cc2cd6be2bd (diff)
downloadCMake-f511a1c00912f3e1d368a423b07bd1a1ab57fab3.zip
CMake-f511a1c00912f3e1d368a423b07bd1a1ab57fab3.tar.gz
CMake-f511a1c00912f3e1d368a423b07bd1a1ab57fab3.tar.bz2
CMakeDetermineCompilerABI: Detect byte order as part of check
We already detect `sizeof(void*)`. Detect the byte order as part of the same check. Issue: #21392
Diffstat (limited to 'Modules/CMakeCompilerABI.h')
-rw-r--r--Modules/CMakeCompilerABI.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h
index 45532af..c5ce4dd 100644
--- a/Modules/CMakeCompilerABI.h
+++ b/Modules/CMakeCompilerABI.h
@@ -9,6 +9,18 @@ const char info_sizeof_dptr[] = {
/* clang-format on */
};
+/* Byte order. Only one of these will have bytes in the right order. */
+static unsigned short const info_byte_order_big_endian[] = {
+ /* INFO:byte_order string for BIG_ENDIAN */
+ 0x494E, 0x464F, 0x3A62, 0x7974, 0x655F, 0x6F72, 0x6465, 0x725B,
+ 0x4249, 0x475F, 0x454E, 0x4449, 0x414E, 0x5D00, 0x0000
+};
+static unsigned short const info_byte_order_little_endian[] = {
+ /* INFO:byte_order string for LITTLE_ENDIAN */
+ 0x4E49, 0x4F46, 0x623A, 0x7479, 0x5F65, 0x726F, 0x6564, 0x5B72,
+ 0x494C, 0x5454, 0x454C, 0x455F, 0x444E, 0x4149, 0x5D4E, 0x0000
+};
+
/* Application Binary Interface. */
/* Check for (some) ARM ABIs.