Update linker flags to match the Fuchsia build

This change enables threading (to speed up linking), enables the use
of RELR relocations for target (to reduce the binary size) and applies
fixes for AArch64 Cortex-A53 erratum 843419 when linking for ARM64.

Change-Id: Ibd87ad115239f8a13d12208eca880b614a2e933c
diff --git a/src/lib.rs b/src/lib.rs
index f49912e..7476759 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -355,12 +355,17 @@
 fn get_rustflags(
     target_options: &TargetOptions<'_, '_>, sysroot_as_path: &PathBuf,
 ) -> Result<String, Error> {
-    Ok(format!(
-        "-C link-arg=--target={} -C link-arg=--sysroot={} -Lnative={}",
-        get_target_triple(target_options),
-        sysroot_as_path.to_str().unwrap(),
-        shared_libraries_path(target_options)?.to_str().unwrap(),
-    ))
+    let mut rust_flags = vec![
+        format!("-C link-arg=--target={}", get_target_triple(target_options)),
+        format!("-C link-arg=--sysroot={}", sysroot_as_path.to_str().unwrap()),
+        format!("-Lnative={}", shared_libraries_path(target_options)?.to_str().unwrap()),
+        "-C link-arg=--Wl,--threads".to_string(),
+        "-Clink-arg=-Wl,--pack-dyn-relocs=relr".to_string(),
+    ];
+    if get_triple_cpu(target_options) == "aarch64" {
+        rust_flags.push("-Clink-arg=-Wl,--fix-cortex-a53-843419".to_string());
+    }
+    Ok(rust_flags.join(" "))
 }
 
 fn make_fargo_command(