Merge branch 'master' into 'master'
fix(ld_so): minor fixes See merge request redox-os/relibc!839
This commit is contained in:
+4
-6
@@ -70,17 +70,14 @@ global_asm!(
|
||||
"
|
||||
.globl _start
|
||||
_start:
|
||||
# rsi = _start + 5
|
||||
call 2f
|
||||
2: pop rsi
|
||||
lea rsi, [rip + _start]
|
||||
|
||||
# Save original stack and align stack to 16 bytes
|
||||
mov rbp, rsp
|
||||
and rsp, 0xFFFFFFFFFFFFFFF0
|
||||
and rsp, 0xfffffffffffffff0
|
||||
|
||||
# Call ld_so_start(stack, entry)
|
||||
# Call ld_so_start(stack=rdi, ld_entry=rsi)
|
||||
mov rdi, rbp
|
||||
sub rsi, 5
|
||||
call relibc_ld_so_start
|
||||
|
||||
# Restore original stack, clear registers, and jump to new start function
|
||||
@@ -95,6 +92,7 @@ _start:
|
||||
xor r11, r11
|
||||
fninit
|
||||
jmp rax
|
||||
ud2
|
||||
"
|
||||
);
|
||||
|
||||
|
||||
+1
-1
@@ -819,7 +819,7 @@ impl Linker {
|
||||
|
||||
if let Some(master) = tcb_master {
|
||||
if !dlopened {
|
||||
self.tls_size += master.offset; // => aligned ph.p_memsz
|
||||
self.tls_size = master.offset; // => aligned ph.p_memsz
|
||||
}
|
||||
|
||||
tcb_masters.push(master);
|
||||
|
||||
+3
-3
@@ -269,8 +269,8 @@ pub unsafe extern "C" fn relibc_ld_so_start(sp: &'static mut Stack, ld_entry: us
|
||||
let entry = match linker.load_program(&path, base_addr) {
|
||||
Ok(entry) => entry,
|
||||
Err(err) => {
|
||||
eprintln!("ld.so: failed to link '{}': {:?}", path, err);
|
||||
eprintln!("ld.so: enable debug output with `LD_DEBUG=all` for more information");
|
||||
eprintln!("[ld.so]: failed to link '{}': {:?}", path, err);
|
||||
eprintln!("[ld.so]: enable debug output with `LD_DEBUG=all` for more information");
|
||||
unistd::_exit(1);
|
||||
}
|
||||
};
|
||||
@@ -279,7 +279,7 @@ pub unsafe extern "C" fn relibc_ld_so_start(sp: &'static mut Stack, ld_entry: us
|
||||
tcb.mspace = ALLOCATOR.get();
|
||||
}
|
||||
if is_manual {
|
||||
eprintln!("ld.so: entry '{}': {:#x}", path, entry);
|
||||
eprintln!("[ld.so]: entry '{}': {:#x}", path, entry);
|
||||
}
|
||||
entry
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user