w6l: purge dead elf branches; pin rx extent

This commit is contained in:
2026-08-09 04:37:33 +09:00
parent e720d4802f
commit ac8ddee6c1
8 changed files with 33 additions and 29 deletions

View File

@@ -14,8 +14,8 @@ def SHT_SYMTAB: i32 = 2;
def SHT_STRTAB: i32 = 3;
def SHT_RELA: i32 = 4;
// w6a/w6l use straight LE on amd64. Reading via byte offsets keeps us off
// the cgen's u16 field-load story for now (MOVZBQ exists; MOVZWQ doesn't).
// ELF64/x86-64 is little-endian; bytewise decoding also avoids alignment
// and host-layout assumptions about input buffers.
fn rdu16(p: *u8, off: u64) u16 = {
let b0: u16 = p[off]: u16;
@@ -507,9 +507,8 @@ fn loadimage(l: *lnk, path: *u8, buf: *u8, len: u64) i32 = {
};
};
// We don't keep a per-object map[] of *lsym. Instead the reloc
// loop re-walks symtab and re-interns by name. Simpler than
// dancing around the cgen's u64-shift gaps.
// Rewalking avoids retaining an nsyms-sized per-object map solely
// for relocation lookup.
let si: u64 = 1u64; // skip index 0 (always undef sentinel)
for (si < nsyms) {
let symp: u64 = symoff + si * SYM_SIZE;
@@ -526,7 +525,6 @@ fn loadimage(l: *lnk, path: *u8, buf: *u8, len: u64) i32 = {
if (idxdata >= 0) {
indt = (stshndx: i32) == idxdata;
};
if (intext && indt) { indt = false; };
if (intext) {
if (gs.defined != 0) {
let m: str = "w6l: duplicate symbol\n";