fn rename_symbol(symbol: impl AsRef<OsStr>, lib: impl AsRef<Path>) {
	// Get access to llvm tools shipped in the llvm-tools-preview rustup component
	let llvm_tools = match llvm_tools::LlvmTools::new() {
		Ok(tools) => tools,
		Err(llvm_tools::Error::NotFound) => {
			eprintln!("Error: llvm-tools not found");
			eprintln!("Maybe the rustup component `llvm-tools-preview` is missing?");
			eprintln!("  Install it through: `rustup component add llvm-tools-preview`");
			process::exit(1);
		}
		Err(err) => {
			eprintln!("Failed to retrieve llvm-tools component: {:?}", err);
			process::exit(1);
		}
	};

	// Retrieve path of llvm-objcopy
	let llvm_objcopy = llvm_tools
		.tool(&llvm_tools::exe("llvm-objcopy"))
		.expect("llvm-objcopy not found in llvm-tools");

	// Rename symbols
	let arg = IntoIterator::into_iter([symbol.as_ref(), "=kernel-".as_ref(), symbol.as_ref()])
		.collect::<OsString>();
	let status = Command::new(llvm_objcopy)
		.arg("--redefine-sym")
		.arg(arg)
		.arg(lib.as_ref())
		.status()
		.expect("failed to execute llvm-objcopy");
	assert!(status.success(), "llvm-objcopy was not successful");
}
/// Kernel and user space has its own versions of panic handler, oom handler, memcpy, memset, etc,
/// Consequently, we rename the functions in the libos to avoid collisions.
/// In addition, it provides us the offer to create a optimized version of memcpy
/// in user space.
Kernel and user space has its own versions of panic handler, oom handler, memcpy, memset, etc,
Consequently, we rename the functions in the libos to avoid collisions.
In addition, it provides us the offer to create a optimized version of memcpy
in user space.
Kernel and user space has its own versions of panic handler oom handler memcpy memset etc Consequently we rename the functions in the libos to avoid collisions . In addition it provides us the offer to create a optimized version of memcpy in user space .
fn rename_symbol(symbol: impl AsRef<OsStr>, lib: impl AsRef<Path>) {
	// Get access to llvm tools shipped in the llvm-tools-preview rustup component
	let llvm_tools = match llvm_tools::LlvmTools::new() {
		Ok(tools) => tools,
		Err(llvm_tools::Error::NotFound) => {
			eprintln!("Error: llvm-tools not found");
			eprintln!("Maybe the rustup component `llvm-tools-preview` is missing?");
			eprintln!("  Install it through: `rustup component add llvm-tools-preview`");
			process::exit(1);
		}
		Err(err) => {
			eprintln!("Failed to retrieve llvm-tools component: {:?}", err);
			process::exit(1);
		}
	};
	// Retrieve path of llvm-objcopy
	let llvm_objcopy = llvm_tools
		.tool(&llvm_tools::exe("llvm-objcopy"))
		.expect("llvm-objcopy not found in llvm-tools");
	// Rename symbols
	let arg = IntoIterator::into_iter([symbol.as_ref(), "=kernel-".as_ref(), symbol.as_ref()])
		.collect::<OsString>();
	let status = Command::new(llvm_objcopy)
		.arg("--redefine-sym")
		.arg(arg)
		.arg(lib.as_ref())
		.status()
		.expect("failed to execute llvm-objcopy");
	assert!(status.success(), "llvm-objcopy was not successful");
}
fn rename_symbol ( symbol : impl AsRef < OsStr > , lib : impl AsRef < Path > ) { // Get access to llvm tools shipped in the llvm-tools-preview rustup component let llvm_tools = match llvm_tools :: LlvmTools :: new ( ) { Ok ( tools ) => tools , Err ( llvm_tools :: Error :: NotFound ) => { eprintln ! ( " " ) ; eprintln ! ( " " ) ; eprintln ! ( " " ) ; process :: exit ( 1 ) ; } Err ( err ) => { eprintln ! ( " " err ) ; process :: exit ( 1 ) ; } } ; // Retrieve path of llvm-objcopy let llvm_objcopy = llvm_tools . tool ( & llvm_tools :: exe ( " " ) ) . expect ( " " ) ; // Rename symbols let arg = IntoIterator :: into_iter ( [ symbol . as_ref ( ) , " " . as_ref ( ) , symbol . as_ref ( ) ] ) . collect :: < OsString > ( ) ; let status = Command :: new ( llvm_objcopy ) . arg ( " " ) . arg ( arg ) . arg ( lib . as_ref ( ) ) . status ( ) . expect ( " " ) ; assert ! ( status success ( ) " " ) ; }
Kernel and user space has its own versions of panic handler, oom handler, memcpy, memset, etc,
Consequently, we rename the functions in the libos to avoid collisions.
Kernel and user space has its own versions of panic handler oom handler memcpy memset etc Consequently we rename the functions in the libos to avoid collisions .
symbol
impl AsRef<OsStr>
lib
impl AsRef<Path>
symbol
impl AsRef<OsStr>
lib
impl AsRef<Path>