From d2f1139ef0c006f35210fac76cb034cfe8d57c2e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cl=C3=A9ment=20Chigot?= Date: Tue, 13 Apr 2021 08:32:55 +0200 Subject: [PATCH] bfd: avoid infinite loop when static linking XCOFF git commit b95a0a3177bc changed a "return FALSE" to "continue", and missed updating the while loop iterator. * xcofflink.c (xcoff_link_check_ar_symbols): Update esym earlier. --- bfd/ChangeLog | 4 ++++ bfd/xcofflink.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 28c5791282c..1603be8e954 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2021-04-13 Clément Chigot + + * xcofflink.c (xcoff_link_check_ar_symbols): Update esym earlier. + 2021-04-13 Nelson Chu * elfnn-riscv.c (riscv_version_mismatch): Do not report the warning diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 84048620b8e..f0e0fe7aafc 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -2349,6 +2349,7 @@ xcoff_link_check_ar_symbols (bfd *abfd, struct internal_syment sym; bfd_coff_swap_sym_in (abfd, (void *) esym, (void *) &sym); + esym += (sym.n_numaux + 1) * symesz; if (EXTERN_SYM_P (sym.n_sclass) && sym.n_scnum != N_UNDEF) { @@ -2382,8 +2383,6 @@ xcoff_link_check_ar_symbols (bfd *abfd, return true; } } - - esym += (sym.n_numaux + 1) * symesz; } /* We do not need this object file. */ -- 2.30.2