aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2016-10-09 02:41:34 +0200
committerMichael Matz <matz@suse.de>2016-12-15 17:49:56 +0100
commit8859dc9e6d56e1d0f1d4eb4302a360899ec17c7d (patch)
treea600c602f6298f1f4094373180078135c5cb4d6e /tests
parentd815a0f658273d2226f0d89601fd477969f60d68 (diff)
downloadtinycc-8859dc9e6d56e1d0f1d4eb4302a360899ec17c7d.tar.gz
tinycc-8859dc9e6d56e1d0f1d4eb4302a360899ec17c7d.tar.bz2
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/tcctest.c7
1 files changed, 7 insertions, 0 deletions
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",