toolchain: banner purge + WHY-only comment sweep (rule 8)
selfhost/, cmd/, internal/ join the tree-wide sweep: every section banner dies (91 selfhost + the cmd C-style dividers -> 0); narration and stale contracts deleted (pre-#22 bundler notes, retired single-PT_LOAD and no-archive claims, superseded ABI tables); every ref/harec/qbe cite, task cite, encoding/ELF contract, and rule-10 twin pointer kept; lost lifetime/rationale lines restored where the sweep over-cut (elf_globals ownership, kwtab linear-scan). Comment- only proven: all five wwstage tool binaries byte-identical across the sweep; test-commit, test-byteid (161+1399, 0 pinned-divergent), and test-bootstrap (fixed point + 991-995 byte-id) all exit 0. The read-through banked 66 latent-bug leads (checkpoint).
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
// selfhost/cmd/w6l/dyn.ww — port of cmd/w6l/dyn.c.
|
||||
// Port of cmd/w6l/dyn.c.
|
||||
//
|
||||
// Load a shared object (ET_DYN) so the linker knows which symbols it
|
||||
// exports and which DT_NEEDED entry to record. We do not pull bytes
|
||||
// from the .so; the dynamic loader maps it at runtime.
|
||||
//
|
||||
// Each call appends one lso to lnk->sos. l_so_provides_v answers
|
||||
// "does this .so export the named symbol, and at which version?" —
|
||||
// l_resolve uses that to promote unresolved references to dynamic.
|
||||
|
||||
package w6l;
|
||||
|
||||
@@ -72,8 +68,6 @@ def VD_NEXT: u64 = 16u64;
|
||||
def VA_NAME: u64 = 0u64;
|
||||
def VA_NEXT: u64 = 4u64;
|
||||
|
||||
// ---- little-endian byte readers ---------------------------------------
|
||||
|
||||
fn du16(p: *u8, off: u64) u16 = {
|
||||
let b0: u16 = p[off]: u16;
|
||||
let b1: u16 = p[off + 1u64]: u16;
|
||||
@@ -98,8 +92,6 @@ fn di64(p: *u8, off: u64) i64 = {
|
||||
return du64(p, off): i64;
|
||||
};
|
||||
|
||||
// ---- C-string helpers --------------------------------------------------
|
||||
|
||||
fn dcstrlen(p: *u8) u64 = {
|
||||
let n: u64 = 0u64;
|
||||
for (p[n] != 0u8) { n += 1u64; };
|
||||
@@ -114,7 +106,6 @@ fn dcstrtostr(p: *u8) str = {
|
||||
return strings.dup(view);
|
||||
};
|
||||
|
||||
// basename: scan for last '/' and return pointer past it.
|
||||
fn dbasename(p: *u8) *u8 = {
|
||||
let n: u64 = dcstrlen(p);
|
||||
let i: u64 = n;
|
||||
@@ -127,8 +118,6 @@ fn dbasename(p: *u8) *u8 = {
|
||||
return p;
|
||||
};
|
||||
|
||||
// ---- file slurp --------------------------------------------------------
|
||||
|
||||
fn slurpso(path: *u8) (*u8, u64) = {
|
||||
let fd: i32 = os.open(pathstr(path), os.flag.RDONLY, 0i32);
|
||||
if (fd < 0) { return nil, 0u64; };
|
||||
@@ -151,8 +140,6 @@ fn slurpso(path: *u8) (*u8, u64) = {
|
||||
return buf.ptr, n: u64;
|
||||
};
|
||||
|
||||
// ---- verdef helpers ----------------------------------------------------
|
||||
|
||||
// vdnameat — walk verdef records and return the name (as *u8 into
|
||||
// the .so's verstr buffer) for the entry whose vd_ndx == ndx. The name
|
||||
// is the first Verdaux's vda_name (subsequent auxes are predecessor
|
||||
@@ -176,8 +163,6 @@ fn vdnameat(buf: *u8, verdefoff: u64, verdefsize: u64,
|
||||
return nil;
|
||||
};
|
||||
|
||||
// ---- entry points ------------------------------------------------------
|
||||
|
||||
export fn loadso(l: *lnk, path: *u8) i32 = {
|
||||
let buf: *u8;
|
||||
let blen: u64;
|
||||
@@ -207,7 +192,6 @@ export fn loadso(l: *lnk, path: *u8) i32 = {
|
||||
if (shoff == 0u64) { return soerr("stripped .so unsupported"); };
|
||||
if (shnum == 0u32) { return soerr("stripped .so unsupported"); };
|
||||
|
||||
// Locate the four sections we care about.
|
||||
let idxdynsym: i32 = -1;
|
||||
let idxdynamic: i32 = -1;
|
||||
let idxversym: i32 = -1;
|
||||
@@ -292,8 +276,8 @@ export fn loadso(l: *lnk, path: *u8) i32 = {
|
||||
verstr = buf + vstroff;
|
||||
};
|
||||
|
||||
// Build the lso. Exports are appended in dynsym order so
|
||||
// soprovides_v's first-match semantics match the C version.
|
||||
// Exports are appended in dynsym order so soprovides_v's
|
||||
// first-match semantics match the C version.
|
||||
let so: *lso = alloc(lso { path = dcstrtostr(path), soname = dcstrtostr(sonamecs) })!;
|
||||
let tail: *lexport = nil;
|
||||
|
||||
@@ -371,7 +355,6 @@ fn soerr(msg: str) i32 = {
|
||||
return -1;
|
||||
};
|
||||
|
||||
// soprovides — 1 if so exports name, 0 otherwise.
|
||||
export fn soprovides(so: *lso, name: str) i32 = {
|
||||
if (so == nil) { return 0; };
|
||||
let e: *lexport = so.exports;
|
||||
|
||||
Reference in New Issue
Block a user