diff options
| author | 2026-03-19 19:25:41 +0100 | |
|---|---|---|
| committer | 2026-03-19 19:25:41 +0100 | |
| commit | 49ba7f066faa6e73e8f09e2e7ed6a077f6ba0258 (patch) | |
| tree | e3937913113ef201e05a4d95336f03c5ce9b7844 /src/c_lex.c | |
| parent | 46fc55e27390ea85eb34ec0367f40426197c9b9f (diff) | |
preeliminary support for openBSD
Diffstat (limited to 'src/c_lex.c')
| -rw-r--r-- | src/c_lex.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/c_lex.c b/src/c_lex.c index d1c0205..43e4b18 100644 --- a/src/c_lex.c +++ b/src/c_lex.c @@ -2374,9 +2374,10 @@ addpredefmacros(Arena **tmparena) cpredefs[] = "__antcc__\0__STDC__\0__STDC_NO_ATOMICS__\0__STDC_NO_COMPLEX__\0__STDC_NO_THREADS__\0__STDC_NO_VLA__\0", *ospredefs[] = { - [OSlinux] = "__linux\0__linux__\0linux\0unix\0__unix\0__unix__\0" + [OSlinux] = "__linux\0__linux__\0linux\0unix\0__unix\0__unix__\0", + [OSopenbsd] = "__OpenBSD__\0unix\0__unix\0__unix__\0" }, *archpredefs[] = { - [ISx86_64] = "__x86_64__\0__x86_64\0", + [ISx86_64] = "__x86_64__\0__x86_64\0__amd64__\0__amd64\0", [ISaarch64] = "__aarch64__\0__aarch64\0", }, cstdver[][8] = { [STDC89] = "199409L", @@ -2394,6 +2395,20 @@ addpredefmacros(Arena **tmparena) if (target.os != OSunknown) putdef1("__STDC_HOSTED__"); putdefs1(ospredefs[target.os]); putdefs1(archpredefs[target.arch]); + if (ccopt.pie) { + putdef1("__pie__"), putdef1("__PIE__"); + } + if (ccopt.pic) { + putdef1("__pic__"), putdef1("__PIC__"); + } + if (targ_primsizes[TYPTR] == 4) { + putdef1("_ILP32"), putdef1("__ILP32__"); + } else if (targ_primsizes[TYLONG] == 4) { + putdef1("_LLP64"), putdef1("__LLP64__"); + } else { + assert(targ_primsizes[TYINT] == 4); + putdef1("_LP64"), putdef1("__LP64__"); + } if (ppcmdline.n) { MemFile *f; |