Make debug output and linking properly pic/pie. Remove non-pic relocation from linker

This commit is contained in:
Brendan Hansknecht 2021-08-27 23:21:48 -07:00
parent 7d34c88e64
commit 379904fcc5
3 changed files with 2 additions and 5 deletions

View file

@ -403,6 +403,7 @@ fn link_linux(
"--eh-frame-hdr", "--eh-frame-hdr",
"-arch", "-arch",
arch_str(target), arch_str(target),
"-pie",
libcrt_path.join("crti.o").to_str().unwrap(), libcrt_path.join("crti.o").to_str().unwrap(),
libcrt_path.join("crtn.o").to_str().unwrap(), libcrt_path.join("crtn.o").to_str().unwrap(),
]) ])

View file

@ -230,6 +230,7 @@ pub fn gen_from_mono_module(
.unwrap(); .unwrap();
let llc_args = &[ let llc_args = &[
"-relocation-model=pic",
"-filetype=obj", "-filetype=obj",
app_bc_file.to_str().unwrap(), app_bc_file.to_str().unwrap(),
"-o", "-o",

View file

@ -1183,11 +1183,6 @@ pub fn surgery(matches: &ArgMatches) -> io::Result<i32> {
} }
target_offset - base_offset + rel.1.addend() target_offset - base_offset + rel.1.addend()
} }
RelocationKind::Absolute => {
let target_vaddr = target_offset + new_segment_vaddr as i64;
println!("Target: 0x{:x}", target_vaddr);
target_vaddr
}
x => { x => {
println!("Relocation Kind not yet support: {:?}", x); println!("Relocation Kind not yet support: {:?}", x);
return Ok(-1); return Ok(-1);