w6l: dynamic e_entry rebases with the actual text offset, both stages

When the dynamic section pushed the header past the first page, the
entry point kept its first-page address — every sufficiently large
dynamic binary SIGSEGV'd into the headers. Recompute e_entry as
entry - 0x1000 + text_off in both stages (ELF: the entry must point
into .text wherever it lands). Both stages move in one commit: one
ELF contract; the 989_dynentry gate pins the field and the run.
This commit is contained in:
2026-06-13 10:17:51 +09:00
parent 95da870734
commit 675a0368cd
5 changed files with 222 additions and 3 deletions

View File

@@ -265,6 +265,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_enumcap_run \
$(BIN)/test_wwdumpgate_run \
$(BIN)/test_datargate_run \
$(BIN)/test_dynentry_run \
$(BIN)/test_ampfncollide_run \
$(BIN)/test_trycallcollide_run \
$(BIN)/test_gunsigned_run \
@@ -846,6 +847,19 @@ $(BIN)/test_datargate_run: test/wcc/989_datargate_run.c \
$(BIN)/w6a $(BIN)/w6a_ww | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_dynentry_run (#63, F15 c6): w6l's dynamic e_entry is rebased onto the
# actual .text file offset once the dynamic headers overflow the first page,
# instead of the stale base+0x1000+val (which mapped into the headers →
# SIGSEGV). BOTH stages (#263). Builds + runs ~160-dyn-sym binaries on both
# driver twins and asserts exit 42 + byte-identical output (rule-10). Skips
# without libc. See the test header.
$(BIN)/test_dynentry_run: test/wcc/989_dynentry_run.c \
$(BIN)/ww $(BIN)/ww_ww \
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
$(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_ampfncollide_run (#4, c2): `&fn` synthesis (unoptype TK_AMP +
# assignableaddrfn) prefers the current module's fn when a same-leaf fn is
# declared in a later module. Builds/rejects on BOTH driver twins (rule-10).