elf32-csky.c:3932:19: error: comparison is always false

Alan Modra amodra@gmail.com
Mon Dec 7 12:03:25 GMT 2020


It looks like csky missed out on an edit for 706704c8834.  Not that it
matters very much.  There doesn't appear to be any csky reloc howto
that sets the negate bit.

Similarly for ns32k and nds32.

	* elf32-csky.c (csky_relocate_contents): Correct negate test.
	* cpu-ns32k.c (_bfd_do_ns32k_reloc_contents): Likewise.
	* elf32-nds32.c (nds32_relocate_contents): Likewise.

diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c
index 789e56f4b5..a7aa9f5df8 100644
--- a/bfd/cpu-ns32k.c
+++ b/bfd/cpu-ns32k.c
@@ -574,9 +574,7 @@ _bfd_do_ns32k_reloc_contents (reloc_howto_type *howto,
   bfd_vma x;
   bfd_boolean overflow;
 
-  /* If the size is negative, negate RELOCATION.  This isn't very
-     general.  */
-  if (howto->size < 0)
+  if (howto->negate)
     relocation = -relocation;
 
   /* Get the value we are going to relocate.  */
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index 395e6ff67f..8d48a03aad 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -3927,9 +3927,7 @@ csky_relocate_contents (reloc_howto_type *howto,
   unsigned int rightshift = howto->rightshift;
   unsigned int bitpos = howto->bitpos;
 
-  /* If the size is negative, negate RELOCATION. This isn't very
-     general.  */
-  if (howto->size < 0)
+  if (howto->negate)
     relocation = -relocation;
 
   /* FIXME: these macros should be defined at file head or head file head.  */
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 233af38c23..105d7f5d4e 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -4492,9 +4492,7 @@ nds32_relocate_contents (reloc_howto_type *howto, bfd *input_bfd,
   unsigned int rightshift = howto->rightshift;
   unsigned int bitpos = howto->bitpos;
 
-  /* If the size is negative, negate RELOCATION.  This isn't very
-     general.  */
-  if (howto->size < 0)
+  if (howto->negate)
     relocation = -relocation;
 
   /* Get the value we are going to relocate.  */

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list