diff --git a/compiler/build/src/link.rs b/compiler/build/src/link.rs index 54af7c5872..e09c6bb048 100644 --- a/compiler/build/src/link.rs +++ b/compiler/build/src/link.rs @@ -403,6 +403,7 @@ fn link_linux( "--eh-frame-hdr", "-arch", arch_str(target), + "-pie", libcrt_path.join("crti.o").to_str().unwrap(), libcrt_path.join("crtn.o").to_str().unwrap(), ]) diff --git a/compiler/build/src/program.rs b/compiler/build/src/program.rs index 42e1e5eab2..75164b5ba3 100644 --- a/compiler/build/src/program.rs +++ b/compiler/build/src/program.rs @@ -230,6 +230,7 @@ pub fn gen_from_mono_module( .unwrap(); let llc_args = &[ + "-relocation-model=pic", "-filetype=obj", app_bc_file.to_str().unwrap(), "-o", diff --git a/linker/src/lib.rs b/linker/src/lib.rs index a56e4edad8..ce3d0b7962 100644 --- a/linker/src/lib.rs +++ b/linker/src/lib.rs @@ -1183,11 +1183,6 @@ pub fn surgery(matches: &ArgMatches) -> io::Result { } 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 => { println!("Relocation Kind not yet support: {:?}", x); return Ok(-1);