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,6 +1,4 @@
|
||||
/*
|
||||
* obj.c — emit a tiny ELF64 relocatable object.
|
||||
*
|
||||
* Layout (in file order):
|
||||
* [0] ELF header
|
||||
* [1] Section .text (program bytes)
|
||||
@@ -24,7 +22,6 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* ELF constants */
|
||||
#define ELFMAG "\x7f""ELF"
|
||||
#define ELFCLASS64 2
|
||||
#define ELFDATA2LSB 1
|
||||
@@ -54,7 +51,6 @@
|
||||
#define R_X86_64_PLT32 4
|
||||
#define ELF64_R_INFO(s,t) (((u64)(s) << 32) | ((u64)(t) & 0xffffffff))
|
||||
|
||||
/* growable byte buffer */
|
||||
typedef struct Buf Buf;
|
||||
struct Buf { u8 *p; size_t n, cap; };
|
||||
|
||||
@@ -157,10 +153,9 @@ a_emit_elf(Asm *a, FILE *f)
|
||||
bput(&sym, &z, sizeof z);
|
||||
}
|
||||
|
||||
/* Build symbols (defined = global; undefined = global UND). Data
|
||||
* symbols carry STT_OBJECT and st_shndx=SH_DATA; everything else
|
||||
* keeps the legacy STT_FUNC/SH_TEXT shape so non-DATAW outputs
|
||||
* stay byte-identical. */
|
||||
/* Data symbols carry STT_OBJECT and st_shndx=SH_DATA; everything
|
||||
* else keeps the legacy STT_FUNC/SH_TEXT shape so non-DATAW
|
||||
* outputs stay byte-identical. */
|
||||
int idx = 1;
|
||||
for (Asym *s = a->syms; s; s = s->next) {
|
||||
Sym64 e = {0};
|
||||
@@ -193,7 +188,6 @@ a_emit_elf(Asm *a, FILE *f)
|
||||
bput(r->section == 1 ? &relad : &rela, &re, sizeof re);
|
||||
}
|
||||
|
||||
/* Layout offsets in the file */
|
||||
u64 off = sizeof(Ehdr);
|
||||
u64 off_text = off; off += a->textlen;
|
||||
u64 off_rela = off; off += rela.n;
|
||||
@@ -202,7 +196,6 @@ a_emit_elf(Asm *a, FILE *f)
|
||||
u64 off_sym = off; off += sym.n;
|
||||
u64 off_str = off; off += str.n;
|
||||
u64 off_shstr= off; off += shstr.n;
|
||||
/* align to 8 */
|
||||
while (off % 8) off++;
|
||||
u64 off_shdr = off;
|
||||
const int NSECT = has_data
|
||||
|
||||
Reference in New Issue
Block a user