| 770 | ) |
| 771 | |
| 772 | def copy(src: Path, relative_dst: Path) -> None: |
| 773 | exe_path = self.path / relative_dst |
| 774 | exe_path.parent.mkdir(parents=True, exist_ok=True) |
| 775 | shutil.copy(src, exe_path) |
| 776 | |
| 777 | if self.strip: |
| 778 | # The debug information is large enough that it slows down CI, |
| 779 | # since we're packaging these binaries up into Docker images and |
| 780 | # shipping them around. |
| 781 | spawn.runv( |
| 782 | [*self.rd.tool("strip"), "--strip-debug", exe_path], |
| 783 | cwd=self.rd.root, |
| 784 | ) |
| 785 | else: |
| 786 | # Even if we've been asked not to strip the binary, remove the |
| 787 | # `.debug_pubnames` and `.debug_pubtypes` sections. These are just |
| 788 | # indexes that speed up launching a debugger against the binary, |
| 789 | # and we're happy to have slower debugger start up in exchange for |
| 790 | # smaller binaries. Plus the sections have been obsoleted by a |
| 791 | # `.debug_names` section in DWARF 5, and so debugger support for |
| 792 | # `.debug_pubnames`/`.debug_pubtypes` is minimal anyway. |
| 793 | # See: https://github.com/rust-lang/rust/issues/46034 |
| 794 | spawn.runv( |
| 795 | [ |
| 796 | *self.rd.tool("objcopy"), |
| 797 | "-R", |
| 798 | ".debug_pubnames", |
| 799 | "-R", |
| 800 | ".debug_pubtypes", |
| 801 | exe_path, |
| 802 | ], |
| 803 | cwd=self.rd.root, |
| 804 | ) |
| 805 | |
| 806 | for bin in self.bins: |
| 807 | src_path = self.rd.cargo_target_dir() / cargo_profile / bin |