From 8859dc9e6d56e1d0f1d4eb4302a360899ec17c7d Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Sun, 9 Oct 2016 02:41:34 +0200 Subject: Support large alignment requests The linux kernel has some structures that are page aligned, i.e. 4096. Instead of enlarging the bit fields to specify this, use the fact that alignment is always power of two, and store only the log2 minus 1 of it. The 5 bits are enough to specify an alignment of 1 << 30. --- tests/tcctest.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/tcctest.c b/tests/tcctest.c index 9fcd7a4..68f8db6 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -1048,6 +1048,11 @@ int pad1; a copy of it). struct aligntest7 altest7[2] __attribute__((aligned(16)));*/ +struct aligntest8 +{ + int i; +} __attribute__((aligned(4096))); + struct Large { unsigned long flags; union { @@ -1129,6 +1134,8 @@ void struct_test() sizeof(struct aligntest6), __alignof__(struct aligntest6)); printf("aligntest7 sizeof=%d alignof=%d\n", sizeof(struct aligntest7), __alignof__(struct aligntest7)); + printf("aligntest8 sizeof=%d alignof=%d\n", + sizeof(struct aligntest8), __alignof__(struct aligntest8)); printf("altest5 sizeof=%d alignof=%d\n", sizeof(altest5), __alignof__(altest5)); printf("altest6 sizeof=%d alignof=%d\n", -- cgit v1.3.1