[PATCH] bfd/elf64-ppc.c: fix clang -Wbitwise-instead-of-logical warning in ppc64_elf_check_init_fini

Simon Marchi simon.marchi@efficios.com
Sun Jan 16 03:13:07 GMT 2022


I see this error with clang-14:

      CC       elf64-ppc.lo
    /home/smarchi/src/binutils-gdb/bfd/elf64-ppc.c:13131:11: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
      return (check_pasted_section (info, ".init")
             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix by replacing & with &&.

Change-Id: I849e1b2401bea5f4d8ef3ab9af99ba9e3ef42490
---
 bfd/elf64-ppc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index ea9e60217bc..ae5af11d596 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -13129,7 +13129,7 @@ bool
 ppc64_elf_check_init_fini (struct bfd_link_info *info)
 {
   return (check_pasted_section (info, ".init")
-	  & check_pasted_section (info, ".fini"));
+	  && check_pasted_section (info, ".fini"));
 }
 
 /* See whether we can group stub sections together.  Grouping stub
-- 
2.34.1



More information about the Binutils mailing list