selfhost/cmd/w6l: strip *arena cascade (γ-4)
amalloc has 0 callers post-γ-2; the *arena threaded through w6l's mklnk/resolvelib/cstrtostr/elfglobals/dcstrtostr and the lnk.a field are vestigial. Drop `import mem;` from sym/main/obj/dyn/dynout, remove lnk.a struct field, strip *arena from the five signatures, update 13 call sites. Drop a dead `let a: *arena = l.a;` in dynout. Comments at pass.ww/obj.ww/main.ww retidied to match post-strip reality. main.combined.ww auto-regenerated. Verified 132/132 incl. 992_w6l_ww + 996_dyn_ww + 995_self_rebuild byte-identity.
This commit is contained in:
@@ -10,7 +10,6 @@ package main;
|
||||
|
||||
import os;
|
||||
import rt;
|
||||
import mem;
|
||||
import sym;
|
||||
import obj;
|
||||
import dyn;
|
||||
@@ -20,8 +19,8 @@ import out;
|
||||
def BASE: u64 = 4194304u64; // 0x400000
|
||||
def CODE_VA_OFF: u64 = 4096u64; // .text starts at base + 0x1000
|
||||
|
||||
fn mklnk(a: *arena) *lnk = {
|
||||
let l: *lnk = alloc(lnk { a = a })!;
|
||||
fn mklnk() *lnk = {
|
||||
let l: *lnk = alloc(lnk { })!;
|
||||
return l;
|
||||
};
|
||||
|
||||
@@ -128,9 +127,9 @@ fn islinkable(path: *u8) bool = {
|
||||
};
|
||||
|
||||
// Walk libdirs[0..n) trying lib<name>.so, then lib<name>.so.{0..8},
|
||||
// then lib<name>.a. Return arena-owned NUL-terminated path on success,
|
||||
// nil on miss.
|
||||
fn resolvelib(a: *arena, name: *u8, libdirs: **u8, nlibdirs: i32) *u8 = {
|
||||
// then lib<name>.a. Return a heap-allocated NUL-terminated path on
|
||||
// success, nil on miss.
|
||||
fn resolvelib(name: *u8, libdirs: **u8, nlibdirs: i32) *u8 = {
|
||||
let bufp: []u8 = alloc([], 1024u64)!;
|
||||
bufp.len = 1024;
|
||||
let i: i32 = 0;
|
||||
@@ -268,8 +267,7 @@ export fn main(argc: i32, argv: **u8) i32 = {
|
||||
return 2;
|
||||
};
|
||||
|
||||
let a: *arena = newarena();
|
||||
let l: *lnk = mklnk(a);
|
||||
let l: *lnk = mklnk();
|
||||
|
||||
// Seed _start so libwwrt-style start.o is recognised as wanted.
|
||||
intern(l, "_start");
|
||||
@@ -287,7 +285,7 @@ export fn main(argc: i32, argv: **u8) i32 = {
|
||||
// objects register their exports.
|
||||
let lf: i32 = 0;
|
||||
for (lf < nlflags) {
|
||||
let p: *u8 = resolvelib(a, lflags[lf], libdirs.ptr, nlibdirs);
|
||||
let p: *u8 = resolvelib(lflags[lf], libdirs.ptr, nlibdirs);
|
||||
if (p == nil) {
|
||||
os.write(2, "w6l: cannot find -l".ptr, 18u64);
|
||||
let nm: *u8 = lflags[lf];
|
||||
|
||||
Reference in New Issue
Block a user