w6l: purge dead elf branches; pin rx extent
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
/* Versym special values: 0 = local, 1 = base/global. */
|
||||
#define VER_NDX_LOCAL 0
|
||||
#define VER_NDX_GLOBAL 1
|
||||
#define VER_FLG_BASE 1
|
||||
#define VERSYM_HIDDEN 0x8000
|
||||
#define VERSYM_VERSION 0x7fff
|
||||
|
||||
@@ -208,17 +207,7 @@ l_load_so(Lnk *l, const char *path)
|
||||
} else if (verdef_names != NULL
|
||||
&& (int)vidx <= verdef_max
|
||||
&& verdef_names[vidx] != NULL) {
|
||||
/* index 1 in glibc's Verdef is the SONAME with
|
||||
* VER_FLG_BASE — we skip its export entries
|
||||
* as a side effect of vidx==1 mapping to the
|
||||
* BASE name (e.g. "libc.so.6"), which never
|
||||
* appears as a reference target. Treat any
|
||||
* lookup that lands on the BASE entry as
|
||||
* unversioned. */
|
||||
if (vidx == 1)
|
||||
vername = NULL;
|
||||
else
|
||||
vername = verdef_names[vidx];
|
||||
vername = verdef_names[vidx];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -376,7 +376,6 @@ l_emit_dyn_elf(Lnk *l, FILE *f, u64 base, u64 entry)
|
||||
const u64 gotplt_va = base + gotplt_off;
|
||||
const u64 dynamic_va = base + dynamic_off;
|
||||
const u64 data_va = base + data_off;
|
||||
(void)dynstr_va; (void)hash_va; (void)plt_va;
|
||||
|
||||
/* Now that the dyn layout pins text_va/data_va, apply
|
||||
* relocations. main.c defers this; the static path runs it from
|
||||
@@ -587,6 +586,8 @@ l_emit_dyn_elf(Lnk *l, FILE *f, u64 base, u64 entry)
|
||||
ph[0].p_vaddr = base;
|
||||
ph[0].p_paddr = base;
|
||||
ph[0].p_filesz = rx_end;
|
||||
/* The loader page-rounds mappings; gotplt_off independently starts
|
||||
* the next page, so padding is not part of the R+X extent. */
|
||||
ph[0].p_memsz = rx_end;
|
||||
ph[0].p_align = page;
|
||||
|
||||
|
||||
@@ -80,8 +80,6 @@ l_emit_elf(Lnk *l, FILE *f, u64 base, u64 entry)
|
||||
bsslen++;
|
||||
}
|
||||
const u64 data_file_len = l->datalen - bsslen;
|
||||
const u64 file_end = has_data ? (data_off + data_file_len) : rx_end;
|
||||
(void)data_va;
|
||||
|
||||
Ehdr eh = {0};
|
||||
memcpy(eh.e_ident, "\x7f""ELF", 4);
|
||||
@@ -104,6 +102,8 @@ l_emit_elf(Lnk *l, FILE *f, u64 base, u64 entry)
|
||||
phx.p_vaddr = base;
|
||||
phx.p_paddr = base;
|
||||
phx.p_filesz = rx_end;
|
||||
/* The loader page-rounds mappings; when present, data_off starts
|
||||
* independently on the next page, so padding is not R+X extent. */
|
||||
phx.p_memsz = rx_end;
|
||||
phx.p_align = page;
|
||||
|
||||
@@ -133,7 +133,6 @@ l_emit_elf(Lnk *l, FILE *f, u64 base, u64 entry)
|
||||
for (long i = here; i < (long)data_off; i++) fputc(0, f);
|
||||
fwrite(l->data, 1, data_file_len, f);
|
||||
}
|
||||
(void)file_end;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user