diff options
author | Simon McVittie <smcv@debian.org> | 2020-09-07 14:01:58 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2020-09-07 15:21:17 +0000 |
commit | a652edce0afc80916a87ebccca319d517989a128 (patch) | |
tree | 72900e62fe7a1c79db6cebcaf4725fb3cee91039 | |
parent | b8c58c74d835ee2918f9e391abd65f9e0132bdb4 (diff) |
Only assert about x86_64 struct sizes if ABI is LP64, not x32
The __x86_64__ macro identifies a CPU family, and is unfortunately not
enough to identify a concrete ABI.
The normal x86_64 ABI that is used by practical Linux distributions is
LP64 (i.e. 32-bit int, and 64-bit long and pointer), and defines
__x86_64__ and __LP64__.
x32 is a niche ILP32 ABI (i.e. 32-bit int, long and pointer) for x86_64
CPUs, which has different struct sizes due to sizeof(long) and
sizeof(void *) being smaller. It defines __x86_64__ and __ILP32__.
Signed-off-by: Simon McVittie <smcv@debian.org>
-rw-r--r-- | spa/tests/test-buffer.c | 4 | ||||
-rw-r--r-- | spa/tests/test-node.c | 6 | ||||
-rw-r--r-- | spa/tests/test-pod.c | 2 | ||||
-rw-r--r-- | spa/tests/test-utils.c | 2 | ||||
-rw-r--r-- | src/tests/test-array.c | 2 | ||||
-rw-r--r-- | src/tests/test-properties.c | 2 | ||||
-rw-r--r-- | src/tests/test-stream.c | 2 |
7 files changed, 10 insertions, 10 deletions
diff --git a/spa/tests/test-buffer.c b/spa/tests/test-buffer.c index 7a568e51..cddbffd4 100644 --- a/spa/tests/test-buffer.c +++ b/spa/tests/test-buffer.c @@ -36,7 +36,7 @@ static void test_abi(void) spa_assert(SPA_DATA_MemId == 4); spa_assert(SPA_DATA_LAST == 5); -#if defined(__x86_64__) +#if defined(__x86_64__) && defined(__LP64__) spa_assert(sizeof(struct spa_chunk) == 16); spa_assert(sizeof(struct spa_data) == 40); spa_assert(sizeof(struct spa_buffer) == 24); @@ -56,7 +56,7 @@ static void test_abi(void) spa_assert(SPA_META_Control == 6); spa_assert(SPA_META_LAST == 7); -#if defined(__x86_64__) +#if defined(__x86_64__) && defined(__LP64__) spa_assert(sizeof(struct spa_meta) == 16); spa_assert(sizeof(struct spa_meta_header) == 32); spa_assert(sizeof(struct spa_meta_region) == 16); diff --git a/spa/tests/test-node.c b/spa/tests/test-node.c index 9c35783f..78e7afe9 100644 --- a/spa/tests/test-node.c +++ b/spa/tests/test-node.c @@ -42,7 +42,7 @@ static void test_io_abi(void) spa_assert(SPA_IO_RateMatch == 8); spa_assert(SPA_IO_Memory == 9); -#if defined(__x86_64__) +#if defined(__x86_64__) && defined(__LP64__) spa_assert(sizeof(struct spa_io_buffers) == 8); spa_assert(sizeof(struct spa_io_memory) == 16); spa_assert(sizeof(struct spa_io_range) == 16); @@ -69,7 +69,7 @@ static void test_io_abi(void) spa_assert(SPA_IO_POSITION_STATE_STARTING == 1); spa_assert(SPA_IO_POSITION_STATE_RUNNING == 2); -#if defined(__x86_64__) +#if defined(__x86_64__) && defined(__LP64__) spa_assert(sizeof(struct spa_io_position) == 1688); spa_assert(sizeof(struct spa_io_rate_match) == 48); #else @@ -210,7 +210,7 @@ static void test_node_abi(void) spa_assert(SPA_NODE_METHOD_NUM == 15); spa_assert(sizeof(m) == sizeof(methods)); -#if defined(__x86_64__) +#if defined(__x86_64__) && defined(__LP64__) spa_assert(sizeof(struct spa_node_info) == 48); spa_assert(sizeof(struct spa_port_info) == 48); diff --git a/spa/tests/test-pod.c b/spa/tests/test-pod.c index f3e126ea..c208374e 100644 --- a/spa/tests/test-pod.c +++ b/spa/tests/test-pod.c @@ -35,7 +35,7 @@ static void test_abi(void) { /* pod */ -#if defined(__x86_64__) +#if defined(__x86_64__) && defined(__LP64__) spa_assert(sizeof(struct spa_pod) == 8); spa_assert(sizeof(struct spa_pod_bool) == 16); spa_assert(sizeof(struct spa_pod_id) == 16); diff --git a/spa/tests/test-utils.c b/spa/tests/test-utils.c index 4953633b..26ed6c81 100644 --- a/spa/tests/test-utils.c +++ b/spa/tests/test-utils.c @@ -63,7 +63,7 @@ static void test_abi(void) spa_assert(f.denom == 125); } -#if defined(__x86_64__) +#if defined(__x86_64__) && defined(__LP64__) /* dict */ spa_assert(sizeof(struct spa_dict_item) == 16); spa_assert(sizeof(struct spa_dict) == 16); diff --git a/src/tests/test-array.c b/src/tests/test-array.c index f65de6d3..16702aac 100644 --- a/src/tests/test-array.c +++ b/src/tests/test-array.c @@ -27,7 +27,7 @@ static void test_abi(void) { /* array */ -#if defined(__x86_64__) +#if defined(__x86_64__) && defined(__LP64__) spa_assert(sizeof(struct pw_array) == 32); #else fprintf(stderr, "%zd\n", sizeof(struct pw_array)); diff --git a/src/tests/test-properties.c b/src/tests/test-properties.c index 9b246cb6..3b257498 100644 --- a/src/tests/test-properties.c +++ b/src/tests/test-properties.c @@ -26,7 +26,7 @@ static void test_abi(void) { -#if defined(__x86_64__) +#if defined(__x86_64__) && defined(__LP64__) spa_assert(sizeof(struct pw_properties) == 24); #else fprintf(stderr, "%zd\n", sizeof(struct pw_properties)); diff --git a/src/tests/test-stream.c b/src/tests/test-stream.c index f9edfd3b..86497bcb 100644 --- a/src/tests/test-stream.c +++ b/src/tests/test-stream.c @@ -59,7 +59,7 @@ static void test_abi(void) TEST_FUNC(ev, test, process); TEST_FUNC(ev, test, drained); -#if defined(__x86_64__) +#if defined(__x86_64__) && defined(__LP64__) spa_assert(sizeof(struct pw_buffer) == 24); spa_assert(sizeof(struct pw_time) == 40); #else |