message: xtask: Copy file independently of export_syms
diff: @@ -51,6 +51,11 @@ impl flags::Build {
  .args(self.profile_args())
  .run()?;
  + let build_archive = self.build_archive();
  + let dist_archive = self.dist_archive();
  + sh.create_dir(dist_archive.parent().unwrap())?;
  + sh.copy_file(&build_archive, &dist_archive)?;
  +
  eprintln!("Exporting symbols");
  self.export_syms()?;
  @@ -115,19 +120,11 @@ impl flags::Build {
  fn export_syms(&self) -> Result<()> {
  let sh = sh()?;
  -
  - let input = self.build_archive();
  - let output = self.dist_archive();
  - sh.create_dir(output.parent().unwrap())?;
  - sh.copy_file(&input, &output)?;
  -
  - let objcopy = binutil("objcopy")?;
  -
  - cmd!(sh, "{objcopy} --prefix-symbols=hermit_ {output}").run()?;
  -
  - let archive_bytes = sh.read_binary_file(&input)?;
  + let archive_path = self.dist_archive();
  + let archive_bytes = sh.read_binary_file(&archive_path)?;
  let archive = Archive::parse(&archive_bytes)?;
  + let symbol_redefinitions = {
  let sys_fns = archive
  .summarize()
  .into_iter()
  @@ -146,16 +143,24 @@ impl flags::Build {
  ]
  .into_iter();
  - let symbol_redefinitions = explicit_exports
  + explicit_exports
  .chain(sys_fns)
  .map(|symbol| format!("hermit_{symbol} {symbol}\n"))
  - .collect::<String>();
  + .collect::<String>()
  + };
  - let exported_syms = self.exported_syms();
  + let redefine_syms_path = self.redefine_syms_path();
  + sh.write_file(&redefine_syms_path, &symbol_redefinitions)?;
  - sh.write_file(&exported_syms, &symbol_redefinitions)?;
  + let objcopy = binutil("objcopy")?;
  + cmd!(sh, "{objcopy} --prefix-symbols=hermit_ {archive_path}").run()?;
  + cmd!(
  + sh,
  + "{objcopy} --redefine-syms={redefine_syms_path} {archive_path}"
  + )
  + .run()?;
  - cmd!(sh, "{objcopy} --redefine-syms={exported_syms} {output}").run()?;
  + sh.remove_path(&redefine_syms_path)?;
  Ok(())
  }
  @@ -204,7 +209,7 @@ impl flags::Build {
  dist_archive
  }
  - fn exported_syms(&self) -> PathBuf {
  + fn redefine_syms_path(&self) -> PathBuf {
  let mut redefine_syms_path = self.dist_dir();
  redefine_syms_path.push("exported-syms");
  redefine_syms_path
  