aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-06-01 17:00:53 +0930
committerAlan Modra <amodra@gmail.com>2023-06-02 09:41:49 +0930
commit56e4ccc924d47c30e7446efe771397d2de141762 (patch)
treebca1f766598f290a5bdcb32913c7a0274efacf1d /binutils/objcopy.c
parentcf6522cb2f6ef5f278fe700699b80d0433324ab3 (diff)
downloadgdb-56e4ccc924d47c30e7446efe771397d2de141762.zip
gdb-56e4ccc924d47c30e7446efe771397d2de141762.tar.gz
gdb-56e4ccc924d47c30e7446efe771397d2de141762.tar.bz2
Minor objcopy optimisation for copy_relocations_in_section
* objcopy (copy_relocations_in_section): Don't read the relocs for STRIP_ALL if keep_specific_htab is empty.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 49d54bf..ac40da8 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -4343,6 +4343,8 @@ copy_relocations_in_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
/* Core files and DWO files do not need to be relocated. */
if (bfd_get_format (obfd) == bfd_core
|| strip_symbols == STRIP_NONDWO
+ || (strip_symbols == STRIP_ALL
+ && htab_elements (keep_specific_htab) == 0)
|| discard_relocations (ibfd, isection))
relsize = 0;
else