Genode platform fixes (#17521)

* Genode: move dyncall failures to runtime

Do not use the "error" pragma to warn that dynamic library loading is
not implemented, print a message at runtime and exit.

* Genode: use stricter dataspace type in page allocator

* Genode: remove compiler configuration from nim.cfg

Self-hosting Nim is not supported on Genode and defining the
cross-compilation environment can be done externally.

* Genode: use new mutex API

* Genode: call nim_component_construct as a C procedure

* Genode: implement echo for NimStringV2
This commit is contained in:
Emery Hemingway 2021-04-09 16:29:10 +02:00 • committed by GitHub
commit 8aa5991bea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 60 additions and 53 deletions

View file

@ -1103,15 +1103,21 @@ proc genEcho(p: BProc, n: PNode) =
# echo directly to the Genode LOG session
var args: Rope = nil
var a: TLoc
for it in n.sons:
for i, it in n.sons:
if it.skipConv.kind == nkNilLit:
args.add(", \"\"")
else:
elif n.len != 0:
initLocExpr(p, it, a)
args.add(ropecg(p.module, ", Genode::Cstring($1->data, $1->len)", [rdLoc(a)]))
if i > 0:
args.add(", ")
case detectStrVersion(p.module)
of 2:
args.add(ropecg(p.module, "Genode::Cstring($1.p->data, $1.len)", [a.rdLoc]))
else:
args.add(ropecg(p.module, "Genode::Cstring($1->data, $1->len)", [a.rdLoc]))
p.module.includeHeader("<base/log.h>")
p.module.includeHeader("<util/string.h>")
linefmt(p, cpsStmts, """Genode::log(""$1);$n""", [args])
linefmt(p, cpsStmts, """Genode::log($1);$n""", [args])
else:
if n.len == 0:
linefmt(p, cpsStmts, "#echoBinSafe(NIM_NIL, $1);$n", [n.len])