commit 3103a4ad89edc64ed22bd66de2a49b15a7e43d1b
parent 4aff072f0bc195635c23adeccf0f436df02ac890
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 1 Apr 2026 08:27:21 +0200
driver/posix: Add a __QBE__ macro
There are several constructions that cannot be done using qbe, like
for example volatile variables, and in order to have some of the libc
tests with qbe we needed a way to adapt them for this situation.
Diffstat:
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/cmd/scc-cc/posix/cc.c b/src/cmd/scc-cc/posix/cc.c
@@ -68,7 +68,7 @@ static struct items objtmp, objout;
static struct items linkargs, cc1args;
static int Mflag, Eflag, Sflag, Wflag,
- cflag, dflag, kflag, sflag, Qflag = 1, /* TODO: Remove Qflag */
+ cflag, dflag, kflag, sflag, Qflag = 1,
gflag;
static int devnullfd = -1;
@@ -222,6 +222,9 @@ settool(int tool, char *infile, int nexttool)
addarg(tool, "-M");
if (Wflag)
addarg(tool, "-w");
+ if (Qflag)
+ addarg(tool, "-D__QBE__");
+
for (n = 0; n < cc1args.n; ++n)
addarg(tool, cc1args.s[n]);
for (n = 0; sysincludes[n]; ++n) {
diff --git a/tests/libc/execute/0008-longjmp.c b/tests/libc/execute/0008-longjmp.c
@@ -23,7 +23,12 @@ int
main()
{
static int i;
+#ifdef __QBE__
+ // We cannot implement proper volatile with qbe
+ static volatile int v;
+#else
auto volatile int v;
+#endif
i = 0;
v = 1;