Skip to content

Github-CI: add linux 32-bit target (DO NOT MERGE)#538

Open
chqrlie wants to merge 1 commit into
c2lang:masterfrom
chqrlie:linux32
Open

Github-CI: add linux 32-bit target (DO NOT MERGE)#538
chqrlie wants to merge 1 commit into
c2lang:masterfrom
chqrlie:linux32

Conversation

@chqrlie

@chqrlie chqrlie commented Jul 11, 2026

Copy link
Copy Markdown
Contributor
  • enable linux 32-bit target
  • fix 32-bit issues
  • add 32-bit struct sizes in static_assert validations
  • create bootstrap/bootstrap-linux-i686.patch

@chqrlie
chqrlie force-pushed the linux32 branch 12 times, most recently from e9efe82 to a3a075a Compare July 12, 2026 16:14
@bvdberg

bvdberg commented Jul 13, 2026

Copy link
Copy Markdown
Member

I think the static_assert(sizeof(void*) == 4 ? 132 : 144+64, sizeof(AST)); is an anti-pattern.
It would be better to extend the static_assert syntax to support this natively.

Options I can think of:

static_assert(8, sizeof(void*)); // generic case
static_assert[32](4, sizeof(void*)); // 32 bit platforms only
static_assert[64](8, sizeof(void*)); // 64 bit platforms only

// have different static assert functions (also the generic one)
static_assert32(..);
static_assert64(..);

// if needed (not now) we could extend the first syntax to include arch/system limits. The list of these is already in common/target_info.c2.
static_assertarch=arm64
static_assertarch=arm64,system=darwin

I think the arch/system options might be needed in the future, so perhaps the [] syntax is the better choice..

@chqrlie chqrlie changed the title Github-CI: add linux 32-bit target Github-CI: add linux 32-bit target (DO NOT MERGE) Jul 13, 2026
@chqrlie
chqrlie force-pushed the linux32 branch 2 times, most recently from c6d5fd0 to 3e691bc Compare July 14, 2026 06:14
* enable linux 32-bit target
* add `-m32` argument to test/force 32-bit code generation
* add 32-bit struct sizes in `static_assert` validations
* fix 32-bit issues
* fix printf/scanf format scanners for 32-bit longs
* fix signed/unsigned comparisons in IR module
* create hybrid **bootstrap/bootstrap-linux-i686.patch**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants