w6l/dynout: restore def INTERP after wwstage cgen def-str fix
This commit is contained in:
@@ -21,15 +21,6 @@
|
|||||||
// [pad to next page]
|
// [pad to next page]
|
||||||
// [gotplt_off] .got.plt (writable; mapped by PT_LOAD #2)
|
// [gotplt_off] .got.plt (writable; mapped by PT_LOAD #2)
|
||||||
// [dynamic_off] .dynamic (writable; covered by PT_DYNAMIC)
|
// [dynamic_off] .dynamic (writable; covered by PT_DYNAMIC)
|
||||||
//
|
|
||||||
// cgen workaround notes:
|
|
||||||
// - Two-level field assignments through pointers (e.g. r.sym.isdyn = 1)
|
|
||||||
// silently fail in the current wwstage cgen. We bind the inner
|
|
||||||
// pointer to a local first: `let sym = r.sym; sym.isdyn = 1;`
|
|
||||||
// - Tuple returns of (i32, str) drop the str payload. soversion
|
|
||||||
// returns a plain str instead.
|
|
||||||
// - `def NAME: str = "...";` produces a bogus str (len ends up adding
|
|
||||||
// to an offset accumulator). We use a fn returning the literal.
|
|
||||||
|
|
||||||
use os;
|
use os;
|
||||||
use mem;
|
use mem;
|
||||||
@@ -79,11 +70,7 @@ def STT_FUNC_D: u8 = 2u8;
|
|||||||
def PLT_STUB_BYTES_D: u64 = 8u64;
|
def PLT_STUB_BYTES_D: u64 = 8u64;
|
||||||
def PAGE: u64 = 4096u64;
|
def PAGE: u64 = 4096u64;
|
||||||
|
|
||||||
// The PT_INTERP literal. Returned via a fn to dodge `def : str = "..."`
|
def INTERP: str = "/lib64/ld-linux-x86-64.so.2";
|
||||||
// breakage in the current cgen.
|
|
||||||
fn interpstrv() str = {
|
|
||||||
return "/lib64/ld-linux-x86-64.so.2";
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- byte writers ------------------------------------------------------
|
// ---- byte writers ------------------------------------------------------
|
||||||
|
|
||||||
@@ -421,8 +408,7 @@ export fn emitdynelf(l: *lnk, fd: i32, base: u64, entry: u64) i32 = {
|
|||||||
let ehdrsz: u64 = 64u64;
|
let ehdrsz: u64 = 64u64;
|
||||||
let nphdrs: u64 = 4u64;
|
let nphdrs: u64 = 4u64;
|
||||||
let phdrsz: u64 = nphdrs * 56u64;
|
let phdrsz: u64 = nphdrs * 56u64;
|
||||||
let islocal: str = interpstrv();
|
let interpsz: u64 = (INTERP.len: u64) + 1u64;
|
||||||
let interpsz: u64 = (islocal.len: u64) + 1u64;
|
|
||||||
|
|
||||||
let nsymstotal: u64 = 1u64 + nu;
|
let nsymstotal: u64 = 1u64 + nu;
|
||||||
let dynsymsz: u64 = nsymstotal * 24u64;
|
let dynsymsz: u64 = nsymstotal * 24u64;
|
||||||
@@ -717,9 +703,8 @@ export fn emitdynelf(l: *lnk, fd: i32, base: u64, entry: u64) i32 = {
|
|||||||
dwr64(filebuf, p3 + 48u64, 8u64);
|
dwr64(filebuf, p3 + 48u64, 8u64);
|
||||||
|
|
||||||
// Sections.
|
// Sections.
|
||||||
let interplocal: str = interpstrv();
|
dbcopy(filebuf, interpoff, INTERP.ptr, INTERP.len: u64);
|
||||||
dbcopy(filebuf, interpoff, interplocal.ptr, interplocal.len: u64);
|
dwr8(filebuf, interpoff + (INTERP.len: u64), 0u8);
|
||||||
dwr8(filebuf, interpoff + (interplocal.len: u64), 0u8);
|
|
||||||
dbcopy(filebuf, dynstroff, dynstr, dynstrsz);
|
dbcopy(filebuf, dynstroff, dynstr, dynstrsz);
|
||||||
dbcopy(filebuf, dynsymoff, dynsymbuf, dynsymsz);
|
dbcopy(filebuf, dynsymoff, dynsymbuf, dynsymsz);
|
||||||
dbcopy(filebuf, hashoff, hashbuf, hashsz);
|
dbcopy(filebuf, hashoff, hashbuf, hashsz);
|
||||||
|
|||||||
@@ -1447,15 +1447,6 @@ export fn relocate(l: *lnk, base: u64) i32 = {
|
|||||||
// [pad to next page]
|
// [pad to next page]
|
||||||
// [gotplt_off] .got.plt (writable; mapped by PT_LOAD #2)
|
// [gotplt_off] .got.plt (writable; mapped by PT_LOAD #2)
|
||||||
// [dynamic_off] .dynamic (writable; covered by PT_DYNAMIC)
|
// [dynamic_off] .dynamic (writable; covered by PT_DYNAMIC)
|
||||||
//
|
|
||||||
// cgen workaround notes:
|
|
||||||
// - Two-level field assignments through pointers (e.g. r.sym.isdyn = 1)
|
|
||||||
// silently fail in the current wwstage cgen. We bind the inner
|
|
||||||
// pointer to a local first: `let sym = r.sym; sym.isdyn = 1;`
|
|
||||||
// - Tuple returns of (i32, str) drop the str payload. soversion
|
|
||||||
// returns a plain str instead.
|
|
||||||
// - `def NAME: str = "...";` produces a bogus str (len ends up adding
|
|
||||||
// to an offset accumulator). We use a fn returning the literal.
|
|
||||||
|
|
||||||
use os;
|
use os;
|
||||||
use mem;
|
use mem;
|
||||||
@@ -1505,11 +1496,7 @@ def STT_FUNC_D: u8 = 2u8;
|
|||||||
def PLT_STUB_BYTES_D: u64 = 8u64;
|
def PLT_STUB_BYTES_D: u64 = 8u64;
|
||||||
def PAGE: u64 = 4096u64;
|
def PAGE: u64 = 4096u64;
|
||||||
|
|
||||||
// The PT_INTERP literal. Returned via a fn to dodge `def : str = "..."`
|
def INTERP: str = "/lib64/ld-linux-x86-64.so.2";
|
||||||
// breakage in the current cgen.
|
|
||||||
fn interpstrv() str = {
|
|
||||||
return "/lib64/ld-linux-x86-64.so.2";
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---- byte writers ------------------------------------------------------
|
// ---- byte writers ------------------------------------------------------
|
||||||
|
|
||||||
@@ -1847,8 +1834,7 @@ export fn emitdynelf(l: *lnk, fd: i32, base: u64, entry: u64) i32 = {
|
|||||||
let ehdrsz: u64 = 64u64;
|
let ehdrsz: u64 = 64u64;
|
||||||
let nphdrs: u64 = 4u64;
|
let nphdrs: u64 = 4u64;
|
||||||
let phdrsz: u64 = nphdrs * 56u64;
|
let phdrsz: u64 = nphdrs * 56u64;
|
||||||
let islocal: str = interpstrv();
|
let interpsz: u64 = (INTERP.len: u64) + 1u64;
|
||||||
let interpsz: u64 = (islocal.len: u64) + 1u64;
|
|
||||||
|
|
||||||
let nsymstotal: u64 = 1u64 + nu;
|
let nsymstotal: u64 = 1u64 + nu;
|
||||||
let dynsymsz: u64 = nsymstotal * 24u64;
|
let dynsymsz: u64 = nsymstotal * 24u64;
|
||||||
@@ -2143,9 +2129,8 @@ export fn emitdynelf(l: *lnk, fd: i32, base: u64, entry: u64) i32 = {
|
|||||||
dwr64(filebuf, p3 + 48u64, 8u64);
|
dwr64(filebuf, p3 + 48u64, 8u64);
|
||||||
|
|
||||||
// Sections.
|
// Sections.
|
||||||
let interplocal: str = interpstrv();
|
dbcopy(filebuf, interpoff, INTERP.ptr, INTERP.len: u64);
|
||||||
dbcopy(filebuf, interpoff, interplocal.ptr, interplocal.len: u64);
|
dwr8(filebuf, interpoff + (INTERP.len: u64), 0u8);
|
||||||
dwr8(filebuf, interpoff + (interplocal.len: u64), 0u8);
|
|
||||||
dbcopy(filebuf, dynstroff, dynstr, dynstrsz);
|
dbcopy(filebuf, dynstroff, dynstr, dynstrsz);
|
||||||
dbcopy(filebuf, dynsymoff, dynsymbuf, dynsymsz);
|
dbcopy(filebuf, dynsymoff, dynsymbuf, dynsymsz);
|
||||||
dbcopy(filebuf, hashoff, hashbuf, hashsz);
|
dbcopy(filebuf, hashoff, hashbuf, hashsz);
|
||||||
|
|||||||
Reference in New Issue
Block a user