mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-21 23:56:18 +04:00
Adapt fill_symbols for macOS
This commit is contained in:
parent
611c2dd5bf
commit
81c77586c6
@ -337,7 +337,7 @@ kernel: $(dtb)
|
||||
ifeq ($(arch), x86_64)
|
||||
@bootimage build $(build_args)
|
||||
@echo "Now patching kernel symbols onto kernel."
|
||||
../tools/fill_symbols/x86_64.sh target/x86_64/$(mode)/rcore
|
||||
@../tools/fill_symbols/x86_64.sh target/x86_64/$(mode)/rcore
|
||||
@echo "Generate bootimage again."
|
||||
@bootimage build $(build_args)
|
||||
@mv target/x86_64/bootimage.bin $(bootimage)
|
||||
|
@ -189,8 +189,9 @@ impl Thread {
|
||||
let (mut vm, bias) = elf.make_memory_set(inode);
|
||||
|
||||
// Check interpreter (for dynamic link)
|
||||
// When interpreter is used, map both dynamic linker and executable
|
||||
if let Ok(loader_path) = elf.get_interpreter() {
|
||||
info!("Handling interpreter... bias={:x}", bias);
|
||||
info!("Handling interpreter... offset={:x}", bias);
|
||||
// assuming absolute path
|
||||
let interp_inode = crate::fs::ROOT_INODE
|
||||
.lookup_follow(loader_path, FOLLOW_MAX_DEPTH)
|
||||
@ -203,12 +204,11 @@ impl Thread {
|
||||
.map_err(|_| "failed to read from INode")?;
|
||||
let elf_interp = ElfFile::new(&interp_data)?;
|
||||
elf_interp.append_as_interpreter(&interp_inode, &mut vm, bias);
|
||||
info!("entry: {:x}", elf.header.pt2.entry_point() as usize);
|
||||
debug!("entry point: {:x}", elf.header.pt2.entry_point() as usize);
|
||||
auxv.insert(abi::AT_ENTRY, elf.header.pt2.entry_point() as usize);
|
||||
auxv.insert(abi::AT_BASE, bias);
|
||||
entry_addr = elf_interp.header.pt2.entry_point() as usize + bias;
|
||||
}
|
||||
debug!("{:#x?}", vm);
|
||||
|
||||
// User stack
|
||||
use crate::consts::{USER_STACK_OFFSET, USER_STACK_SIZE};
|
||||
@ -239,8 +239,6 @@ impl Thread {
|
||||
vm.with(|| ustack_top = init_info.push_at(ustack_top));
|
||||
}
|
||||
|
||||
trace!("{:#x?}", vm);
|
||||
|
||||
Ok((vm, entry_addr, ustack_top))
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,26 @@
|
||||
#!/bin/bash
|
||||
objdump=objdump
|
||||
nm=nm
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
objdump=/usr/local/opt/binutils/bin/objdump
|
||||
nm=/usr/local/opt/binutils/bin/nm
|
||||
if hash $objdump 2>/dev/null; then
|
||||
echo "Found GNU objdump"
|
||||
else
|
||||
echo "No GNU objdump found, use brew install binutils"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Filling kernel symbols."
|
||||
rcore=$1
|
||||
tmpfile=$(mktemp /tmp/rcore-symbols.txt.XXXXXX)
|
||||
echo "Writing symbol table."
|
||||
nm $1 >$tmpfile
|
||||
$nm $1 >$tmpfile
|
||||
gzip $tmpfile
|
||||
tmpfile=$tmpfile.gz
|
||||
symbol_table_loc=$((16#$(objdump -D $rcore -j .data -F |grep "<rcore_symbol_table>" |grep -oEi "0x[0-9a-f]+" |grep -oEi "[0-9a-f][0-9a-f]+")))
|
||||
symbol_table_size_loc=$((16#$(objdump -D $rcore -j .data -F |grep "<rcore_symbol_table_size>" |grep -oEi "0x[0-9a-f]+" |grep -oEi "[0-9a-f][0-9a-f]+")))
|
||||
symbol_table_loc=$((16#$($objdump -D $rcore -j .data -F |grep "<rcore_symbol_table>" |grep -oEi "0x[0-9a-f]+" |grep -oEi "[0-9a-f][0-9a-f]+")))
|
||||
symbol_table_size_loc=$((16#$($objdump -D $rcore -j .data -F |grep "<rcore_symbol_table_size>" |grep -oEi "0x[0-9a-f]+" |grep -oEi "[0-9a-f][0-9a-f]+")))
|
||||
echo $symbol_table_loc
|
||||
echo $symbol_table_size_loc
|
||||
FILESIZE=$(stat -c%s "$tmpfile")
|
||||
|
Loading…
Reference in New Issue
Block a user